Monday, 15 February 2010

Vim: use different color for words with a pattern -



Vim: use different color for words with a pattern -

am hardware engineer , utilize embedded ruby language simplify writing hardware verilog/system verilog code. in *.sv , *.v files, have lot of erb variables starting "__" (double underscore). e.g. <% __mem_depth = 64 %>. there way can create vim display words starting double underscore in different color?

you can extend built-in syntax highlighting. example, set next ~/.vim/after/syntax/verilog.vim:

syntax match verilogerbvar "\<__\w\+\>" hi link verilogerbvar identifier

this assumes corresponding text fragments aren't yet matched original syntax (in short test, weren't). else, need find syntax groups contain them , add together containedin=... :syntax command.

to find out syntax grouping causes highlighting. :syn list shows active groups, it's easier when install syntaxattr.vim - show syntax highlighting attributes of character under cursor plugin.

vim colors

No comments:

Post a Comment