O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Automatically updating the tags

You probably don't want to have to manually run the ctags -R . command every time you make changes to the code. The simplest way to address this is to add the following to your .vimrc file:

" Regenerate tags when saving Python files.autocmd BufWritePost *.py silent! !ctags -R &

The preceding snippet runs ctags -R every time you save a Python file.

You can replace the preceding *.py extension with different file extensions depending on the language you'd like to work with. For example, the following will generate a tags file for C++ files: autocmd BufWritePost *.cpp *.h silent! !ctags -R & 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required