实现Vim tags自动更新
来源:互联网 发布:references 数据库 编辑:程序博客网 时间:2024/05/20 00:16
这里要用到两个插件:
projtags.vim : Set tags file for per project
AutoTag : Updates entries in a tags file automatically when saving
这两个插件单独工作都不能满足我的要求,但是他们合起来使用却是非常方便。
projtags.vim用于给项目配置tags文件,如配置项目路径为 /path-to-proj ,那么,当文件在 /path-to-proj及其子目录时,tags选项此时被局部地设置为了/path-to-proj/tags ,这样,即使是在子目录,tags选项的配置也能工作。
现在还有一个问题是tags自动更新的问题了。总不能每添加一个新文件就手动运行一下命令吧?而且,ctags的-a选项(append)并不会自动删除已经不存在的tag,此时,autotag.vim华丽登场~~,它能搞定这一切。
不过直接把这两个插件扔plugin目录是不会达到上述效果的,得稍做一些修改。
AutoTag.vim 作者的安装指导是要你直接在.vimrc里面source它。
这里我把它修改一下,然后放到~/.vim/plugin目录,给出补丁吧:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--- /home/admin/document/vim/plugins/autotag.vim 2012-01-06 16:50:37.912729822 +0800
+++ autotag.vim 2012-01-08 10:43:21.423301599 +0800
@@ -87,7 +87,7 @@
while file:
file = os.path.dirname(file)
#self.__diag('drive = "%s", file = "%s"' % (drive, file))
- tagsFile = os.path.join(drive, file, self.tags_file)
+ tagsFile = self.tags_file
#self.__diag('tagsFile "%s"' % tagsFile)
if os.path.isfile(tagsFile):
st = os.stat(tagsFile)
@@ -184,7 +184,7 @@
let g:autotagDisabled=0
endif
if !exists("g:autotagVerbosityLevel")
- let g:autotagVerbosityLevel=0
+ let g:autotagVerbosityLevel=2
endif
if !exists("g:autotagExcludeSuffixes")
let g:autotagExcludeSuffixes="tml.xml.text.txt"
projtags.vim的话,在
前面加上一句:
,然后把其内容直接加到.vimrc里面即可。因为这里要让projtags.vim优先运行以告知autotag.vim tags文件的位置。
还有要注意的一点是,在给projtags.vim配置项目路径时,要写绝对路径,不能写 $HOME或 ~ ,不然autotag.vim不能更新tags.
命令会列出你加载的插件列表,按加载顺序排列。不用总结哪个目录的插件先加载了,直接运行这条命令就好,一目了然。
====
file:///home/alan/Desktop/vim-tags-auto-update.html
- 实现Vim tags自动更新
- ubuntu下vim最大化和自动更新tags
- tags-vim
- Vim cscope ctags tags
- vim+tags+cscope+taglist
- vim+tags+cscope+taglist
- 配置vim中的tags
- vim+tags 安装使用
- vim 插件tags小记
- vim之tags
- vim: 自动更新ctags
- vim自动更新tag
- tags cscope 在vim中
- 使用Vim打造IDE--tags
- Tags功能的实现
- vim自动更新ctags与taglist
- Vim winmanager文件浏览自动更新
- Vim winmanager文件浏览自动更新
- Linux makefile 教程 非常详细,且易懂 .
- hbm2ddl.auto设置为update时不能工作排查方法!
- STL以及内存以及类的默认函数-题目
- js事件
- 浅谈 java 设计模式--工厂方法模式(Factory Method pattern)
- 实现Vim tags自动更新
- ALSA的配置文件
- 2012 BI发展趋势预测
- 在数组中存储对象
- MYSQL常用命令
- autoit3 ie.au3 函数之——ControlClick
- 用jquery解析JSON数据的方法
- wince设备识别为U盘
- ARM&LINUX学习笔记(6)------启动代码分析