分页: 1 / 2

vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 16:17
reallynotme
ctags用软件中心装的(1:5.9~svn20110310-1 (exuberant-ctags))
vim是升级11.04时升的7.3
生成tags文件用过gvim那个按钮,也试过用:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q
文件夹里也有tags文件了,
但是始终“找不到模式”,
vim的tags选项如下:
set tag=./tags,./TAGS,tags,TAGS

大家帮帮忙,弄了很久了,我刚开始用ubuntu,另外我这上这网实在太慢了,很多时候根本登不上,这贴还是用在线代理发的

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 18:11
reallynotme
哎,没人呢,我再说得详细点把,下面是我测试的程序:
#include <iostream>
using namespace std;

struct node
{
node *next;
node *pre;
int data;
};

int main()
{
node *n=new node;
n->next=n;
cout<<"hello world"<<endl;
return 0;
}
输入n->后用<c-x><c-o>总是“找不到模式”
这是生成的tags文件,和上面的代码文件在同一文件夹内
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
data helloworld.cpp /^ int data;$/;" m struct:node file: access:public
main helloworld.cpp /^int main()$/;" f signature:()
next helloworld.cpp /^ node *next;$/;" m struct:node file: access:public
node helloworld.cpp /^struct node$/;" s file:
node::data helloworld.cpp /^ int data;$/;" m struct:node file: access:public
node::next helloworld.cpp /^ node *next;$/;" m struct:node file: access:public
node::pre helloworld.cpp /^ node *pre;$/;" m struct:node file: access:public
pre helloworld.cpp /^ node *pre;$/;" m struct:node file: access:public


知道的人帮帮忙

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 18:29
reallynotme
奇怪,怎么没回复上,再发一次:

我的测试程序如下:
//helloworld.cpp
#include <iostream>
using namespace std;

struct node
{
node *next;
node *pre;
int data;
};

int main()
{
node *n=new node;
n->next=n;
cout<<"hello world"<<endl;
return 0;
}

输入n->后用<c-x><c-o>总是“未找到模式”
tags文件内容如下(和helloworld.cpp在同一个文件夹下):
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
data helloworld.cpp /^ int data;$/;" m struct:node file: access:public
main helloworld.cpp /^int main()$/;" f signature:()
next helloworld.cpp /^ node *next;$/;" m struct:node file: access:public
node helloworld.cpp /^struct node$/;" s file:
node::data helloworld.cpp /^ int data;$/;" m struct:node file: access:public
node::next helloworld.cpp /^ node *next;$/;" m struct:node file: access:public
node::pre helloworld.cpp /^ node *pre;$/;" m struct:node file: access:public
pre helloworld.cpp /^ node *pre;$/;" m struct:node file: access:public

知道的麻烦说一说,另外ctrl+]能用

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 18:57
reallynotme
还有就是ctrl+]可以跳转到结构体定义处

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 19:57
fanhe
你这个ctags好新啊, 怎么搞来的
5.9有什么新特性

至于问题,
1. 你到底安装了 omnicppcomplete 没
2. 请切换到源文件所在的目录. (:pwd 查看当前目录)

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 20:50
reallynotme
艾,难怪查不到解决方案,原来我竟然是没装这插件 :em06

都怪vim手册,直接就讲用<c-x><c-o>,根本就没提omnicppcomplete,我还以为是默认插件呢

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 21:39
lilydjwg
reallynotme 写了:艾,难怪查不到解决方案,原来我竟然是没装这插件 :em06

都怪vim手册,直接就讲用<c-x><c-o>,根本就没提omnicppcomplete,我还以为是默认插件呢
Vim 手册 写了:

代码: 全选

全能 (omni) 补全					*compl-omni*

命令补全可以由用户通过 'omnifunc' 选项自定义一个函数来完成。这通常用于特定文件
类型的补全。

下面说明如何调用此函数,并提供示例 |complete-functions|。
关于特定文件类型的说明,见 |compl-omni-filetypes|。
[/quote]
有少数文件类型的全能补全有自带的。

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 21:52
reallynotme
fanhe 写了:你这个ctags好新啊, 怎么搞来的
5.9有什么新特性

至于问题,
1. 你到底安装了 omnicppcomplete 没
2. 请切换到源文件所在的目录. (:pwd 查看当前目录)
ctags是直接在UBUNTU 11.04的软件中心装的,但是官网上的还是5.8,为什么会这样呢??
ubuntu的软件中心真是奇特,有的软件新版本都发行n旧了,也没更新,这个官网没更新,软件中心里到有了

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-05-08 23:02
fanhe
我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-08-30 18:57
小刀~~~
楼主,请问我生成tags后,ctrl+]始终 找不到tag:~~~,(~~~表示查找的函数)。路径看来是没问题,也不知到是不是tags文件出错了?????
都郁闷了一天了,希望楼主不吝赐教!!!

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-11-06 10:35
Litten
回10楼小刀~~~~

你可以打开生成得tags文件文件看一下,是不是发现里面没有你文件里面的函数。
所以,你要打开终端,在tags文件目录下,对ctags文件进行更新。

$ ctags -R

这样就可以了

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-11-06 13:47
风间星魂
fanhe 写了:我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
我不太在乎ctags的速度,我比较在意准确度,比如libc库那些玩意经常缺符号,还有cpp模版,有啥解决方法?

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-11-06 14:39
fanhe
风间星魂 写了:
fanhe 写了:我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
我不太在乎ctags的速度,我比较在意准确度,比如libc库那些玩意经常缺符号,还有cpp模版,有啥解决方法?
这里
viewtopic.php?f=68&t=342932

现在是一个套件, 没啥兴趣独立出来
因为补全的时候要感知当前包含路径, 这需要读取项目配置什么的
基本要以项目为基本单位

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-11-06 16:29
风间星魂
fanhe 写了:
风间星魂 写了:
fanhe 写了:我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
我不太在乎ctags的速度,我比较在意准确度,比如libc库那些玩意经常缺符号,还有cpp模版,有啥解决方法?
这里
viewtopic.php?f=68&t=342932

现在是一个套件, 没啥兴趣独立出来
因为补全的时候要感知当前包含路径, 这需要读取项目配置什么的
基本要以项目为基本单位
我的vim是7.2 python2.6.6

你用了什么vim7.3的特性?+python3?

Re: vim <c-x><c-o>补全总是“找不到模式”

发表于 : 2011-11-06 17:43
fanhe
风间星魂 写了:
fanhe 写了:
风间星魂 写了:
fanhe 写了:我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
我不太在乎ctags的速度,我比较在意准确度,比如libc库那些玩意经常缺符号,还有cpp模版,有啥解决方法?
这里
viewtopic.php?f=68&t=342932

现在是一个套件, 没啥兴趣独立出来
因为补全的时候要感知当前包含路径, 这需要读取项目配置什么的
基本要以项目为基本单位
我的vim是7.2 python2.6.6

你用了什么vim7.3的特性?+python3?
好几个新函数
自己升级去吧

图片