问题描述
我在我的电脑上安装了 vim7.3(在 Windows 7 下)并且我想使用一个自动完成插件.
I installed vim7.3 on my computer (under windows 7) and i want to use an autocomplete plugin.
我搜索了很多,发现 Omnicppcomplete 是最好的.
I searched a lot and found that Omnicppcomplete is the best for that.
所以我跟着这个教程:安装 OmniCppComplete 插件
So i followed this tutorial: Install OmniCppComplete plugin
我的 _vimrc 配置文件如下所示:
My _vimrc config file looks like this:
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
但是如果我输入这个会出现错误并且不知道为什么.
But if i type this an error occurs and dont know why.
#include <iostream>
int main(void) {
std::|
}
和错误:-- Omni completion (^O^N^P) Pattern not found
还有这个 bugfix 没有帮助,因为我已经使用了使用 namespace std {}
and this bugfix not helps because i already use files which uses namespace std {}
推荐答案
问题是 set tags+=C:/Program Files/Vim/vimfiles/tags/stl
有问题这里:
the problem was that the set tags+=C:/Program Files/Vim/vimfiles/tags/stl
there is something wrong here:
:pwd
->c:Windowssystem32
- 将标签文件复制到 system32
- 重启vim
然后下面的 C++ 代码起作用了.
then the following c++ code worked.
这篇关于找不到 vim omnicppcomplete 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!