找不到 vim omnicppcomplete 模式

2023-12-03C/C++开发问题
3

本文介绍了找不到 vim omnicppcomplete 模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在我的电脑上安装了 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 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&amp;()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6