Vim Basic Movements

Learn the basics of Vim an awesome text-editor

Rodrigo Queiroz
in Vim
21 Nov 2013
  • 3 min read
  • 30
  • 50
  • 200

Vim is an open source text editor mainly used by Unix based operating systems, however Vim is cross-platform, meaning it can be used on Unix, Linux, Mac OS X, Windows, iOS, Android.

Vim was design to be used on command line interface and as a standalone application in a graphical user interface.

Vim can be very annoying at the beginning because of its commands and configuration, but once you learn how powerful this text editor is, you will definitely see how fast your production can be. 

In this tutorial you will learn the basics of Vim movements and from here move on to a more advanced level. Once you get the grasps of Vim, I can guarantee that it will pay off all the effort that you have put into it.

Basic movement

Moving through text

Moving through the text is usually possible with the arrow keys, but not recommended if you really want to learn vim.

h move left.

l move right.

k move up.

j move down.

Move to the beginning or end of the line

Useful and fast way to move to the beginning and end of a line.

0 move to the beginning of the line.

$ move to the end of the line.

Forward and backward word movements

Great for moving around a line jumping words.

w move forward to the beginning of the next word.

W the same as w except it moves to the next non-blank character (meaning jumps to the next word after the space character).

e move to the end of the word.

E the same as e except it moves to the next non-blank character.

Move to the specified characters on the line

The powerful and amazing keys f, F, t, T and ; that let you move to specific characters within a line.

f followed by another key, move the cursor to the next instance of that characters on the current line.

F does the same backward.

t and T do the same, but they stop right before the character.

; repeat latest f, t, F or T

Paging

Very useful keys for moving the page up and down by full pages.

CTRL + f move page down.

CTRL + b move page up.

Jumping to screen parts

These keys will allow you to move to the head, middle and last line of a screen.

H move to the head.

M mode to the middle.

L move to the last line.

Top and bottom

Jumping to the top and bottom of the entire buffer.

gg move to the top.

G move to the bottom.

Jumping to a particular line

How to get to a specific line number.

Num + G