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

.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>