Skip to main content

Vim

vim is a very nice and beautiful text editor. I just have to learn a bit of its intricacies.

Screen Navigation

Key bindingsDescriptions
zzcenter this line
zttop this line
zbbottom this line
H M Lmove to top, middle, or bottom of the screen

File Navigation

Key bindingsDescriptions
:tabedit [file]edit file in a new tab
:tabfind [file]open file if exists in new tab
:tabcloseclose current tab
:tabslists all tabs
:tabfirstgo to first tab
:tablastgo to last tab
:tabngo to next tab
:tabpgo to previous

Searching

Key bindingsDescriptions
/{pattern}search
nnext matching search pattern
Nprevious match
*next exact word under cursor
#previous exact word under cursor

Modifying Text

Key bindingsDescriptions
aappend
Aappend from end of line
iinsert
oinsert to next line
Oinsert to previous line
sdelete char and insert
Sdelete line and insert
Cdelete until end of line and insert
rreplace one character
Renter replace mode
uundo changes
Ctrl + Rredo changes

Editing Text

Key bindingsDescriptions
xdelete character
ddcut
yycopy
ppaste
Ppaste before
" * ppaste from clipboard
" * ypaste to clipboard
:%/foo/bar/greplace foo with bar in whole document
>indent right
<indent left
=autoindent
g~ / guu / gUUswap case / uppercase / lowercase