Reputation: 11317
In edit mode, how do I specify vim to go to a specific line(say 67)? The following command treats line number as file name.
:e /tmp/foo 67
I know how to do this when starting vim, but that's incovenient when you're already inside an editing session with other files.
vim /tmp/foo +67
Upvotes: 4
Views: 1188
Reputation: 196516
While perfectly correct and canonical (see :help +cmd
), OP's solution of putting the line number before the file name never felt right to me because it doesn't map with how I think: directory > file > line.
Therefore, I prefer to do:
:e /tmp/foo|67
which lets me deal with the file first, then with the line, which is much more intuitive to me.
Note that both :e +67 /tmp/foo
and :e /tmp/foo|67
do exactly the same thing under the hood:
:e /tmp/foo
:67
Upvotes: 8
Reputation: 11317
Thanks to @larsks and @romainl for the answers!
:e +67 /tmp/foo
OR
:e /tmp/foo|67
Upvotes: 4