Vim logo vim online Vim Book Ad

basic Tip #336: type the line number and press enter to get there

 tip karma   Rating -2/21, Viewed by 1089 

created:   October 3, 2002 2:06      complexity:   basic
author:   Odyss...      as of Vim:   5.7

an easy way to  to get to a line (whose number we know)  faster  is to combine some existing ways that are;
:132<ENTER>
or
123G
or
123gg

and the solution is to map in normal mode the enter to G

so with
:nmap <ENTER> G
we can type the line number and then press enter to get there...

it's very small gain ... but it is!!!

 rate this tip  Life Changing Helpful Unfulfilling 

<<Copy C++ function declaration into implementation file | editing remote files via scp in vim >>

Additional Notes

[email protected], October 3, 2002 7:42
A corollary:

Though
:132[Enter]
takes you to line 132 in the file,
132[Enter] takes you 132 lines down from your present position.

It's a subtle difference that can make a big difference.
Anonymous, October 14, 2002 10:48
if u want to go 123 lines down u can use either
123 <DOWN>
either
123j

so wy have three times the same thing???
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo