Vim common simple operation

  
 

vim is used a lot under Linux, but I am used to the text operation under Windows
. It is very inconvenient to perform text manipulation in vim, but vim is a very powerful tool, but it is not yet Skilled to use it, here are some common vim text manipulation methods.


vim Undo and Resume Operations

Uneditable mode, use u to undo the last operation and Ctrl+r to resume the last operation.

vim Block selection and copy and paste

vim Enter a file, press v to enter VISUAL mode, use h, j, k, l or direction keys to move the cursor to select the content. Press y to finish copying and press p to finish pasting where you need to paste.

Press v to enter VISUAL mode, press v again to exit VISUAL mode. If you copy the content, you can also press i to enter the edit mode for editing, and then esc to exit and paste with p.

vim Move to the beginning and end

Begin and end of the document

gg:Command moves the cursor to the beginning of the document

G:Command moves the cursor to At the end of the document

The beginning and end of a line

0 Move to the beginning of a line

$ Move to the end of a line

vim Page

Equivalent to the effect of page up and page down.

Ctrl+f Scroll forward a full screen

Ctrl+b Scroll back a full screen

Ctrl+d Scroll forward half screen

Ctrl+u Scrolls back half screen

vim Deletes one or more lines

dd Deletes a line ndd Deletes n lines starting with the current line

vim Copy multiple lines

:9,15 copy 16 or:9,15 co 16

This can be:

:9,15 move 16 or:9,15 m 16 will be 9th Line to the text of line 15 to the back of line 16

Copyright © Windows knowledge All Rights Reserved