Tell Vim to look for
- in the directory of the current file,
- in the working directory,
- and in every parent directory, recursively,
tags files are found:
Tell Vim to look for a specific
tags file (standard library, reference implementation, etc.) in addition to the standard ones define above:
" after/ftplugin/foo.vim setlocal tags+=/path/to/somewhere/tags
Jump to the tag under the cursor if there's only one, or list possible targets:
Preview the tag under the cursor if there's only one, or list possible targets:
Jump to the given tag if there's only one, or list possible targets:
Preview the given tag if there's only one, or list possible targets:
Force regex search if you don't want to type the whole name or don't know the exact capitalization:
Climb up the "tag stack":
And that's about it. See
:help tags for more information and write your own mappings if you don't like the default bindings.
Use a super basic timer:
$ while sleep 3; do ctags -R .; done
Or a nicer one:
$ watch -n 3 ctags -R .
Use a file watcher:
$ ag -l | entr ctags -R . $ ag -l --js path/to/dir | entr ctags -R . $ ls dist/js/bundle.*.js | entr ctags -R .
Use Vim, manually
:!ctags -R .
Use Vim, automatically:
augroup ctags autocmd! autocmd BufWritePost <pattern> call if executable('ctags') | system('killall ctags && ctags -R . &') | endif augroup END
Yes, it runs
ctags in the background. Yes it's non-blocking. No, it doesn't use the new "async" features. Yes, this has been possible for a very long time. No, one didn't need to be a Vim wizard to come up with that. No, I don't think that's a good idea but it can obviously be done with minimum effort so, there.