Change, delete, copy, paste in vi editor

Actions Change Delete Copy
Line cc dd yy
Letter cl (r) dl (x) yy
word cw dw yw
Sentence ahead c) d) y)
Sentence behind c( d( y(
Paragraph below c} d} y}
Paragraph above c{ d{ y{

N.B. To change a single line we use ‘cc’ but to change multiple line we will use ‘ncc’ where n is the no of line u want to change.Same in case of delete and copy.

Delete from current line to the end of file
Delete all the lines to a file-
Move a word ahead
press w

dL Delete up to last line on screen
dG Delete to end of file
J Join two lines

rx Replace character with x
Rtext Replace text beginning at cursor
Ctrl-G Display line number of cursor
s Substitute character
nG Move cursor to line number
U Restore current line
x Delete current cursor position
X Delete back one character
nX Delete previous n characters
. Repeat last change
~ Reverse case
ye Copy to end of
dn,m Delete line starting from n to m
d8G Delete all lines from cursor to line 8

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: