Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I want to reach to a certain part of a word in Vim (horizontally) I simply press w, b, f or t (something). Is there a good way of doing this vertically? For instance, I want to get to a certain word or a letter of a line that is below or above the line I'm currently in.

PS: Without using :(line number)

share|improve this question

migrated from Jan 25 '10 at 1:25

This question came from our site for professional and enthusiast programmers.

10 Answers 10

up vote 21 down vote accepted

H, M and L will move your cursor to the top, middle and bottom of the screen, respectively. Subsequently, you can hit zz to center the screen on the line your cursor is on.

share|improve this answer
And zb and zt move screen on bottom and top respectively – Jani Hartikainen Jan 23 '10 at 19:44
Nice, didn't know that. – janoChen Jan 23 '10 at 20:34
  • you can use the up/down arrow to move one line
  • you can type a number and then use the up/down arrow to move up/down that many lines
  • small g jumps to the first line of the document
  • capital G jumps to the last line of the document
  • etc.

there are a gazillion of other different ways, vim is very flexible in this respect. I would recommend to get a vim cheat sheet first for basic commands, and then as you have time, go through the vim documentation on this subject.

Link to one cheat sheet: Cheat sheet


  • / + string + (Enter) searches for the next occurrence of string from the cursor forward to the end of the document
  • ? - does the same but from the cursor backwards towards the beginning of the document
share|improve this answer
  • { } will get you to the beginning / end of the next paragraph
  • ( ) the same for sentences
  • ^ $ the first, last character of line

Quick reference / cheat sheet here

share|improve this answer

I jump around by searching for unique strings where I want to go. In Vim, you can do this with:


I usually scroll forwards and backwards using n and N once I've entered a search.

I also scroll using Ctrl-F and Ctrl-B to page through code quickly. But I use the search trick most often. Sometimes you can get lost when going through search results with n and N. A good command for orienting yourself is Ctrl-G, which prints out something like this at the bottom of the Vim screen:

"" line 219 of 328 --66%-- col 19-23

share|improve this answer
+1 for <CTRL>-F and <CTRL>-B, although I tend to "cheat" and use <PgUp> and <PgDown> almost as often! – technomalogical Jan 25 '10 at 20:06

You can also make jumps to specific line in document by issuing Ngg where N is line number you want to jump.

share|improve this answer
you mean NG... – Peter Jan 23 '10 at 19:28
I use Ngg, too (both variants work) – soulmerge Jan 23 '10 at 19:42
As well as :N – viraptor Jan 23 '10 at 19:45

try: :he motion.txt and :he up-down-motions

It has the whole list of possible motions up down

share|improve this answer

as previously mentioned H,M,L(as in high, middle, low) lower case h j k l are the typical console game commands for left, down, up, right and work the same in vi (j,k work in gmail if you enable key commands)

share|improve this answer

You should give Lokaltog's easymotion plugin a try:

Easymotion plugin at work

share|improve this answer
easymotion is really good but I don't know why to make it work for the part above the cursor. It only highlights the one below the cursor. – nXqd Jun 12 '12 at 12:29

<Ctrl>+D - down

<Ctrl>+U - up

share|improve this answer
That's a half a page scroll. For full page scroll use <c-f> and <c-b> – Al.G. Feb 28 at 8:58

In addition to the regular vertical motions, I use a modified version of I usually move with the arrow keys, not hjkl (looong time user of other editors before I found Vim, too used to arrows/Home/end/PgUp/PgDn to switch, even after 5+ years of exclusive Vim use).

function! ScreenMovement(movement)
   if &wrap
      return "g" . a:movement
      return a:movement
map <expr> <C-Down> ScreenMovement("j")
map <expr> <C-Up> ScreenMovement("k")
map <expr> <C-Home> ScreenMovement("0")
map <expr> <C-End> ScreenMovement("$")

By holding Ctrl I can go visually to start/end of or up/down display rows. For me this is more efficient than the alternatives, at least.

Almost forgot: I needed to modify .Xdefaults for it to work in specifically urxvt, but that is probably an off-topic issue (with answers on Google).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .