Vim的自动生成的ctags [英] Vim auto-generate ctags

查看:635
本文介绍了Vim的自动生成的ctags的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我已经中关注我的的.vimrc

Right now I have the following in my .vimrc:

au BufWritePost *.c,*.cpp,*.h !ctags -R

有与这几个问题:


  1. 这是缓慢的 - 再生标签自上次标记生成并没有改变文件

  2. 我要推输入按钮的再次的书面文件,因为一个必然的preSS输入或输入命令,继续之后。

  1. It's slow -- regenerates tags for files that haven't changed since the last tag generation.
  2. I have to push the enter button again after writing the file because of an inevitable "press Enter or type command to continue".

当你(在的ctags -R 已完成)结合这两个问题我最终推动更多的进入太早,后来看到恼人的错误信息,并有推再次输入。

When you combine these two issues I end up pushing the additional enter too soon (before ctags -R has finished), then see the annoying error message, and have to push enter again.

我知道这听起​​来并不像一个大问题,但随着文件数量写我在某一天它往往会得到真烦事。有一定有更好的方法来做到这一点!

I know it doesn't sound like a big deal, but with the amount of file writes I do on a given day it tends to get really annoying. There's gotta be a better way to do it!

推荐答案

金BufWritePost里的* .c,*。cpp的,*的.h无语! !的ctags -R&安培;

缺点是,你不会有一个有用的标签文件,直到它完成。只要你在* nix系统上它应该是确定要做previous的ctags之前多次写入已完成,但您应该测试。在Windows系统上它不会把它的背景,它会抱怨说,该文件被锁定,直到第一个ctags的完成(这不应该使vim的问题,但是你会得到一个稍微过时的标签文件结束)。

The downside is that you won't have a useful tags file until it completes. As long as you're on a *nix system it should be ok to do multiple writes before the previous ctags has completed, but you should test that. On a Windows system it won't put it in the background and it'll complain that the file is locked until the first ctags finishes (which shouldn't cause problems in vim, but you'll end up with a slightly outdated tags file).

请注意,您可以使用 - 追加选项,tonylo建议,但随后你必须禁用 tagbsearch 这可能意味着,标签搜索需要很长时间,这取决于你的标签文件的大小。

Note, you could use the --append option as tonylo suggests, but then you'll have to disable tagbsearch which could mean that tag searches take a lot longer, depending on the size of your tag file.

这篇关于Vim的自动生成的ctags的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆