2009/6/29 Jeri Raye <[email protected]>: > > Hi > > Is it possible to write a function that highlight the #define macros? > For example; if I have the following defines: > > #define PI 3.14159 > #define MAX 10 > #define MIN 0 > > is it then possible to give PI MAX and MIN anywhere used in the file > to give it the color brown?
There are three approaches that I know of to achieve this: 1) Write a short vim script that parses the current file looking for #define\s\+\([^ ]\)\+ and use the first match as an argument to syn keyword 2) Use the tag highlighting function described in :help tag-highlight - all #defines, function names, global variables etc will be highlighted in your chosen colour. 3) Use the (more complicated) tag highlighting plugin (written by me, so I apologise for the shameless plug) available at https://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting - all #defines, function names, etc will be highlighted, but you can use different colours for #defines, enumerated names, typedefs etc (there is an example colour scheme on the same website that shows the various highlight groups that are needed). Hope that helps Al --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
