CLI Usage
7750 SR OS Basic System Configuration Guide Page 39
Using the vi Commands
Use the following commands to start and end vi edit sessions, move around in a file, enter new
text, modify, move, and delete old text, as well as read from and write to files other files. Although
there are numerous
vi commands, only a few are usually sufficient to vi users. The following
tables list
vi commands.
• Cutting and Pasting/Deleting Text in vi on page 39
• Inserting New Text on page 40
• Moving the Cursor Within the File on page 40
• Moving the Cursor Around the Screen on page 42
• Replacing Text on page 42
• Searching for Text or Characters on page 43
• Manipulating Character/Line Formatting on page 44
• Saving and Quitting on page 44
• Miscellaneous on page 44
Table 8: Cutting and Pasting/Deleting Text in vi
vi Command Description
" Specify a buffer to be used any of the commands using buffers. Follow the "
character with a letter or a number, which corresponds to a buffer.
d Deletes text. “
dd” deletes the current line. A count deletes that many lines.
Whatever is deleted is placed into the buffer specified with the
" command. If
no buffer is specified, then the general buffer is used.
D Delete to the end of the line from the current cursor position.
p Paste the specified buffer after the current cursor position or line. If no buffer
is specified (with the
" command.) then 'p' uses the general buffer.
P Paste the specified buffer before the current cursor position or line. If no buffer
is specified (with the
" command.) then P uses the general buffer.
x Delete character under the cursor. A count tells how many characters to delete.
The characters will be deleted after the cursor.
X Delete the character before the cursor.