问题
I'm starting out Lua development, so I ran ctags on a simple starter project and tried jumping around the source code with Ctrl + ]. Upon trying this, I got E426: tag not found: cache_objects
where cache_objects
was a function in another file. I checked the tags file and the correct entry was there for cached_objects
. I also checked my tags path and it was correct.
I then tried explicitly executing the tags command: :ta cache_objects
. This returned the same error. Now things are about to get weird. I executed: :ta /cache_objects
, and it worked! It brought me to the function defined as:
function cache_objects (basedir)
...
I triple checked the spelling to make sure it was right. How could this be happening?
回答1:
This is a bug in ctags. http://sourceforge.net/p/ctags/bugs/347/
If you noticed in your tags file that fields are tab delimited. However when ctags generated the cache_objects tag it included the space after it. vim only looks for complete words when using <C-]>
which is why it didn't find the tag but did find it when you used a regex search. If you change the line to
function cache_objects(basedir)
it works.
来源:https://stackoverflow.com/questions/25276918/vim-ctags-behaves-strangely