Ordinarily, tab (a.k.a. ctrl+i) and ctrl+o traverse the jump list.
Vim supports adding entries to the jump list by setting the
' mark. As such, for your line numbers case, you could set up a jump list with the following:
vim +"12ma '|20ma '|56ma '" file_name
But, then Vim still starts on the file like normal, and at the end of the jumps list. As such, you can use ctrl+o to move back through the list (starting at line 56, then 20, then 12) and tab to go back forward through the list.
As such, it might make sense to construct your list in reverse, so that your first ctrl+o gets you to the first entry you want.
- Jump operations (described in
:help jump-motions) will move you to the end of the jumps list and add another entry, making it a bit interesting to then navigate to your saved entries.
- The backwards/forwards nature of this can be confusing
I tried doing stuff to start the session at the beginning of the set of jumps, with stuff like
vim +"12ma '|20ma '|56ma '|norm 3^O" file_name
but they don't work unless I prevent my vimrc from running. I think I must have a plugin or something trying to be "nice" by moving my cursor around (probably that common snippet that places your cursor where you left it last on BufReadPost), so the following actually works, so long as you don't jump before you want to use tab to get to the next line:
vim -u None +"12ma '|20ma '|56ma '|norm 3^O" file_name
3 is however many items you put on the jump list and
^O is a literal control+o (typed like ctrl+vcrtl+o).
- Harder to type (but if it is constructed by a program, probably not bad)
- Might not be able to use your default vimrc (though, again, if you are running via a program, this is probably an advantage)