vim tips, goto line

February 10th, 2007 mysurface Posted in Misc, Text Manipulation, vi, vim | Hits: 41912 | 4 Comments »

If you have search for vim tips at here, you may remember to go to the desire line while opening file with vim is like this

vim hello.c +12

And while edit with vim, to move to desire line, type the line number and press shift g or G. With the search forward and backward tips examples shows here.

Yesterday, I accidentally discover that to move to a desire line while edit with vim, can be done by this


As I press escape and colon more often than pressing shift g, goto a line with :<line number&mt; is more comfortable for me.

4 Responses to “vim tips, goto line”

  1. 12gg works well too.

  2. Yes it works, good tip

  3. 12% works for relative goto percentage (start typing 12 and press % and will be automatically positioned at 12%)

    useful for large logs

  4. You need to be a part of a contest for one of the most useful websites on the internet.
    I’m going to highly recommend this blog!

Leave a Reply