Motions are half of every Vim command; fast movement is where Vim speed starts.
In Normal mode you move with motions instead of arrow keys (arrows still work).
hjklmove left, down, up, right.wjumps to the start of the next word,bback to the start of the previous word,eto the end of the word.W,B,Edo the same for WORDs, which are separated only by whitespace (sofoo.bar(x)is one WORD but several words).0goes to column 0,^to the first non-blank character,$to the end of the line.gggoes to the first line,Gto the last line,42G(or:42) to line 42.Ctrl-dandCtrl-uscroll half a page down and up.{and}jump to the previous or next blank line, i.e. by paragraph.
Almost every motion takes a count: 5j moves down five lines, 3w moves three words forward. Turning on :set relativenumber shows line distances so counts are easy to read off.
These motions are not only for moving. In the next lessons you combine them with operators: dw deletes a word, c$ changes to the end of the line, y} copies a paragraph. Learn the motions well and every operator becomes more useful.
Example
w " next word start b " previous word start
e " end of word W " next WORD (whitespace-separated)
0 " start of line ^ " first non-blank character
$ " end of line gg " first line of file
G " last line 42G " line 42 (same as :42)
5j " down 5 lines 3w " forward 3 words
} " next blank line Ctrl-d " half page downRemember
- Counts multiply motions: 5j, 3w, 2}
- w/b/e move by words, W/B/E by whitespace-separated WORDs
- 0, ^ and $ for line positions; gg and G for file start and end
Watch out for
- Holding j or l to crawl across the screen; use counts, words and searches instead.