>
> Your idea to parse tags file is interesting. My plan is putting all defined
> (selected by user using hotkey) #ifdef into a file, and make a plugin to
> parse it.
>
> Actually I still don't know when VIM start to parsing and generate the
> highlight. Does vim generate the highlight only when we open the file?
>
Vim parses the file to determine the syntax highlighting when loading
a file, or applying a new file type, or when turning syntax on. I
believe you might also be able to trigger it with a :doautocmd Syntax
{syntax, e.g. c} or a :doautocmd FileType {filetype, e.g. c}.
Regardless, you don't really need to know under what conditions it was
triggered, if you just place any additional rules you desire in the
appropriate directory (like $HOME/vimfiles/syntax or $HOME/vimfiles/
after/syntax), or use an autocmd Syntax event.
However, I would suggest a different approach, based on my own usage.
I have folding defined for #ifdef, etc. by placing the following in
$HOME/vimfiles/after/syntax/c.vim (based loosely on extra folding for
the Vim scripting language found at http://vim.wikia.com/wiki/Syntax_folding_of_Vim_scripts):
" fold #if...#else...
No comments:
Post a Comment