Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There's no built in way to highlight defines without using a tag highlighter. If you want to just highlight defined names (rather than having the comparatively slow response of a full tag highlighter), you could modify the tag highlighter to only highlight defined names.</p> <p>If you use my <a href="http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting" rel="nofollow noreferrer">tag highlighter</a>, you could modify mktypes.py (unless you're using the Windows executable version, in which case email me on the address on the website and I'll compile it for you) by changing this:</p> <pre><code>UsedTypes = [ 'ctags_c', 'ctags_d', 'ctags_e', 'ctags_f', 'ctags_g', 'ctags_k', 'ctags_m', 'ctags_p', 'ctags_s', 'ctags_t', 'ctags_u', 'ctags_v' ] </code></pre> <p>to this:</p> <pre><code>UsedTypes = ['ctags_d'] </code></pre> <p>This will generate a type highlighting file that only includes defined names and it should therefore run a lot quicker. If you have too many defined names in your project then it'll still slow Vim down a bit.</p> <p>To highlight only the defined names that are defined in the current file, add an autocmd that calls a Vim function after reading a file. The function should be something like:</p> <pre><code>function! HighlightDefinedNames() " Clear any existing defined names syn clear DefinedName " Run through the whole file for l in getline('1','$') " Look for #define if l =~ '^\s*#\s*define\s\+' " Find the name part of the #define let name = substitute(l, '^\s*#\s*define\s\+\(\k\+\).*$', '\1', '') " Highlight it as DefinedName exe 'syn keyword DefinedName ' . name endif endfor endfunction </code></pre> <p>You'll need to make sure you've highlighted DefinedName in your colourscheme, e.g.</p> <pre><code>hi DefinedName guifg=#ee82ee </code></pre> <p>(assuming you're using the GUI).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload