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

Vim、Emacs配置和使用
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#1

帖子 reallynotme » 2011-05-08 16:17

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,另外我这上这网实在太慢了,很多时候根本登不上,这贴还是用在线代理发的
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#2

帖子 reallynotme » 2011-05-08 18:11

哎,没人呢,我再说得详细点把,下面是我测试的程序:
#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


知道的人帮帮忙
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#3

帖子 reallynotme » 2011-05-08 18:29

奇怪,怎么没回复上,再发一次:

我的测试程序如下:
//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+]能用
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#4

帖子 reallynotme » 2011-05-08 18:57

还有就是ctrl+]可以跳转到结构体定义处
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

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

#5

帖子 fanhe » 2011-05-08 19:57

你这个ctags好新啊, 怎么搞来的
5.9有什么新特性

至于问题,
1. 你到底安装了 omnicppcomplete 没
2. 请切换到源文件所在的目录. (:pwd 查看当前目录)
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#6

帖子 reallynotme » 2011-05-08 20:50

艾,难怪查不到解决方案,原来我竟然是没装这插件 :em06

都怪vim手册,直接就讲用<c-x><c-o>,根本就没提omnicppcomplete,我还以为是默认插件呢
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

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

#7

帖子 lilydjwg » 2011-05-08 21:39

reallynotme 写了:艾,难怪查不到解决方案,原来我竟然是没装这插件 :em06

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

代码: 全选

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

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

下面说明如何调用此函数,并提供示例 |complete-functions|。
关于特定文件类型的说明,见 |compl-omni-filetypes|。
[/quote]
有少数文件类型的全能补全有自带的。
reallynotme
帖子: 157
注册时间: 2010-11-11 18:13
系统: Ubuntu

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

#8

帖子 reallynotme » 2011-05-08 21:52

fanhe 写了:你这个ctags好新啊, 怎么搞来的
5.9有什么新特性

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

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

#9

帖子 fanhe » 2011-05-08 23:02

我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
小刀~~~
帖子: 3
注册时间: 2011-08-30 18:23

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

#10

帖子 小刀~~~ » 2011-08-30 18:57

楼主,请问我生成tags后,ctrl+]始终 找不到tag:~~~,(~~~表示查找的函数)。路径看来是没问题,也不知到是不是tags文件出错了?????
都郁闷了一天了,希望楼主不吝赐教!!!
Litten
帖子: 1
注册时间: 2011-11-03 16:11

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

#11

帖子 Litten » 2011-11-06 10:35

回10楼小刀~~~~

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

$ ctags -R

这样就可以了
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

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

#12

帖子 风间星魂 » 2011-11-06 13:47

fanhe 写了:我基本完成了把 ctags 的结果存贮到 sqlite 数据库的 python 实现
过几天我应该会首先应用于 omnicppcomplete, 有兴趣可以试试
我不太在乎ctags的速度,我比较在意准确度,比如libc库那些玩意经常缺符号,还有cpp模版,有啥解决方法?
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

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

#13

帖子 fanhe » 2011-11-06 14:39

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

现在是一个套件, 没啥兴趣独立出来
因为补全的时候要感知当前包含路径, 这需要读取项目配置什么的
基本要以项目为基本单位
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

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

#14

帖子 风间星魂 » 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?
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

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

#15

帖子 fanhe » 2011-11-06 17:43

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

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

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

图片
回复