Tuesday, December 1, 2009

Starting on a Specific Line

An anonymous reader writes:

You can open a file on the command line and automatically put the cursor on the last line by typing:

vim + file

If you want vim to start at a specific line you can do the following instead:

vim +LINENUMBER file

Thanks for the tip!


Anonymous said...

similarly you can jump to a search pattern by the following way:

vim +/PATTERN file

Matthias Vallentin said...

Similarly, when the Vim process is already launched, there are many ways to jump to a particular line:


to jump to line 42. Alternatively using ex mode:


Relative jumps:


where 0% is the beginning of the file and 100% the end.

how to ollie said...

I like your writing style. Nice blog.