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

--
Best,
Ben

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