VI refers to "Visual Editor". VIM is an improved version of VI Editor. The VI editor is the standard editor under Linux system.
Opening the file:
You can use the command written below to open or edit an existing file. If the file doesn't exist, VI creates it when the edits are saved for the first time
vi <filename>
Three modes of VI and VIM
Here are the results from this week's race:
S. No | Modes | Description |
1 | Command Mode | A Default Mode |
2 | Insert Mode | Type in new text |
3 | Ex Mode | Enter extended commands |
Cursor Movement in Command Mode
S. No | Movements |
1 | h left |
2 | j down |
3 | k up |
4 . | l right |
5 . | w word ahead |
6 . | b word back |
Entering into Insert Mode
Command | Movements |
a | append after the cursor |
i | insert. before the cursor |
o | open a line below |
A . | append to end of the line |
I . | insert at beginning of line |
O . | open a line above |
Leaving Insert Mode:
Command | Movements |
Esc | Takes you from insert mode back to command mode |
Change, Delete and Yank
| Change | Delete | Yank(Copy) |
Line | cc | dd | yy |
Letter | c1 | d1 | y1 |
Word | cw | dw | yw |
Sentence ahead | c) | d) | y) |
Sentence behind | c( | d( | y( |
Paragraph above | c{ | d{ | y{ |
Paragraph below | c} | d} | y} |