vi editor

Using pure vi commands:

Copy to a named buffers, e.g. r two lines of text "r2yy
Insert the contents of buffer r into current cursos position.

Search a text forward /[text_to_search] and backward ?[text_to_search].
Repeat the search forward press n, and backward N

Search and replace, i.e. substitue general command:

:%s/the/The/g &#09 Replace the with The. % means the complete file.
:%s/the/The/gc &#09 Replace the with The but ask before substituting.

Repeats the last action press .(dot) key in edit mode

Execute a command from within vi do :![your command].
For instance, change file permission to allow you to write without close it :!chmod +w %. The % will be replaced by the file name.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s