Wiki

Clone wiki

TagHighlight / ExternalLibrary

External Library Example

Use Case

User has (C) source code in the current directory; project uses an external library (stored elsewhere on the hard disk) but user would like to highlight the keywords from the user library as well as the keywords from the main project. User is running a version of Vim with dynamic support for BOTH python2 and python3, but would like to use python 2 by preference. User would like to include local variables in the highlighted keyword list. Exuberant ctags is installed in the system path with executable name etags.

Implementation

First of all, we'll set TagHighlight up to use python 2 via the python interface and to recognise the non-standard ctags executable name. In vimrc, add the following lines:

if ! exists('g:TagHighlightSettings')
	let g:TagHighlightSettings = {}
endif
let g:TagHighlightSettings['ForcedPythonVariant'] = 'if_pyth'
let g:TagHighlightSettings['CtagsExecutable'] = 'etags'

Next, generate the types highlighter for the library. Let's assume that the library is stored in /home/user/libraries/lib1. Open up a new Vim and type:

:cd /home/user/libraries/lib1
:UpdateTypesFile

That should create a file called types_c.taghl in the library directory.

Now, create a project config file in the project directory. The file should be called taghl_config.txt. In that file, add the following lines (no leading whitespace):

IncludeLocals:True
UserLibraries:/home/user/libraries/lib1/types_c.taghl

Open any source file in the project and run:

:UpdateTypesFile

Updated