HomeMiscellaneousVI editor

VI editor

Vi Quick Guide

Insert                     -> To add text
Esc                          -> To exit text & enter navigation mode
wq or Shift+ZZ    -> Write & Quit
:q                            -> Quit
:q!                           -> Quit without prompt to save changes
H                             -> Moves left one character
l                               -> Moves right one character
k                              -> Moves up one character
j                               -> Moves down one character
Ctrl+f                     -> Moves forward one page
Ctrl+b                    -> Moves back one page
Ctrl+d                    -> Moves down one half page
Ctrl+u                    -> Moves up one half page
O                             -> Go to start of line
$                             -> Go to end of line
w                            ->  Go to next word
b                             ->  Go to previous word
:n                           ->  Where “n” is the line number that you want to jump to (ie :10)
yy                          ->  Copy the number of line ie (10yy)
dd                         ->  Cut the number of line ie (10dd)
x                            ->  Delete one character
:r                           ->  Insert copied content from other file to current buffer or file
/                            ->  Search
p                            ->  Paste
0,15 s/the/xx     ->  Replace all the texh in file from line 0-15 with xxxx
:1,$ s/                 ->  Replace all text in a file. ie “ABC” to “abc” (1,$ s/ABC/abc)
s/                        ->  Replace word in a current line
u                         ->  Undo
dd                       -> Delete row
shift+O              -> Insert line above
Scroll to Top