my-vim-wiki-doing

Record several operations commonly used in vim

Getting Started Guide

~ vimtutor
~

1. Vim is case sensitive

2. Move the cursor in vim

h move left

j move down

k move up

l move to the right

In fact, you can use the arrow keys to move, but you can also use it in other editors or browsers after you are familiar with it.

3. Delete from vim

x deletes the letter under the cursor

dw delete complete word excluding following punctuation

dd delete entire line

D delete the entire line


 

2017-4-25

4. Move line in vim 

:m 12 If the current line number is line 10, move the current line to line 12

If the current row count is row 20, move the current row to row 13

:m 0 moves the current line before the first line

:m $ move the current line after the last line

The space after :m can be omitted

5. Move multiple lines in vim

:m5,7m 21 move lines 5, 6, 7 to line 21

:m5,7m 0 move lines 5, 6, and 7 to the front of the first line

:m5,7m $ move lines 5, 6, 7 after the last line

:.,.+4m 21 will move 5 lines from the current line to line 21

:,+4m21 Same as the previous command, you can omit . and spaces

6. Undo the last operation in vim

u Cancel


 

2017-04-26

7. vim jump to last or first line

G jump to the last line

gg jump to the first line

 


 

2017-04-29 

8. vim jump to specified line

:6 + Enter Skip to line 6

6G Skip to line 6

6gg skip to line 6

to be continued...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325389957&siteId=291194637