Some vi Tips

A few tricks using vi for increased? productivity:

Global Search and Replace

:% s#changefrom#changeto#g

Delete from the cursor to the end of the line:

D

Replace from here to the end of line:

C

Delete All Remaining Lines in a File, (from here to the end of the file delete)

:.,$d

Return to the Command-Line Temporarily (in case you forgot to backup the file?)

!ls
!cp myfile mybackupfile

Change Word

cw

Repeat the Last Action

.

Post comment