Yakov Lerner wrote:
My code contains multiple targets for the same tag, as explained
in the (*1).
Let's assume that 'tags' contains multiple lines for the same name.
I want to go to the *next" definition of tag 'foo', so that N presses of
some key X gets me to the 1st definition of the tag, then to the second,
etc. How do I do it in vim ?
Yakov
(*1) My code has multiple definitions of certain functions. I want to
teach ctags to keep *all* definitions in ctags.
#if X
int foo() { ... }
#endif
.....
#if !X
int foo() { ... }
#endif
In other cases, multiple target for the tag can be (1) prototype
of foo() in .h (2) definition of foo() in .c file
:map <F4> :tn<CR>
:map <S-F4> :tN<CR>
and if needed
:imap <F4> <C-O>:tn<CR>
:imap <S-F4> <C-O>:tN<CR>
see
:help :tnext
:help :tNext
:help i_CTRL-O
Note: If the current file is modified, what happens may depend of
whether the :t[nN] command has a bang (|abandon| the file) and whether
'autowrite' / 'autowriteall' are set (write the file). See ":help
tag-!". (I set 'autowriteall' in my vimrc but YMMV.)
HTH,
Tony.