May 19, 2012, 6:12 am GMT  

Postings

‘vi’ quick command references

I’m a die hard vi user and still prefer using vi to edit plaintext files. There were some discussion on twitter on vi awhile back and I thought I’d share my own command cheat sheet for vi in edit mode. This is not quite a full tutorial but makes for a useful reference.

Editing Text…

i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open a new line after current line
O Open a new line before current line
r Replace one character
R Replace many characters
x Delete character to the right of cursor
X Delete character to the left of cursor
D Delete to the end of the line
dd Delete current line
:d Delete current line
yy Yank the current line
p Put after the position or after the line
J Join lines
u Undo last change

Moving the cursor around…

h Move left
j Move down
k Move up
l Move right
w Move to next word
W Move to next blank delimited word
b Move to the beginning of the word
B Move to the beginning of blank delimted word
e Move to the end of the word
E Move to the end of Blank delimited word
0 Move to the begining of the line
$ Move to the end of the line

Exiting ‘vi’…

:wq Exit, saving changes
:q Exit as long as there have been no changes
ZZ Exit and save changes if any have been made
:q! Exit and ignore any changes

Filed under: cli-fu — appgirl @ 5:21 pm
Comments (0)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

My Tweets

Fans

AppGirl on Facebook

See What I'm Uncorking

Powered by WordPress