Vi/vim copy and paste command 1. Select the text block. Use v to enter the visual mode and move the selected content of the cursor key. 2. the Copy command is y, that is, yank (mentioned). The Common commands are as follows: when y selects a block in v mode, it is used to copy the selected block to the buffer zone; yy copies the entire row (nyy or yny, n rows are copied, n is a number); y ^ copies the content from the current row header; y $ copies the content from the current row to the end of the row; copy a word (nyw or ynw, copy n words, n is a number); copy yG to the end of the file (nyG or ynG, copy to the nth line, such as 1yG or y1G, copy to the end of the file) 3. the cut command is d, that is, delete, d is similar to y, so the two commands use the same, including the use of numbers. d cut the selected block to the buffer; dd cut the entire row d ^ cut to the first row d $ cut to the end of the row dw cut a word dG cut to the end of the file 4. paste the imperative p, that is, put (put down) p lowercase p stands for sticking to the cursor (bottom), because the cursor is at the position of a specific character, therefore, P is followed by this character. P indicates that the entire row is copied and pasted before the cursor. The cursor is one row up (down), and the non-whole row is copied before (after) the cursor. Note: In a regular expression, ^ indicates the starting position of the matching string, $ indicates the end position of the matched string. Add a number to the front of the command to indicate the number of repetitions, and add a letter to indicate the name of the buffer used. You can use the English period "." To repeat the previous command. During copy and paste, another group of commonly used commands are u (Undo operation), U (undo all the latest modifications of a line), Ctrl + R (redo ), these functions are mainly in vim, and there is a slight difference in vi.