Linux 如何在 VIM (gvim) 中启用智能感知

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4704424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:29:21  来源:igfitidea点击:

How to enable intellisense in VIM (gvim)

c++linuxubuntuvim

提问by blitzkriegz

Is there any way I can have intellisense enabled in VIM (gvim). I wish to use it for STL.

有什么办法可以在 VIM (gvim) 中启用智能感知。我希望将它用于 STL。

采纳答案by Tamás Szelei

Forgive me for correcting you first, but IntelliSense is the name of the advanced code completion in Microsoft Visual Studio, not the general term for code completion.

请原谅我先纠正你,但 IntelliSense 是 Microsoft Visual Studio 中高级代码完成的名称,而不是代码完成的总称。

To answer your question, you will probably want to use YouCompleteMe. The setup is not terribly hard with vim plugin managers, but don't forget to run the shell script that compiles the compiled component of YCM. Read the docs thoroughly, most initial problems are avoidable.

要回答您的问题,您可能需要使用YouCompleteMe。使用 vim 插件管理器进行设置并不难,但不要忘记运行编译 YCM 已编译组件的 shell 脚本。彻底阅读文档,大多数初始问题都是可以避免的。

回答by Robert S. Barnes

setting up ctags databases for use with omnicppcomplete

设置 ctags 数据库以与 omnicppcomplete 一起使用

create tags for stdlibc++ and STL

为 stdlibc++ 和 STL 创建标签

$ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/stdlibcpp /usr/include/c++/4.2.4/

$ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/boost /usr/include/boost/

$ apt-file list libc6-dev | grep -o '/usr/include/.*h'> ~/.vim/tags/libc6-filelist
$ ctags --c++-kinds=+p --fields=+iaS --extra=+q -I__wur -I__THROW -I__nonnull+ -f ~/.vim/tags/libc6 -L ~/.vim/tags/libc6-filelist

Here are three links you should find useful:

以下是您应该会觉得有用的三个链接:

Vim Intellisense

Vim 智能感知

C++ code completion

C++ 代码补全

OmniCppComplete : C/C++ omni-completion with ctags database

OmniCppComplete : C/C++ omni-completion with ctags 数据库

回答by Rufus

cocseems quite promising, integrates intellisense with vim (8.0 and above) and neovim

coc看起来很有前途,将智能感知与 vim(8.0 及以上)和 neovim 集成