我在我的电脑上安装了 vim7.3(在 windows 7 下),我想使用一个自动完成插件。
我搜索了很多,发现 Omnicppcomplete 是最好的。
所以我遵循了这个教程: Install OmniCppComplete plugin
我的 _vimrc 配置文件如下所示:
set nocp
filetype plugin on
syntax on
set filetype=cpp
set tags+=C:/Program\ Files/Vim/vimfiles/tags/stl
" build tags of your own project with CTRL+F12
"map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
noremap <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr>
inoremap <F12> <Esc>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr>
" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_MayCompleteDot = 1
let OmniCpp_MayCompleteArrow = 1
let OmniCpp_MayCompleteScope = 1
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
但是如果我输入这个错误发生并且不知道为什么。
#include <iostream>
int main(void) {
std::|
}
和错误:-- Omni completion (^O^N^P) Pattern not found
还有这个bugfix没有帮助,因为我已经使用了使用 namespace std {}
最佳答案
问题是 set tags+=C:/Program\Files/Vim/vimfiles/tags/STL
这里有问题:
:pwd
->c:\Windows\system32
- 复制标签文件到system32
- 重启vim
然后下面的 c++ 代码就可以工作了。
关于c++ - 找不到 vim omnicppcomplete 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5313943/