vi editor Action Shortcut

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 (* ^ _ ^ *)

Guess you like

Origin www.cnblogs.com/lovebing/p/12033552.html