vi editor Action Shortcut
1. command mode and edit mode switch
a: cursor back into edit mode a
i: cursor and the content does not change to enter the edit mode
o: a new line to enter the edit mode
s: delete character under the cursor into edit mode
2. The last line mode
: w // to save the edited document
: q // exit the vi editor
: wq // save and exit the editor
:! q // Force Quit ( without saving )
:! w // Force Save
:! wq // Forced to save and exit
: set number or nu // to the editor set the line number
: set nonumber or nonu // cancel the line number
: n ( number ) // cursor is positioned on the first n row
: / Content / or / content // content searching (n next N one )
Replaces ( CONT1 replaced CONT2 )
: s / cont1 / cont2 / // replace the first target cursor row of
: s / cont1 / cont2 / g // Replace all target line where the cursor is
:% s / cont1 / cont2 / g // replace all target the entire document
3. command mode operation
1) Move the cursor
① character level
A (k) under (j) left (h) the right (l) bond
② word level
w: word under the first letter of words
b: before the ( this ) word initials
e: end the ( present ) words last letter
③ row-level
$: Positioning the end of the line
0: Locate the beginning of the line
④ paragraph level ( scroll )
{: The ( present ) paragraph header
}: The ( present ) paragraph tail
⑤ screen level ( no scroll )
H: The current screen header
L: The current screen tail
⑥ document level
G: Document tail
1G: Document header
nG: The first document n rows
2) Remove content
dd delete current line cursor
n + dd erase backwards n row of content ( including the current row )
x delete character under the cursor
c + w deleted from the cursor position to the end of a word ( simultaneously become edit mode )
3) Copy the contents
yy Copy current line cursor
n + yy copy rearwardly n row of content ( including the current row )
p replication ( delete ) the contents of the paste operations
4) shortcuts
r + character quickly replace a single character
u undo undo
. Point, once the Repeat command
J capital J , merge two lines
Source: Liu Juntao's blog welcome attention to public numbers, messages, comments, study together.
__________________________________________________________________________________
If any help to you, welcome donor support, your support is certainly the best I insisted (* ^ _ ^ *)