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!

3 comments:

Anonymous said...

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

vim +/PATTERN file

Anonymous said...

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

42gg

to jump to line 42. Alternatively using ex mode:

:42

Relative jumps:

42%

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

how to ollie said...

I like your writing style. Nice blog.