On Apr 17, 8:51 pm, Ben Schmidt <mail_ben_schm...@yahoo.com.au> wrote:

> :augroup ClearMatches
> :au!
> :au FileType * match
> :augroup END
>
> It's probably important for that to be before you turn on filetype detection 
> or
> syntax highlighting in your .vimrc, because otherwise the autocommand will run
> after the filetype plugins and turn off the highlighting immediately, not 
> when the
> filetype next changes!
>

Actually, to make this work properly, you'll probably just need to use
autocmds for the whole thing, rather than after/ftplugin.

Something like this is a start:

augroup CommaError
au!
" clear matches on most file types
autocmd Filetype * match
" match commas on end of line for javascript
autocmd Filetype javascript match Error /,\_s*[)}\]]/
augroup END

It won't be perfect, though. Filetype detection is only done on a
buffer read, so when you use :split, for example, you won't get your
error matching.

You can tweak it a little using this tip to get it to work in more
cases:

http://vim.wikia.com/wiki/Detect_window_creation_with_WinEnter

You can check the filetype using &filetype in your autocmd.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to