2

Quick ctags question. Google did not reveal the answer. Ctags is awesome to browse a complete source file. But what about a file that is currently being worked on. Is there a way to dynamically update the ctags file each time a new function/variable is added?

2 Answers 2

4

You can write an autocmd that is triggered after x seconds of inactivity or after each <Esc>:

autocmd CursorHold *.js :!ctags -R .

But it is a bit messy.

See :help autocmd for more information and a list of possible events.

Also see the EasyTags plugin (that I use), or AutoTag, or Indexer which are a lot cleaner and smarter.

1
  • At last, someone who isn't me suggested Indexer for the ctags management! =) thanks, and I just like to add some info: Indexer does aware about projects, but AutoTag does not. This means that you can work on several projects simultaneously, which could have the same symbols, and Indexer will handle it correctly (i.e. tags will not be mixed up). And, the second thing: tags are generated in background, so you can work on really large projects, and you have not to wait while ctags does generate your tags. Tested on Windows, Linux, MacOS. Oct 8, 2012 at 11:35
0

Also see the TagList plugin - the top-rated and most-downloaded plugin ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.