RE: autocmd bug?
> But your command gave me an idea -- the following should work > > au FileType *.* exe substitute(expand(''), > \ '^\(.*\)\.\(.*\)$', > \ 'doau FileType \1 | doau FileType \2', > \ '') Thankyou - this is the behaviour I was expecting.
Re: autocmd bug?
Hi, A.J.Mechelynck wrote: > Jürgen Krämer wrote: > [...] >> Nice idea (esp. the recursion), but alas it's not that simple, because >> the pattern only accepts wildcards (not regular expressions) and if it >> did, the subpatterns would probably not be recognized in the command. >> But your command gave me an idea -- the following should work >> >> au FileType *.* exe substitute(expand(''), >> \ '^\(.*\)\.\(.*\)$', >> \ 'doau FileType \1 | doau FileType \2', >> \ '') >>> ('cindent' is set by the indent/c.vim plugin). >> Regards, >> Jürgen >> > > additional question: does ":doau" work in an autocommand or does it require a > "nested" flag somewhere? >From the example at ":help doautocmd" it seems that an additional "nested" is not needed. I also tested it by defining the following autocommand: au FileType * echo expand('') The result of executing setf c.doxygen was c.doxygen c doxygen So I'd say "nested" is not needed. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
Re: autocmd bug?
Jürgen Krämer wrote: [...] Nice idea (esp. the recursion), but alas it's not that simple, because the pattern only accepts wildcards (not regular expressions) and if it did, the subpatterns would probably not be recognized in the command. But your command gave me an idea -- the following should work au FileType *.* exe substitute(expand(''), \ '^\(.*\)\.\(.*\)$', \ 'doau FileType \1 | doau FileType \2', \ '') ('cindent' is set by the indent/c.vim plugin). Regards, Jürgen additional question: does ":doau" work in an autocommand or does it require a "nested" flag somewhere? Best regards, Tony. -- It was one of those perfect summer days -- the sun was shining, a breeze was blowing, the birds were singing, and the lawn mower was broken ... -- James Dent
Re: autocmd bug?
Hi, A.J.Mechelynck wrote: > Jürgen Krämer wrote: > [...] >> the FileType event is only fired once with the exact filetype you >> specified in your set command, so you must additionally define the >> following autocommand: >> >> autocmd FileType c.doxygen setlocal cindent number cursorline > > If that is true, doesn't it defeat the purpose of setting the filetype with a > dot? I'm not sure -- at least it seems to be a little bit inconsistent to me, because ":help 'filetype'" explicitly mentions filetype plugins and syntax files: | When a dot appears in the value then this separates two filetype | names. Example: | /* vim: set filetype=c.doxygen : */ ~ | This will use the "c" filetype first, then the "doxygen" filetype. | This works both for filetype plugins and for syntax files. More than | one dot may appear. So, moving the ":setlocal" commands from the autocommand to a filetype plugin would work, but there seem to be a lot of people that want to keep their settings in one single place -- namely ~/.vimrc -- to make it simpler to exchange them between multiple installations. > Or should we add something like (untested) > >:au Filetype \(w*\).\(\S*\) exe "doau FileType \1" | exe "doau FileType \2" > > ? Nice idea (esp. the recursion), but alas it's not that simple, because the pattern only accepts wildcards (not regular expressions) and if it did, the subpatterns would probably not be recognized in the command. But your command gave me an idea -- the following should work au FileType *.* exe substitute(expand(''), \ '^\(.*\)\.\(.*\)$', \ 'doau FileType \1 | doau FileType \2', \ '') > > ('cindent' is set by the indent/c.vim plugin). Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
Re: autocmd bug?
Jürgen Krämer wrote: [...] the FileType event is only fired once with the exact filetype you specified in your set command, so you must additionally define the following autocommand: autocmd FileType c.doxygen setlocal cindent number cursorline Regards, Jürgen If that is true, doesn't it defeat the purpose of setting the filetype with a dot? Or should we add something like (untested) :au Filetype \(w*\).\(\S*\) exe "doau FileType \1" | exe "doau FileType \2" ? ('cindent' is set by the indent/c.vim plugin). Best regards, Tony. -- If God had meant for us to be naked, we would have been born that way.
Re: autocmd bug?
Hi, Michael Wookey schrieb: > I have the following in my .vimrc: > > filetype plugin indent on > autocmd FileType c,h,cpp,hpp,cs setlocal cindent number cursorline > > If I have a new buffer and set the filetype as follows, everything works > just fine: > > :set filetype=c > > However, if I have a new buffer and I set the filetype like this, the > autocmd doesn't fire: > > :set filetype=c.doxygen > > This syntax is described in: > > :help 'filetype' > > The result is that I don't get cindent, number or cursorline set. > > I actually noticed this behaviour when a modeline in a C file set the > filetype to 'c.doxygen' and my options didn't appear. > > Does this work for anyone else or is it just my settings messing > something up? Vim build details are below. the FileType event is only fired once with the exact filetype you specified in your set command, so you must additionally define the following autocommand: autocmd FileType c.doxygen setlocal cindent number cursorline Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
RE: autocmd bug?
> > I have the following in my .vimrc: > > > > filetype plugin indent on > > autocmd FileType c,h,cpp,hpp,cs setlocal cindent number > cursorline > > > > If I have a new buffer and set the filetype as follows, everything > works > > just fine: > > > > :set filetype=c > > > > However, if I have a new buffer and I set the filetype like this, the > > autocmd doesn't fire: > > > > :set filetype=c.doxygen > > > > This syntax is described in: > > > > :help 'filetype' > > Which line/paragraph ? Can you paste a n excerpt ? I don;t have > it in my filetype.txt doc. I have vim7.188 and I don't have this > functionality. > > About year ago I suggested such syntax -- 'set filetype=TYPE.SUBTYPE' > -- but I don't think it was accepted. I think vim does not have this. > Or is it some recent addition I'm not aware of ? From: *options.txt* For Vim version 7.0. Last change: 2007 Mar 14 *'filetype'* *'ft'* 'filetype' 'ft' string (default: "") local to buffer {not in Vi} {not available when compiled without the |+autocmd| feature} When this option is set, the FileType autocommand event is triggered. All autocommands that match with the value of this option will be executed. Thus the value of 'filetype' is used in place of the file name. Otherwise this option does not always reflect the current file type. This option is normally set when the file type is detected. To enable this use the ":filetype on" command. |:filetype| Setting this option to a different value is most useful in a modeline, for a file for which the file type is not automatically recognized. Example, for in an IDL file: /* vim: set filetype=idl : */ ~ |FileType| |filetypes| When a dot appears in the value then this separates two filetype names. Example: /* vim: set filetype=c.doxygen : */ ~ This will use the "c" filetype first, then the "doxygen" filetype. This works both for filetype plugins and for syntax files. More than one dot may appear. Do not confuse this option with 'osfiletype', which is for the file type that is actually stored with the file. This option is not copied to another buffer, independent of the 's' or 'S' flag in 'cpoptions'. Only normal file name characters can be used, "/\*?[|<>" are illegal.
Re: autocmd bug?
On 3/26/07, Michael Wookey <[EMAIL PROTECTED]> wrote: I have the following in my .vimrc: filetype plugin indent on autocmd FileType c,h,cpp,hpp,cs setlocal cindent number cursorline If I have a new buffer and set the filetype as follows, everything works just fine: :set filetype=c However, if I have a new buffer and I set the filetype like this, the autocmd doesn't fire: :set filetype=c.doxygen This syntax is described in: :help 'filetype' Which line/paragraph ? Can you paste a n excerpt ? I don;t have it in my filetype.txt doc. I have vim7.188 and I don't have this functionality. About year ago I suggested such syntax -- 'set filetype=TYPE.SUBTYPE' -- but I don't think it was accepted. I think vim does not have this. Or is it some recent addition I'm not aware of ? Yakov
autocmd bug?
I have the following in my .vimrc: filetype plugin indent on autocmd FileType c,h,cpp,hpp,cs setlocal cindent number cursorline If I have a new buffer and set the filetype as follows, everything works just fine: :set filetype=c However, if I have a new buffer and I set the filetype like this, the autocmd doesn't fire: :set filetype=c.doxygen This syntax is described in: :help 'filetype' The result is that I don't get cindent, number or cursorline set. I actually noticed this behaviour when a modeline in a C file set the filetype to 'c.doxygen' and my options didn't appear. Does this work for anyone else or is it just my settings messing something up? Vim build details are below. cheers - VIM - Vi IMproved 7.0 (2006 May 7, compiled Mar 19 2007 20:36:01) MacOS X (unix) version Included patches: 1-219 Compiled by [EMAIL PROTECTED] Big version with Carbon GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval +browse ++builtin_terms +byte_offset +cindent -clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/Applications/Vim.app/Contents/Resources/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MAC -fno-common -fpascal-strings -Wall -Wno-unknown-pragmas -mdynamic-no-pic -pipe -I. -Iproto -DMACOS_X_UNIX -no-cpp-precomp -I/Developer/Headers/FlatCarbon -g -O Linking: gcc -L/usr/local/lib -o Vim -framework Carbon -lncurses -liconv