On Thursday, 23 August, 2012 at 16:01:30 BST, Ben Fritz wrote:
Switch to checking filetype instead of file extension, something like:

au BufWritePost * if &ft=='perl' | make | endif

When I try this:

  autocmd BufRead * if &ft == 'perl' | setlocal makeprg=perl\ -cw\ % | endif

makeprg doesn't get set, I guess because vim sets the filetype to "perl" only 
after BufRead has happened (the :help doesn't say). The :help does hint at using 
BufWinEnter instead, which works for this case, but it seems suboptimal having these 
autocmd commands executed every time I display the buffer, when really I only need them 
executed the once, after buffer read/load.

--

.

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