vi common shortcut keys

1. Copy text in vi

 

yy # put the contents of the current line into a temporary buffer
nyy # put the contents of n lines into a temporary buffer
p # put the text in the temporary buffer after the cursor
P # put the text in the temporary buffer before the cursor
"(az)nyy #Copy n lines into a nameable buffer named in parentheses, omitting n means the current line
"(az)ndd #Delete n lines and put them into a nameable buffer named in parentheses, omitting n means the current line
"(az)p # put the contents of the nameable buffer named parentheses after the current line
"(az)P # put the contents of the nameable buffer named parentheses before the current line

 2. Undo and repeat in vi

u # undo the last modification
U #Undo all changes to the current line
. #Repeat the last modification
, #Repeat the previous f, F, t or T find command in the opposite direction
; #Repeat the previous f, F, t or T find command
"np #Retrieve the last nth deletion (there is a certain number of deletions in the buffer, usually 9)
n #Repeat the previous / or ? find command
N # Repeat the previous / or ? command in the opposite direction


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326656325&siteId=291194637