andrei bio photo

andrei

Linux engineer, devops enthusiast

Email Github

VI Tips

CommandDescription
/Search.n for next, N for previous
?Search backwards
:%s/OLD/NEW/gReplace all OLD with NEW
dggRemoves all lines
:set icset case insesitive for search
:set ft=rubyset syntax highlight for ruby
eGo to end of the word
bGo to the beginning of the word
0Beginning of the line
$End of the line
SHIFT + HHigh - go to first line
SHIFT + MMiddle - go to the middle of the file
SHIFT + LLow - go to the end of the file
ONew line below and start editing
SHIFT + ONew line above and start editing
SHIFT + CRemove the line and start editing from the beginning
dwDelete word
2dwDelete 2 words
VVisual mode. e and b select text. c change word, y copy, p paste
UUndo
CTRL+RRedo
:set pasteSet mode for pasting
SHIFT + DDelete from cursor to end of line
:1,10dDelete from line 1 to 10
:1,$dDelete all lines
:%dDelete all lines

.vimrc

CommandDescription
:set tabstop=4One tab=4 spaces
:set expandtabInsert space even if pressed tab
:syntax onSyntax highlight
:set nowrapDo not wrap lines