vi Editing Commands

vi changes the content of the text file in response to keys that you press. Table 18-2 shows the most useful commands.

Table 18-2. vi Editing Commands
OperationCommandWhat It Does
InsertiInserts text before the cursor. (Insert mode)
 aInserts text after the cursor. (Insert mode)
 oInserts a line after the current line. (Insert mode)
 OInserts a line before the current line. (Insert mode)
 AAppends text at the end of the line. (Insert mode)
 IInserts text at the start of the current line. (Insert mode)
DeletexDeletes the character under the cursor.
 ddDeletes the current line. Saves line in a buffer.
 dwDeletes the next word.
 DDeletes from the cursor to the end of the line.
ReplacerxReplaces the current character with x.
 sReplaces one ...

Get Spring Into Linux® 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.