5.4 Inserting and Deleting Text

   

Text insertion takes place only when you are in insert mode. Text deletion tasks are performed in command mode. You already know how to switch between these two modes. Here we will introduce some more commands to switch to insert mode from command mode.

When you use the i command to go to insert mode, new text is entered where the cursor is at the time you press the character i . When you insert new text, the previous text on the right-hand side of the cursor moves toward the right. If you use the a command to go to insert mode, the new text entry takes place after the current position of the cursor. You can use the I command to start entering new text at the beginning of a line and the A command to start entering at the end of a line. If you want to enter text at the end of the file, you can combine the G and A commands for this purpose. See Table 5-2 for a list of text entry commands.

Table 5-2. Text Insertion Commands
Command Effect
i Start inserting text at the current cursor location.
I Start inserting text at the beginning of the current line.
a Start inserting text at the next character position relative to the current cursor location.
A Start inserting text at the end of the current line.
o Append a blank line just below the current line and start inserting text from the beginning of that line.
O Append a blank line just above the current line and start inserting text from the beginning of that line.

To delete text, press graphics/esc.gif to go to command mode and then use any of the commands described in Table 5-3.

Table 5-3. Text Deletion Commands
Command Effect
x Delete character at current cursor location.
n x Delete n characters starting at current cursor location.
X Delete previous character from the current cursor location.
n X Delete n previous characters from the current cursor location.
dd Delete current line.
db Delete previous word.
dw Delete from current cursor location to the end of word.
dG Delete to the end of file including current line.

   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net