I've been using vim recently, and it feels very good and powerful, but when I use the copy-cut-paste command, I encountered some small confusions. I found some information on the Internet and felt that it was not complete, and I didn't speak well, so I practiced and summarized it myself.
First is cut (delete):
Cut actually deletes the selected content by the way, so it can be used as a cut command or as a delete command.
1 First of all, you can enter v in the command mode to enter the free selection mode. After selecting the text to be cut, press d to cut it. 2 Cut commands in other command modes: 3 dd : cut the current line 4 ndd: n means a number greater than 1, cut n lines 5 dw: cut from the cursor to the end of a single word/word, including spaces 6 de : Cut from the cursor to the end of a word/word, excluding spaces 7 d$: Cut from the current cursor to the end of the line 8 d0: Cut from the current cursor position (excluding the cursor position) to the beginning of the line 9 d3l: From Cut 3 characters to the right at the cursor position (including the cursor position) 10 d5G: Cut the current line (including the current line) to the 5th line (excluding it) 11 d3B: Inverse from the current cursor position (excluding the cursor position) Cut 3 words in the direction 12 dH: Cut all lines from the current line to the top line of the displayed screen 13 dM: Cut all lines from the current line to the line specified by command M 14 dL: Cut from the current line to all lines Show all lines at the bottom of the screen
In my own practice, I also found that pressing the d key alone cuts 2 lines, and pressing nd cuts n+1 lines. However, it is recommended to use double d (ie dd) for general use.
For the copy command, it is roughly similar to the cut command, just replace the corresponding d with y:
First, you can enter v in the command mode to enter the free selection mode. After selecting the text to be cut, press d to cut it. Cut commands in other command modes: yy: copy the current line nyy: n represents a number greater than 1, copy n lines yw: copy from the cursor to the end of a word / word, including spaces ye: copy from the cursor to the end of a word / word, excluding spaces y$: copy from the current cursor to the end of the line y0: the beginning of the line copied from the current cursor position (excluding the cursor position) y3l: Copy 3 characters to the right from the cursor position (including the cursor position) y5G: Copy the current line (including the current line) to line 5 (excluding it) y3B: Copy 3 words in reverse from the current cursor position (excluding cursor position)
Press y alone to copy 2 lines, ny to copy n+1 lines
As for the paste command, the easiest way is to press p at the cursor to be pasted.
For vim's god-level configuration file and installation method, please see this post: http://www.cnblogs.com/maowang1991/p/3362704.html in the vim recommendation column.
hopefully this can provide beneficial help to everyone!