Adding and Deleting Text in vi

Adding and deleting text in vi is a bit more complicated than doing the same in pico. Whereas in pico, you basically just place your cursor where you want to make changes, vi has a whole slew of commands that you use to specify where the changes should occur. (Tables 4.1, 4.2, and 4.3 list only a very few of your options.) Plus, to issue the commands, you have to switch to command mode.

Table 4.1. vi Commands to Add Text
COMMANDFUNCTION
aAdds text after the cursor
AAdds text at the end of the current line
iInserts text before the cursor
IInserts text at the beginning of the current line
oInserts a blank line after the current line
OInserts a blank line before the current line
Table 4.2. vi Commands to Delete Text
COMMAND ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.