Friday, July 8, 2011

OmniCppComplete doesn't work with namespaces or ::

Hi everybody,

I am new to vim and tried to set up Omni completion for C++ in vim.
I use gvim Version 7.3 and Windows XP.

What I have done so far is:

Download OmniCppComplete from http://www.vim.org/scripts/script.php?script_id=1520 and the Windows version of ctags from http://ctags.sourceforge.net/

Copy the after autoload and doc directories from the archive to C:\Programme\Vim\vimfiles\after, C:\Programme\Vim\vimfiles\autoload and C:\Programme\Vim\vimfiles\doc

Add the following lines in my _vimrc file:
set nocp
filetype plugin on

" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
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


Write a file main.cpp:
//------------------------------------
#include<vector>

class MyClass{
public:
int f(){return 3;}
int g(){return 6;}
};

int main(){
MyClass a;
std::vector<int> v;
vector<int> w;

return 0;
}
//----------------------------------

Download modified header files from http://www.vim.org/scripts/script.php?script_id=2358
On this header files I executed ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ cpp_src 

In the directory with the main.cpp I executed ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

The 2 tags files where then added to vims tags variable by :set tags += C:/some/path/tags

My Problem now is:
When I type "MyClass::" then I get a "-- Omni completion (^O^N^P) Pattern not found"
The same for "std::" and "v."

But "a." and "w." works as expected.

Did I misunderstand the capabilities of OmniCppComplete; did I do something wrong; or is my computer hating me?

Hope somebody can help.

Tim

P.S.:
I didn't know if I should write what I have done as detailed as I did, since everbody who tries to help me has to read all that.
But on the other hand there may be details in there that are needed.
I appreciate advices how long I should describe the situation when I have another problem in the future.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: