Eric Weir wrote the following on 17.07.2011 01:15

-- <snip> --

> au! BufRead,BufNewFile *.~/foo/bar/*          setfiletype markdown

-- <snip> --

,----[ :h au  ]----------------------------------------------------------------

When your .vimrc file is sourced twice, the autocommands will appear twice.
To avoid this, put this command in your .vimrc file, before defining
autocommands: >

        :autocmd!       " Remove ALL autocommands for the current group.
`------------------------------------------------------------------------------

So as far as i understand the '!' does the opposit of what you are trying to do.



,----[ :h :setfiletype   ]-----------------------------------------------------

:setf[iletype] {filetype}                       *:setf* *:setfiletype*
                        Set the 'filetype' option to {filetype}, but only if
                        not done yet in a sequence of (nested) autocommands.
`------------------------------------------------------------------------------

Please note the 'but only if not done yet' in there. That might will cause you
wondering when a specific filetype does not get applied.


Lastly the pattern '*.~/foo/bar/*' does not match what you are looking for.

Try this out instead:
au BufNewFile,BufRead */foo/bar/* setl ft=markdown

The difference between 'BufNewFile,BufRead' and 'BufEnter' is, the former gets
applied only once the latter everytime when you switch to that specific buffer.
Usually the former is what people want.

-- 
bye Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6  7C18 89A4 A2A0 C70B 1A8F


-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to