开发者

vim omnicppcomplete pattern not found

开发者 https://www.devze.com 2023-02-16 19:17 出处:网络
I installed vim7.3 on my computer (under windows 7) and i want to use an autocomplete plugin. I searched a lot and found that Omnicppcomplete is the best for that.

I installed vim7.3 on my computer (under windows 7) and i want to use an autocomplete plugin.

I searched a lot and found that Omnicppcomplete is the best for that.

So i follo开发者_StackOverflow社区wed this tutorial: Install OmniCppComplete plugin

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::|
}

and the error: -- Omni completion (^O^N^P) Pattern not found

and this bugfix not helps because i already use files which uses namespace std {}


the problem was that the set tags+=C:/Program\ Files/Vim/vimfiles/tags/stl there is something wrong here:

  • :pwd -> c:\Windows\system32
  • copy the tags file to system32
  • restart vim

then the following c++ code worked.

0

精彩评论

暂无评论...
验证码 换一张
取 消