.vimrc TAGS command errors
-
31-05-2021 - |
質問
I use etags with vim on linux for source(*.c, *.h) code browsing. I have created a TAGS file bu giving command :
etags --members *.c *.h
TAGS file gets created but when I start browsing say one of the source files named 1.c which has a C structure variable defined and used in one of its function definitions(The structure name is a typedef in some other 1.h file). I open the file 1.c in vim and then I do CTRL - ]
by placing cursor on that struct type, etags does not browse to the header file 1.h which has declaration of this structure.
This only happens when i have below line in my .vimrc, when i comment below two lines, etags based source browsing works fine.
set TAGS=./TAGS;$HOME
set tags=./tags;$HOME
I am trying to tell vim where to locate the TAGS file. starting from current folder till my home dir. What is incorrect here?
What is the correct syntax for above command?
Also does ctags/etags browsing with vim, show from where all a given function is called from? If yes, what is the command to see that?
解決
Locating tags file
Vim's settings are case-sensitive so
set TAGS=
is invalid. You must useset tags=
in lowercase.Vim will stop at the first match so you can't really expect it to search for a tag in
tags
andTAGS
. These files can be searched in turn with:set tags=./tags,./TAGS;$HOME " 1. tags, 2. TAGS, 3.… until $HOME
Also, search is not performed by
etags
, it's done by Vim itself.Jumping to function calls
No,
ctags
andetags
only index declarations. To jump to usage you'll needcscope