Home > Unix > UNIX – Lesson 011 – vi editor – Input Mode, Delete Text

UNIX – Lesson 011 – vi editor – Input Mode, Delete Text


Input Mode: i, a, o

  • a append new text after the cursor
  • i insert new text before the cursor
  • O open a line for text above the current line
  • o open a line for text below the current line
  • A append new text at end of the line
  • I insert new text at beginning of the line

Pressing ESC key concludes the input session (switch to command mode)

================================================================================

Delete Text: x, X, dw, dd, dG

  • x delete the character at the cursor
  • [n]x delete [n] characters
  • X delete previous character (like backspace)
  • [n]X delete [n] characters previous character (like backspace)
  • dw delete the current word (starting from cursor pos.)
  • [n]dw delete [n] words
  • dd delete the current line
  • [n]dd delete [n] lines
  • d^ delete to the beginning of the line
  • d$ delete to the end of the line
  • dG delete through the last line of the file

The u (undo) command will come to your rescue:

  • u undo the last modification
  • U undo all modifications to current line 
Categories: Unix
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: