Vim is an upgraded version of VI
There are 3 modes of operation:1 General mode 2 edit Mode 3 Command mode
A after the cursor insert I before the cursor insert o insert a new line under the cursor
A at the end of the cursor insert I at the beginning of the cursor insert o insert a new line on the cursor
$ cursor moves to the end of line 0 cursor moves to the beginning of the
GG cursor to first line g cursor to last line
X Delete the character at the cursor where DD deletes the clipping cursor in the row
yy/y copy Current line p cursor is pasted under line
R replaces a character R replaces the character that follows the cursor, ESC exits
U undo the previous action, up to 50 undo. Ctrl+r anti-undo, just correspond to u
and? You can find the keywords and use N and N to find the next.
When a keyword is searched, it is highlighted. Use: Nohl to cancel highlighting
: Set Nu Set line number: Set Nonu cancel line number
: Set IC operation ignored case: Set Noic off Ignore case
: 1,20s/old/new/g replaces 1-20 rows of old with the new G parameter for global substitution
One row has multiple old, replace all, or replace only one old
:%s/old/new/c full text replace C parameter for prompt user confirmation
:%s/\/etc\/passwd/1/escaped with \ for directory reasons
:%s #/etc/passwd#1 or split with #* etc.
: Wq=:x=zz Save Exit
: W/home/wyp file Save and save a copy in/home/wyp
: R/etc/wyp the contents of the/ETC/WYP into the current cursor
:! LS/ETC execute commands from Linux in Vim without having to exit vim
: R!date Inserts the system time under the current cursor
1.1-1.5-vim Editor