是否可以在 Vim 中使用不同的标签文件进行全能和通用标签浏览?
我在 Vim 中使用 ctags 已经很多年了,但我才刚刚发现omnicomplete。 (看起来不错。)
但是,我有一个问题:为了让omnicomplete正常工作,我必须在生成标签时使用--extra=+q选项,这很好,但这会改变一般标签浏览的行为我不喜欢的方式。
例如,当在 Vim 中完成制表符标记名称时,我不想将标记“放入”类的“层次结构”中 - 也就是说,当制表符完成“Clas”时得到“ClassA,ClassA :: var1,ClassA :: var2” ,ClassB”,而不是“ClassA,ClassB” - 但这就是使用 --extra=+q 时发生的情况。
所以我想我正在追求两件事之一。任何一个: 1. 能够禁用制表符完成“标签层次结构”,即使这些层次结构确实存在于标签文件中。或者, 2. 能够使用不同命名的标签文件(即使用不同选项生成)进行全方位和一般标签浏览。
任何想法将不胜感激!
干杯,
想。
I've been using ctags in Vim for years, but I've only just discovered omnicomplete. (It seems good.)
However, I have a problem: to get omnicomplete working properly I have to use the --extra=+q option when generating the tags, which is fine, but this then changes the behaviour of general tag browsing in ways that I do not like.
For example, when tab-completing tag names in Vim I don't want to tag "into" the "hierarchies" of classes - that is, when tab completing "Clas" get "ClassA, ClassA::var1, ClassA::var2, ClassB", instead of "ClassA, ClassB" - but that's what happens when using --extra=+q.
So I guess I'm after one of two things. Either:
1. The ability to disable tab-completing into "tag hierarchies" even though those hierarchies do exist in the tags file. Or,
2. The ability to use differently named tags files (ie. generated with different options) for omnicomplete and general tag browsing.
Any ideas would be much appreciated!
Cheers,
thoughton.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我想我实际上已经找到了自己问题的答案。
首先,我生成两个标签文件:tags_c_vim 和tags_c_omni。
在我的 _vimrc 中,我有:
设置一些指向不同标签文件的变量,并将“vim”标签设置为默认标签。
然后我也有这个,再次在 _vimrc 中:
这里的第一行映射 F8,因此它在调用全能弹出菜单之前将标签设置更改为指向“omni”标签,第二行将标签设置重置为“ vim” 标签,当弹出窗口关闭后左下一个插入模式时。
它需要一些广泛的使用来确保它足够强大,但经过一些快速测试后它似乎确实有效。
我仍然想进行两项改进:
无论如何,我只是想分享。
干杯,
想。
OK, I think I've actually come up with an answer to my own question.
Firstly, I generate two tags files: tags_c_vim and tags_c_omni.
In my _vimrc I have:
to setup some variables pointing to the different tags files, and to set the "vim" tags to be the default tags.
Then I also have this, again in the _vimrc:
the first line here maps F8 so it changes the tags setting to point to the "omni" tags before then invoking the omnicomplete popup menu, and the second line resets the tags setting to the "vim" tags when insert mode is next left after the popup has closed.
It's going to need some extensive use to make sure it's robust enough, but it does seem to work after some quick testing.
Two improvements I'd still like to make:
Anyway, I just thought I'd share.
Cheers,
thoughton.
您可以尝试 OmniCppComplete 插件。
You could try the OmniCppComplete plugin.