Just Enough... Vim

Tuesday, Mar 6, 2018

Note that any of these commands can be executed multiple times by simply appending a number in front. Also dot(.) will repeat the last change(anything you do in insert mode before coming back to normal mode).

Movement Commands

Jump up and down the lines

k j

Jump to beginning of file, end of file

gg G

Jump to top, bottom and middle of current screen


Bring current line to the middle of screen


Jump half page up/down

Ctrl-d Ctrl-u

Search forward/backward for partial/exact match

/<search> ?<search>

Jump to beginning/end of the line

^ $

Jump forwards/backwards by words and paragraphs

w b { }

Jump forwards/backwards to/till a specific character in a line and repeat the search

f<chr>; f<chr>,

Editing Commands

Insert before/after a character

i a

Insert at the beginning/end of a line


Insert before/after the current line

O o

Replace a character with a single/bunch of characters

r<chr> s<chrs>

Editing Text Objects

Replace a word/line/paragraph with new word/line/paragraph

ciw S cip

Delete a word/line/paragraph and repeat this change

daw dd dap

Yank a word/line/paragraph to the end of file

yaw yy yap followed by G p

Change from the current location to the end of line



u Ctrl-r

Remove line break from current line(join the next line with the current line)


Replace a word with a new one in the whole file with/without confirming each change

:%s/old/new/gc :%s/old/new/g

Change inside ( ' “

ci( ci’ ci”

Delete contents of ( ' “

di( di’ di”

Other Commands

Change case of a character


Delete a character


Set a mark and jump to it



Record a macro and run it

q<chr> <commands> q


Learning More