Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2309047
  • 博文数量: 395
  • 博客积分: 10994
  • 博客等级: 上将
  • 技术积分: 5586
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-17 19:49
文章存档

2014年(1)

2013年(10)

2012年(74)

2011年(303)

2010年(7)

分类: LINUX

2011-07-21 23:44:56

移植以来都想弄一个可以在linux下运行的一个代码查看软件,最近才整理了一个(也是参照一本书上写的),是vim+Taglist+ctags
为了演示方便,准备了3个包:如下:
 
 taglist_42.zip   。。。。。
 
 zebra-0.95.tar.gz.rar   (用来验证软件安装后的使用的)
 
一。安装tag.tar.gz包
[root@localhost vim_Taglisht_Ctags]# tar zxvf ctags-5.6.tar.gz
[root@localhost vim_Taglisht_Ctags]# ls
ctags-5.6  ctags-5.6.tar.gz  taglist_4.2.zip  zebra-0.95a.tar.gz
[root@localhost vim_Taglisht_Ctags]# cd ctags-5.6

[root@localhost ctags-5.6]# ./configure

[root@localhost ctags-5.6]# make

[root@localhost ctags-5.6]# ./mkinstalldirs

[root@localhost ctags-5.6]# make install

cp ctags /usr/local/bin/ctags  &&  chmod 755 /usr/local/bin/ctags

cp ./ctags.1 /usr/local/man/man1/ctags.1  &&  chmod 644 /usr/local/man/man1/ctags.1

[root@localhost ctags-5.6]# ctags

ctags: No files specified. Try "ctags --help".

 

 

taglist的安装:

[root@localhost ctags-5.6]# cd ~

[root@localhost ~]# pwd

/root

[root@localhost ~]# mkdir -p .vim/plugin

[root@localhost ~]# cd .vim

[root@localhost .vim]# ll ../taglist_4.2.zip

-rw-r--r-- 1 root root 48384  8  7 09:20 ../taglist_4.2.zip

[root@localhost .vim]# unzip ../taglist_4.2.zip

Archive:  ../taglist_4.2.zip

  inflating: plugin/taglist.vim     

  inflating: doc/taglist.txt 

[root@localhost .vim]# ls

doc  plugin

[root@localhost .vim]# vim

  1 ~                              VIM - Vi IMproved

~

~                                 版本 7.3.29

~                           维护人 Bram Moolenaar

~                         修改者

~                       Vim 是可自由分发的开放源代码软件

~

~                              赞助 Vim 的开发!

~                输入  :help sponsor    查看说明

~

~                输入  :q               退出

~                输入  :help      查看在线帮助

~                输入  :help version7   查看版本信息

~

:helptags~/.vim/doc,然后回车

  1

~

~                              VIM - Vi IMproved

~

~                                 版本 7.3.29

~                           维护人 Bram Moolenaar

~                         修改者

~                       Vim 是可自由分发的开放源代码软件

~

~                            帮助乌干达的可怜儿童!

~                输入  :help iccf       查看说明

~

~                输入  :q               退出

~                输入  :help      查看在线帮助

~                输入  :help version7   查看版本信息

~

:Tlist       

   " Press to display hel|  1

                              |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

   ~                          |~

__Tag_List__   1,1        全部 [未命名]                                              

       0,0-1         全部     

说明Taglist安装成功了

下面修改一个文件,使CtagsTaglist联系起来:

[root@localhost .vim]# vim ~/.vim/plugin/taglist.vim   

在:63 if !exists('loaded_taglist') 上面一行加上一句,如下:

 63 let Tlist_Ctags_cmd="/usr/local/bin/ctags"

 64 if !exists('loaded_taglist')

 65     " First time loading the taglist plugin

 66     "

[root@localhost .vim]# cd /home/ruanjian/vim_Taglisht_Ctags/

[root@localhost vim_Taglisht_Ctags]# ls

ctags-5.6  ctags-5.6.tar.gz  taglist_4.2.zip  zebra-0.95a.tar.gz

[root@localhost vim_Taglisht_Ctags]# tar zxvf zebra-0.95a.tar.gz

[root@localhost vim_Taglisht_Ctags]# cd zebra-0.95a

[root@localhost zebra-0.95a]# ls

aclocal.m4    configure     INSTALL        NEWS            SERVICES

AUTHORS       configure.ac  install-sh     ospf6d          TODO

bgpd          COPYING       lib            ospfd           tools

ChangeLog     COPYING.LIB   Makefile.am    README          update-autotools

config.guess  depcomp       Makefile.in    REPORTING-BUGS  vtysh

config.h.in   doc           missing        ripd            zebra

config.sub    init          mkinstalldirs  ripngd

[root@localhost zebra-0.95a]# ctags -R

[root@localhost zebra-0.95a]# ls -l tags

-rw-r--r-- 1 root root 728313  8  7 09:42 tags

[root@localhost zebra-0.95a]# vim bgpd/bgp_main.c

  1 /* Main routine of bgpd.

  2    Copyright (C) 1996, 97, 98, 1999 Kunihiro Ishiguro

  3

  4 This file is part of GNU Zebra.

  5

  6 GNU Zebra is free software; you can redistribute it and/or modify it

  7 under the terms of the GNU General Public License as published by the

  8 Free Software Foundation; either version 2, or (at your option) any

  9 later version.

 10

 11 GNU Zebra is distributed in the hope that it will be useful, but

 12 WITHOUT ANY WARRANTY; without even the implied warranty of

 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

 14 General Public License for more details.

 15

 16 You should have received a copy of the GNU General Public License

 17 along with GNU Zebra; see the file COPYING.  If not, write to the Free

 18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

 19 02111-1307, USA.  */

 20

 21 #include

 22

 23 #include "vector.h"

:TlistToggle

 

   " Press to display hel|  1 /* Main routine of bgpd.

                              |  2    Copyright (C) 1996, 97, 98, 1999 Kunihiro

-  bgp_main.c (/home/ruanjian/|    Ishiguro

|-   variable                 |  3

||     longopts               |  4 This file is part of GNU Zebra.

||     config_current         |  5

||     config_default         |  6 GNU Zebra is free software; you can redistrib

||     retain_mode            |    ute it and/or modify it

||     master                 |  7 under the terms of the GNU General Public Lic

||     config_file            |    ense as published by the

||     pid_file               |  8 Free Software Foundation; either version 2, o

||     vty_port               |    r (at your option) any

||     vty_addr               |  9 later version.

|                             | 10

|-   function                 | 11 GNU Zebra is distributed in the hope that it

||     usage                  |    will be useful, but

||     sighup                 | 12 WITHOUT ANY WARRANTY; without even the implie

||     sigint                 |    d warranty of

||     sigusr1                | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR P

||     signal_set             |    URPOSE.  See the GNU

||     signal_init            | 14 General Public License for more details.

||     main                   | 15

__Tag_List__   3,1        顶端 bgpd/bgp_main.c                1,1           顶端

 

左面是函数列表,右边是源文件(这个时候就可以使用h,j,k,l来移动并加上回车就行了)

 

然后可以按下ctrl+w切换了

 

按下crtl+]可以查看函数的定义,按下ctrl+o可以调回原文件

 

就介绍这么多吧。。。

 

 

 

阅读(8692) | 评论(0) | 转发(2) |
0

上一篇:嵌入式工具链制作

下一篇:tar 命令

给主人留下些什么吧!~~