29 8 月 2012

vi – Insert Mode

introduction to vi insert mode

Insert Mode

Now we will understand the difference of various commands entering in Insert Mode.

Example:
< four space characters >This is an example explaining insertion < five space characters >

If we propose the cursor is located on “h”, the following table shows the usage of various commands to insert text from different cursor location under Insert Mode.

Command to enter in Insert Mode Cursor Behavior
i Insert text from cursor location (“h”)
I Move to first character of current line (“T”)
a Move to the character next to cursor (“i”)
A Move to end of line (after five space characters)
o Insert a new line after the current one
O Insert a new line before the current one
r Replace one character
R Replace all characters after cursor

After entering in Insert Mode, we can start to insert text and directly move cursor via up-down and left-right keys in Linux system. Under other Unix-like systems we however have to go back Command Mode to move cursor then enter in Insert Mode to insert text.