vim simple operation

vi / vim usage

Substantially vi / vim divided into three modes, namely, command mode (MODE the Command) , the input mode (Insert mode) , and the bottom line command mode (MODE Last Line) .

 

In the command mode by pressing i entered the input mode. Press :( colon) in the command mode to enter the bottom line command mode. The bottom line in command mode, press the ESC key at any time to exit the bottom line command mode. In the input mode, press the ESC key at any time to exit the input mode.

 

G is moved to the last line of the file (common)

gg move to the first line of the file, equivalent to 1G ah! (Common)

n <Enter> n is a number. Move the cursor down n row (common)

:% S / word1 / word2 / g Looking word1 string from the first row to the last row, and the string is substituted word2! (Common)

cursor dd delete whole line (common)

yy Copy the line that the cursor (common)

nyy n is a number. Copy cursor down n rows, for example rows 20 20yy is copy (common)

U before a recovery action. (Common)

 p p is the copied data in the next line labeled cursor, P was attached to the cursor line! For example, my current cursor line 20, line 10, and has been copied data. After pressing the p, it will be affixed to the data line 10 after the original row 20, i.e., 21 lines starting from the paste.

 

Guess you like

Origin www.cnblogs.com/jiangchaotnb/p/11571882.html