Using vim I can open multiple tabbed files using the -p switch:
$ vim -p file1 file2 file3
Using vim I can open a file at a particular line:
$ vim file1 +123
How can I open multiple files in tabs, each at their own distinct line?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
This will do it:
vim +123 file1 +"tabnew +20 file2"
As mentioned in the comments, you can continue adding files in using the same syntax:
vim +123 file1 +"tabnew +20 file2" +"tabnew +40 file3" +"tabnew +10 file4"
user74094 made the point that unfortunately this opens to the last tab rather than the first. This can be fixed with the addition of tabfirst as such:
vim +123 file1 +"tabnew +20 file2" +tabfirst
For anyone who doesn't understand, a + means vim executes a new command. So this is essentially saying, "open vim to line 123 on file1, then open a new tab with file2 to line 20, then switch to the first tab"
Original answer/research taken from here.