vi commonly used summary

   Use VI editor

   (1) Common

  : Set nu vi text can be displayed inside the line number

    Ctrl + s or lock screen

    Ctrl + q can unlock the screen

   :! W represents the writing force

   :! Q for quit

   The cursor (2) into the mode of the mobile

   Up and down keys; tail first, $ O movement to move the line when the current line.

   nw represents N digital right, w denotes a right character, nb represents the left one character, b move left, shift + a represents a character is inserted in the end of this line, shift + i represents the current row is inserted in a head character. Shift + o represents the case above or below the current line of a character is inserted.

 

  (3) Delete the text: the first character x cursor, nx represents a plurality of characters, a word dw position of the cursor, ndw represent delete multiple word under the cursor,

    dd delete the current line ndd delete multiple lines to do the first character d $ to the end of the line all characters

 (4) find and replace text:

 N look down end of the file, n up to find the file header

 Find:? <String> + enter to locate the character / string search string

 : S / oldstr / newstr replaced once the current row

 : S / oldstr / newstr / g to replace all of the current row

 : 1,10s / oldstr / newstr / g 1-10 replace all rows

 : 1, $ s / oldstr / newstr / g 1- end of the line to replace all

 

Copy and paste (5) of the text

yw cursor location and character of the trailing characters copied into the buffer

nyw ---

yb start cursor one character to the left copy

nyb -

yO, y $ yy Copy current line

Cursor position P in front of the rear position of the cursor is pasted p

np repeatedly expressed

 

(6) vim editor summarizes: w write, q quit! Forced to save the file

    Cursor: a keypad, the right w, b n indicates the number of preceding characters o head, tail $

    Delete: x delete one, dd means to delete rows

    Find and Replace:? / Followed by the character to find N, n with flip up and down

    : S / old / new / g to replace the current line,: 1,10s / old / new lines 1-10 represent replacement.

    Copy: p y represents a copy and paste binding n, o, $ copy replication yy n rows, p paste.

Guess you like

Origin www.cnblogs.com/love-life-insist/p/11241393.html