vim :: tags keyboard shortcuts
Keyboard shortcuts used to work with tags. There are really few of them. All of them work in control/normal mode.
:set tags?needless to remind that VIM must be told which tag files to use. It can be done automatically as for example shown here.:tag wordis main one. Opens file and goes to line with first tag entry matching word.- ^] same as above, but uses word under cursor.
:tag /wordis similar to:tag word. Opens file and goes to line with first tag entry matching regular expression in word.:tselect wordis what I use most often. The function - tag select - displays list of matching tags allowing you to select one to go to. Without word, it will display list of matching tags for word used last time.g^]same as above, but uses word under cursor. Also, omits displaying list if only single match is found.:tnextgoes to next matching tag entry.:tprevgoes to previous matching tag entry.:tlastgoes to last matching tag entry.:tfirstgoes to first matching tag entry.^TEvery time you do:tag word, the word with current file position is put on stack and vim goes to new file/position as it is told by tag file. To restore the previous file position you use^T. The shortcut removes tag stack top element and moves to the file position saved there. So if you wandered off far away with^]- to return back where you started you need to press^Tuntil vim would complain that it is at bottom of tag stack.
:tag word and :tselect word support wildcard key (Tab/^D) to show list of tags matching partially the word. That will work with regilar expressions too. But be warned that often tag files can host millions of entries: displaying list of thousands items can take some time. Use wildcard key carefully.