Vim copy and Paste commands

Source: Internet
Author: User

1. Select a text block. Using V to enter the visual mode, move the cursor key selection. 

2. The command to copy is Y, which is yank (lifted), and the commonly used commands are as follows: 
Y Copies the selected block to the buffer when a piece is selected using the V mode; 
yy copy entire row (Nyy or yny, copy n rows, n is number); 
y^ Copy the contents of the current to the wardrobe; 
y$ Copy the contents of the current to the end of the line; 
YW copy a word (NYW or ynw, copy n word,n to numbers); 
YG Copy to end of file (NYG or yng, copy to Nth line, e.g. 1yG or y1g, copy to end of file) 
 
3. The Cut command is D, that is, the delete,d is basically similar to the y command, so two command usages, including the use of a number. 
D Cut the selected block into the buffer; 
DD Cut Whole row 
d^ cut to the beginning of the line 
d$ cut to end of line 
DW cuts a word 
DG cut to the end of the gear 
 
4. Paste the imperative p, that is put (put down) 
P lowercase p represents the post to the cursor (bottom), because the cursor is at the position of the specific character, so it is actually behind the character 
P Capital P represents the front of the cursor (top) 
A copy of the entire row is pasted on the cursor (bottom) row, and the non-full row copy is pasted before (after)

Note:
In a regular expression, ^ represents the starting position of the matching string, and $ represents the end position of the matched string.  
A command preceded by a number indicating the number of repetitions, plus a letter indicating the name of the buffer used. Use the English period "." You can repeat the previous command.  
While copying and pasting, another set of commonly used commands is U (undo action), U (undo a row of all recent modifications), Ctrl+r (Redo), these functions are mainly in Vim, vi slightly different

Vim copy and Paste commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.