Reputation: 903
Vim default behavior for jumplist is as the following
The following commands are "jump" commands: "'", "`", "G", "/", "?", "n", "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and the commands that start editing a new file.
However, i have the feeling that so many jump
command make the jumplist
contain more than what I have. For example, I am using cscope
to jump to from function invocation to function implementation, then in the implementation, I may use %
to navigate to matching braces, or /
to search for certain contents. However, I want the jumplist only keeps the cscope
jump history so I can easily come back to the invocation point.
Is there some way to exclude certain motion from the jumplist
?
Upvotes: 3
Views: 459
Reputation: 45117
In theory you want to use the tagstack instead of the jumplist as @Ingo Karkat, suggested. However, I think it would be simpler to just use [[
or [m
to back to the function definition assuming you didn't leave the function. If you know you are going to come back to it then I would recommend opening a new window (e.g. :split
or <c-w>s
) or setting a (file-)mark (e.g. mm
or mM
).
Upvotes: 0
Reputation: 172590
If you were using the regular ctags
instead of cscope
, this would be built-in via the :help tagstack
; the equivalent to <C-O>
in the jumplist is <C-T>
in the tagstack.
:help cscope-intro
offers the following:
cscope query results become just like regular tags, so you can jump to them just like you do with normal tags (Ctrl-] or :tag) and then go back by popping off the tagstack with Ctrl-T. (Please note however, that you don't actually jump to a cscope tag simply by doing Ctrl-] or :tag without remapping these commands or setting an option.
Which I think means that, if you use the cscope interface correctly, <C-T>
should work just fine, but in order to make tag looksups more convenient, you need to build your own shortcuts to the cscope interface.
Upvotes: 2