Vi Most Useful Shortcuts

vim_logoNo matter what flavor of Linux/Unix chances are that at some point you’ll find yourself at the terminal trying to fix something. In that instance, you realize that you spent all your time working from some fancy editor. But Vi is always present in Linux/Unix, it doesn’t matter the distribution or how minimalist the Operating System is. That being said, it pays to learn the basic of Vi, at least how to open a document, edit a document, and save it. Just in case you don’t have your preferred terminal or gui editor. However, in linux a full fledge editor is not always necessary: take a look here. So here are some basic Vi commands to get you started.

Vi Most Used Commands

Cursor Navigation
Fast Search
Command Mode
From Normal to Edit Mode

J -> Next line
K -> Previous line
H -> Left
L -> Right
Shift+G -> Bottom of document
GG -> Top of document

Fast Search
/ -> Search Term
N -> Next
N -> Previous

Command Mode

: -> enter command mode
: -> w write
: -> q quit
:q! -> quit without saving
:wq -> Write and quit
ZZ -> Write and quit
:e -> open
Esc -> escape command mode

From Normal to Edit Mode

I -> Insert at current position
I -> Insert at start of line
A -> Append to end of line
O -> Insert Line Below
O -> Insert Line Above
S -> Delete character at current position and insert
S -> Delete the current line and insert


dw -> delete word
dd -> delete line
P -> put after cursor
P -> put before cursor
yw -> copy word
yy -> copy line

Share This!

Leave a Reply

Your email address will not be published.