質問

I am having a problem using omnicppcomplete with vim. Actually, I am not sure if it is a .vimrc problem or an omnicppcomplete problem. In my .vimrc, I have this command to generate tags for my project when I hit ctrl+F12:

map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

But it fails with this error:

ctags: Unknown option: --c++-n

shell returned 1

It seems very strange to me because I don't use the --c++-n option in the command. What is even more strange to me is that if I just run the command manually in my terminal

ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q

It generates a tag file and everything seems to work just fine. So something about mapping it to a key is messing it up. I followed the instructions on the wiki here: http://vim.wikia.com/wiki/C%2B%2B_code_completion.

I am mostly confused about why it complains about --c++-n when I don't use that. Any help is much appreciated.

EDIT:

Both ":!which ctags" in vim and "which ctags" in the shell return "/usr/bin/ctags". However, when I do "ls /usr/bin | grep ctags", it returns both "ctags" and "ctags-exuberant".

I removed and re-installed the ctags-exuberant. Now when I try to hit c-F12 in vim, it doesn't give me an error on the command...it brings me back to the shell to hit Enter to continue, but in the code when I hit a period after an object, it still says "Pattern not found".

However, if I make a little test file like this in a separate directory:

struct MyStruct {
  int a;
  int b;
  int long_name;
};

int main(int argc, char** argv) {

  MyStruct a;
  a.      
}

Hit c-F12 to build the taglist, the auto-complete works just fine...I want it to work if I have a class that is defined in another file (still in same directory though).

役に立ちましたか?

解決 2

I reinstalled exuberant ctags and the issue was resolved.

他のヒント

The problem is not the key mapping. If I copy your mapping line to my .vimrc and hit ctrl-f12 in gvim, it echoes the command it runs and it's exactly the command from above.

Could it be that when in vim, ctags is another file/executable for you? What does :!which ctags say in vim and what does which ctags say from the shell?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top