Monday, January 25, 2010

Cut, copy, and paste block in vi

cut: dd or 4dd, then paste with p or P
copy: yy or 4yy, then past with p

if you know the start line number and end line number (Ctrl+g):
:10,25y
then p to paste. (this is copy-paste, replace y with d to cut-paste)

or set marks in both start and end lines with ma, mb
:'a,'by
then p to paste

No comments:

Post a Comment