Ivan Tomica

Vim Cheatsheet

Some of the shortcuts I find useful in Vim, but sometimes I fail to remember some of them :-)


gj and gk - move down and up by virtual lines
gg - beginning of the file
G - end of file
25G - 25th line
w - beginning of the next word
W - beginning of the next word, delimited by space
e - end of the word
b - beginning of the word
B - beginning of the word, delimited by space
% - matching parentheses
0 - beginning of the line (^ also works)
$ - end of line


o - insert below current line
O - insert above current line
A - append to the current line


- - next word under the cursor 
# - previous word under the cursor
/word - search for the word
   n/N - next/previous match

Search and replace

:s/word/newword/g - works similar to sed, valid for only the current line
:%s/word/newword/g - works on the whole file


:sp - horizontal split
:vsp - vertical split
^W + h|j|k|l - moving between windows
Sysadmin on the everlasting journey of learning. Always in search for an opportunity to prove myself and to learn something new. My addiction is learning and my main goal is to excel in every aspect of Linux/Unix system administration.


Leave a Reply

Your email address will not be published. Required fields are marked *