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?
To open the selected file in a tab, use the 't' key. If the file is already present in a tab then the cursor is moved to that tab otherwise the file is opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist window is automatically opened in the newly created tab.
Using a Specific Tags File To use the tags file, you'll need to open Vim and tell it where it is. Still in the Vim source directory, I ran vim and then typed :set tags+=tags to tell it to use the ./tags file. At this point, Vim knows about the tags file — you don't need to tell it to load the file.
Ctags is a tool that generates a tag file of names found in source files. In Moodle, it can be used to index PHP functions, variables, classes and so on. These tags allow definitions to be quickly and easily located by a text editor such as vim.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With