Basic Motions
In Vim, you rarely use the arrow keys. Instead, you use keys that are right under your fingertips on the home row.
1. Character Navigation: h j k l
This is the first hurdle for every Vim beginner. It feels weird at first, but it makes sense because you don’t have to move your hand to the arrow cluster.
h: Leftj: Down (Think “J” looks like a hook pointing down)k: Up (Think “K” is a king standing tall / upwards)l: Right
[!TIP] Pro Tip: Disable your arrow keys. It’s the only way to learn. Force yourself to use
hjkl.
2. Word Navigation
Moving character by character is slow. Vim lets you move by words.
w: Move to the start of the next word.b: Move to the start of the back (previous) word.e: Move to the end of the current word.
These are much faster than holding down an arrow key.
3. Line Navigation
Jump to the extremes of a line.
0(Zero): Jump to the start of the line (column 0).^(Caret): Jump to the first non-blank character of the line (useful for indented code).$(Dollar): Jump to the end of the line.
4. Interactive: Vim Navigator
Practice your motions. Move the blue cursor to the Red Target using h, j, k, l, w, b, e.
Target: Reach the red character.
5. Motion Heatmap
6. Summary
hjkl: The core navigation keys. Use them until they become second nature.w/b: Move faster by jumping words.0/$: Jump to start/end of line.