Saturday, December 26, 2009

Vi editor, auto coloring(highlighting) of keywords?

I am using VI editor for C programs and I want the keywords to be automatically highlighted in a different color( I think there is a ';set'; command to do this )... appreciate if someone can help me on this.





Thanks.Vi editor, auto coloring(highlighting) of keywords?
';real'; vi has no highlighting capabilities.


If you need syntax highlighting (and much, much more) -- install vim[1], vile or elvis (I'd prefer vim -- the other two are not _that_ popular/ubiquitous). The 'vi' you find in most Linux distributions is usually the vim (Vi IMproved).


You can check your version entering (in command mode)


:version





Vim: adding ';syntax on'; to your $HOME/.vimrc will turn the highlighting permanently on.





Interactive usage:


in command mode:


:syntax on


:syntax off





You may create your own syntax definitions:


:help syn





Additionally you may want to change the color scheme, eg.:


My favorite:


:colorscheme murphy





Default (quite uncomfortable with transparent terminals):


:colorscheme default








[1] http://www.vim.orgVi editor, auto coloring(highlighting) of keywords?
If you want to highlight the C syntax, you can turn on color syntax highlighting by typing





:syntax on

No comments:

Post a Comment