On 07/10/2011 05:01 PM, Benjamin R. Haskell wrote:
On Sun, 10 Jul 2011, AK wrote:

Hi, I have a ftdetect script defined like this:

au BufNewFile,BufRead *.vtobu setf vimtobu

augroup VimTobu
au!
au BufWritePost vimtobu call VimTobu("save")
au BufWritePost vimtobu echo 'SAVED!'
augroup END

:au BufWritePost vimtobu {etc...}

will only fire for filenames that match 'vimtobu'. That's not a
filetype; it's a filename pattern. See:

:help :au
:help autocmd-patterns

(One exception I know of to "{pat} is a filename" is the 'FileType'
event, where {pat} is a filetype.)

For your case, the following should work:

augroup VimTobu
au!
au BufWritePost * if &ft == 'vimtobu' | call VimTobu("save") | endif
au BufWritePost * if &ft == 'vimtobu' | echo 'SAVED!' | endif
augroup END



Thanks so much, that worked great. For some reason I was
completely certain filetype also worked.. No idea where
I picked that up.

 -ak

--
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