OracleSolaris 11.2 - ctags and vi

313 Views Asked by At

On a freshly installed OracleSolaris I have ctags from base-developer-utilities package. It doesn't support recursive, so I generate tags as follows:

% cd my_sources; rm -f tags; touch tags
% find . -name '*.c' -o -name '*.h' -exec ctags -v -u {} \;

The tags get generated, but for some reason vim is unable to understand it, i.e. it just doesn't see any tags although I added them with set tags, instead reports error E426: tag not found.

The tag is in tags file.

Does anybody have a clue what possibly can be wrong with it? Thanks.

1

There are 1 best solutions below

3
Vitor On

If vi complains that the tag isn't there, then it's because it probably isn't. You could confirm that by opening the tags file with a text editor and search for it.

But the reason why it isn't there is because you are overwriting the contents of the tags file for each file find encounters, so it should only contain the tags of the last file. To overcome this you can add the -a argument, which is available according to its man page.

As an alternative you can try compiling a more recent ctags from source in order to use the recursive mode with the -R --languages=c arguments. If you decide to compile from source, I suggest that you use universal-ctags.