Vim shortcuts finishing

Source: http: //my.oschina.net/u/877170/blog/491684#OSC_h3_1

First, move the cursor

1, left H, L right, down j, k Move

2, Down ctrl + f, turning upward ctrl + b

3, turning down half page ctrl + d, turned upward half page ctrl + u

4, moves to the end of the line $ move to the beginning of the line 0 (digital), moved to the beginning of the first character ^

5, move the cursor to the next sentence), move the cursor to a sentence (

6, is moved to the first section {,} moves to the end of the paragraph

7, move to the next word w, the word to move b

8, move to the beginning of the document gg, move to the end of the document G

9, moved to the matching {}. (). [] At%

10, the n-th row jump or ngg nG or: n

11, move the cursor to the top of the screen H, M is moved to the middle of the screen, moving in the end portion L

12, read the current character and move to the next place that appears in this screen *

13, read the current character and move to the first occurrence of a place in this screen #

 

Second, the Find and Replace

1, the cursor backward to find keywords or g # #

2, the cursor forward or look for keywords * g *

3, the current line to find a character fx, Fx, tx, Tx

4, the basic replacement: s / s1 / s2 (s1 replaced by the next s2)

5. Replace:% s / s1 / s2

6, the current line only: s / s1 / s2 / g

7, to replace some of lines: n1, n2 s / s1 / s2 / g

8, the search mode / string, search for the next occurrence of n, a search is N

9, the development of bookmarks mx, but can not see the bookmark, and only use lowercase letters

10, moved to a tag at `x, a next key

11, moved to the location of the file last edited `.

 

PS :. represents an arbitrary character * on behalf of one or more characters repeat

         Regular expressions will organize content in a follow-up article

 

Third, the editing operation

1, the cursor is inserted a, the insertion end of the line A

2, after inserting the insertion line O, O row into forward runs

3, delete, insert characters s, delete the forward line into the S

4, is inserted before the cursor i, the first insert row I

5, delete a row dd, delete or insert mode cc S

6, delete a word dw, delete a word into insert mode cw

7, or to delete a character x DL, a character delete or insert mode s cl

8, paste p, exchange two characters xp, exchange two lines ddp

9, copy y, copy line yy

10, the revocation u, Redo ctrl + r, is repeated.

11 smart tips ctrl + n or ctrl + p

12, the character motion across the delete, delete and insert mode c {motion}

13, to delete the character to the next character crossed, delete and insert mode, the characters do not include x ctx

14, delete the current character to the next character at all the characters and into insert mode, including x character, cfx

15, motion across the delete character, but does not delete the insert mode d {motion}

16, delete the motion across the character, but does not delete the insert mode, the characters do not include x dtx

17, delete the current character to the next character at all the characters, including the character x dfx

18, if the situation is only copied to 12-17 bar c or d to y

19, end of the line can be used to delete the D or C

20, or a copy of the current line Y yy

21, delete the current character x

22, p Paste

23, may be used multiple clipboard, view the status of use: reg, using the clipboard to use ", for example, copied to the w register," WYY, or Visual mode v "wy

24, is repeatedly performed on a use effect.

25, can be used across a number n regions, such as y3x, the cursor will be copied into the area between the third x, 3j line 3 is moved downward

26, in the preparation of the code may be used] P adhesive, so that the code can be automatically retracted

27, all of the selected code indentation >>

28, << anti-indent all selected code

29, the definition of the function or variable to move the cursor is located gd

30, K word in the man in search of the cursor

 

31, merging the two rows J

32, if do not want to save the file, and re-open: e!

 

33. To open a new file: e filename, then switching a file ctrl + ^

Fourth, the window operation

1, a partition window: split or: vsplit

2, create a window: new or: vnew

3, the file is opened in a new window: sf {filename}

4, close the current window: close

5, retaining only the current window: only

6, the left window ctrl + w, h

7, the right window ctrl + w, l

8, the upper window ctrl + w, k

9, the window below ctrl + w, j

10, the top of the window ctrl + w, t

11, in the end portion of the window ctrl + w, b

 

Fifth, the macro action

1, macro recording operation starts q [az], press q end, a register saving operation [az] in

2, @ [az] execution register [az] in operation

3, @@ perform macro actions last record

 

Sixth, visual operation

1, visual mode proceeds to block ctrl + v

2, enter the character visual mode v

3, the visual-line mode to enter the V

4, delete the selected block d

5, delete the selected block is then inserted into the mode c

6, in the selected block is inserted with the same character I <String> ESC

 

Seven, jump statements

1, [[skip ahead of a top grid {  

2, [] skip ahead to a first top grid}

3,]] jump backward a first top grid {

4,]] jump back a first top grid}

5, [{jump to the beginning of this code block

6,]} The code jumps to the end block

 

Eight, suspend operation

1, or suspend Vim ctrl + z: suspend

2, view the task enter jobs in the shell

3, recovery tasks fg [job number] (the background process to the foreground) or bg [job number] (the foreground program in the background)

4, execute shell commands:! Command

5, open a shell command: shell, exit the shell exit

6, save vim status: mksession name.vim

7, restore vim status: source name.vim

8, restore the state when you start vim vim -S name.vim

 

Reproduced in: https: //www.cnblogs.com/stevenzeng/p/5082633.html

Guess you like

Origin blog.csdn.net/weixin_34409822/article/details/93881047