Vim ctags behaves strangely

无人久伴 提交于 2020-01-04 10:39:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!