When I make a change to a file, for example, add a function, how can I make the taglist automatically update the "tag list" in its windows after I save the change?
+4
A:
I adapted my setup from the C++ code completion vim tip.
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
When needed, I press Ctrl-F12 to regenerate tags.
If you're using vim-taglist, you could add to your .vimrc
an autocommand for the BufWritePost event to update the taglist window after every save:
autocmd BufWritePost *.cpp :TlistUpdate
Greg Bacon
2010-01-07 10:58:19
Minor correction. The key-combination will be `Ctrl-F12` and not `F12` as mentioned by you.
Gautam Borad
2010-01-07 11:26:24
Thanks! Fixed and added more info.
Greg Bacon
2010-01-07 11:37:20
+1
A:
Haven't tested, but you could try something like:
au BufWritePre *.cpp ks|!ctags %
Which basically executes ctags when the buffer for a file ending in .cpp
gets saved(:w
).
Arkaitz Jimenez
2010-01-07 11:03:30
A:
I did write a little experimental script that automatically and incrementally updates, the "current" tags file on file saving.
(The question is actually redundant with http://stackoverflow.com/questions/155449/vim-auto-generate-ctags )
Luc Hermitte
2010-01-07 15:01:36