Khang Nguyen

My vim journey - part 4


The first movements yov should already know if you’re using vim are the h , j , k , and l keys.

It’s key to first get comfortable with these before progressing to faster moves, but if you’re ready, do read on. I will be splitting this article into three parts:

Also, I will be using vimscript to describe the keys to press, so u simply press u but <C-u> means press Ctrl+u . <CR> means Enter .

Vertical Movements

Vertical movements get your cursor to the right general area. The first of its kind is to simply bring you to the ends of the buffer:

For half-page jumps, use <C-d> and <C-u>, with the length of one page being the number of lines visible in that vim window.

To jump an exact number of lines, type the number of lines first, then press j or k depending on the direction in which you wish to jump.

Horizontal Movements

These movements are within the line you’re on. The point of moving faster horizontally is to get to the exact character you want.

For more precise movements, make use of f and t. These searches for the key you press next.

F and T function similarly, but in reverse.

Precise Movements

To get to exactly where you want immediately, use / or ? and start typing your search query.

This is definitely the fastest way to move if you already know a word near where you want to go.