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.
Downsides:
- 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
where the 3 is however many items you put on the jump list and ^O is a literal control+o (typed like ctrl+vcrtl+o).
Downsides:
- 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)
vim +7 file_nameorvim -c7 file_name, it will openfile_nameand position the cursor on line 7. If you typevim +'/pattern' file_nameorvim -c '/pattern' file_nameit will openfile_nameand position the cursor on the first line wherepatternis found. From there if you hitn, you will reach the other matches. However, I did not understand your second question concerning the tab sequence and Tab key, sorry. – saginaw Jan 25 '16 at 16:44myedits.vim, where each line is an Ex command, and then from the shell typevim +'so myedits.vim' file_name. If it's what you want, you could be interested in this: http://vi.stackexchange.com/a/5990/4939 Otherwise, could you provide more info on your end goal? – saginaw Jan 25 '16 at 17:05vim +':12ma a | 19ma b | 7' file_name, it will open your file on line 7. Then to go on line 12 hit'a, and to go on line 19 hit'b. – saginaw Jan 25 '16 at 17:12#you could define the following mapping:nnoremap <silent> <Tab> /^#/+1<CR>Hitting<Tab>should move your cursor below the next header. You can also make the mapping local to the buffer by adding the argument<buffer>if you want<Tab>to have different behaviors depending on the filetype. – saginaw Jan 25 '16 at 17:26:nnoremap) when it opens a file:vim +'so mappings.vim' file_name– saginaw Jan 25 '16 at 17:48]z? Or by putting the sections into the quickfix list or the location list withvimgrepand mapping tab to:cnor:ln– Steve Jan 25 '16 at 18:07vim "+call cursor(8, 16)" myfile.txtto jump to line 8, column 16. (I use this when launching Vim from other editors/debuggers.) – dash-tom-bang Mar 01 '16 at 04:44