Vim copy and paste

Source: Internet
Author: User

Reference address: http://lsong17.spaces.live.com/blog/cns! 556c21919d77fb59! 603. Entry

Content:

If you only want to use the system clipboard, simply press SHIFT + inset (paste) in the input mode.
VimThe help document includes the following content:

  1. VimThere are 12 clipboard, which are 0, 1, 2,..., 9, A, ", +. You can use the: Reg command to view the content of each clipboard. InVimSimple to use yCopyTo the "(double quotation marks) clipboard, the content in the clipboard is also pasted with P;

     

  2. ToVimContentCopyTo a clipboard, You need to exit the editing mode. after entering the normal mode, selectCopyAnd then press "NY (note the quotation marks ).CopyWhere N is the clipboard number (note that double quotation marks are followed by the clipboard number and then followed by Y). For exampleCopyTo clipboard a, click "ay" After selecting the content. There are two points to describe:
    • "No. Clipboard (temporary clipboard) is special. Press Y directly.CopyPaste the content in the clipboard directly by pressing p;
    • + NO. Clipboard is a system clipboard. Use "+ Y to paste contentCopyYou can use Ctrl + V to paste the clipboard to other documents (such as Firefox and gedit). Similarly, you must press Ctrl + C or right-click it elsewhere.CopyContentCopyToVimIn normal mode, press "+ P;

     

  3. ToVimPaste the content in a clipboard and exit the editing mode. In normal mode, press "NP, where N is the clipboard number, as described above, you can press "5 p to paste the content in the 5 th clipboard, or press" + P to paste the content in the global clipboard of the system.

Note: Here, only Vim. GTK or Vim. gnome can use the system global clipboard. The default Vim. Basic cannot see the + register. Install Vim. gnome and use apt-Get install vim-gnome. Then Vim automatically links to VIM. gnome.

Below are the basic commands for VIM copy and paste:
YY copies the entire row of the cursor. Or an uppercase y.
Copy 2yy or y2y. Sorry, please put it together! :-)
Y ^ copy to the beginning of the line, or y0. Does not contain the character at which the cursor is located.
Y $ copy to the end of the row. Contains the character at which the cursor is located.
Copy a word from YW.
Copy two words (words) in the y2w format ).
Copy YG to the end of the file.
Copy y1g to the beginning of the file.
P lowercase P indicates that the cursor is appended to the lower case ).
P capital P indicates that the cursor is pasted to the Front (top ).

Copy a single character
Select normal mode (Press ESC)
Press V (specify the clipboard as "1 V quotation marks (no less) to enter the visual mode. Then you can move the direction key to select the text, and press y to copy the text,
If you want to start copying four characters from the cursor, you can press 4yl (after copying the cursor) ("14yl) (" 110yl followed by 10 characters ), 4 YH (before copying the cursor), then four characters are copied to the buffer zone,
Press it and you can use the p command (specify the clipboard as "1 V quotation marks must not be less) to paste it at will (1 refers to the bottom clipboard name)

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.