Highlight Label *tag-highlight*
If you want to highlight all the tags in the file, you can use the following mappings.
--Generate the Tags.vim file and highlight the label.
--Highlight tags only based on existing tags.vim files.
: Map : SP tags :%s/^ ([^:]*:) = ([^]*). */syntax keyword TAG 2/ : wq! Tags.vim /^
: Map : So Tags.vim
Warning: The longer the label file, the slower it will be, and the more memory the Vim consumes.
The typedef is only highlighted here, and it can be set for union and struct. To do this, you need to exuberant ctags (can be found in http://ctags.sf.net).
Put the following line in your Makefile:
# Create a types highlighting file. Need exuberant Ctags and awk
Types:types.vim
Types.vim: *. [CH]
ctags-i=gstus-o-*. [CH] |
awk ' begin{printf ("syntax keyword Typet")}
{printf ("%s", $$1)} End{print ""} ' > $@
Put the following line in your. VIMRC:
"Load Types.vim highlighted file, if present
Autocmd Bufread,bufnewfile *. [CH] Let fname = expand (' :p: H '). '/types.vim '
Autocmd Bufread,bufnewfile *. [CH] If filereadable (fname)
Autocmd Bufread,bufnewfile *. [CH] exe ' so '. FName
Autocmd Bufread,bufnewfile *. [CH] endif
==================================================
The above F11 can only recognize definitions within functions, function names, etc., and cannot recognize macro definitions.
Change yourself into
"Generate the highlighted file according to tags file tags.vim
Map : SP tags : Set Nohls :%s/file/fi le/ :%s/^ ([^:]*:) = ([^]*). */syntax keyword TAG 2/ : wq! Tags.vim /^
"All the tags in the highlighted file
Map : So Tags.vim
You'll be able to recognize macros.