Reputation: 159
I was following this: http://vim.wikia.com/wiki/C++_code_completion
At some point it says that when you type something like std:: "A box opens with suggestions."
In my case as soon as I type std:: I get a message in the bar at the bottom: Omni Completion (^O^N^P) Pattern not found
This may as well be a mess because no tutorial explains where things go in Windows.
For example: before I can install OmniCompletion, I have to install ctags. How? I have no idea. At some point I read that I only need ctags.exe under windows. But where do I put it? I figured out to put it in the mingw/bin/ directory since it was already in the path.
And it seems to work. Though when I press C-12 instead of indexing the current file, it seems to start indexing my whole home directory in Windows.
Every time I opened a .cpp file it kept saying "Pattern not found".
I eventually figured out that it works IF I edit a specific file by right clicking on it, and pick "edit with Vim" from the menu. If instead I launch Vim from its shortcut and THEN open a .cpp file, OmniCompletion fails.
The reason seems to be that "edit with Vim" gives the program the correct working directory, but if I then open a file that exists somewhere else, OmniCompletion stops working and says it can't find anything.
So, under Windows, what is that tells Vim in which directory to operate, so that I can edit properly different files no matter where they are, and no matter how I opened Vim in the first place?
And how can I run ctags so that it does its job in the current directory where the active file is, instead of wherever it randomly pleases?
Upvotes: 1
Views: 349
Reputation: 15735
Vim's working directory is inherited from where you start Vim, or else defaults to your $HOME
directory. I don't know much about omnicompletion, but it sounds like your problems could be fixed by setting
:set autochdir
This means Vim's working directory will always be that of the file you are editting.
Upvotes: 2