Vim registers and copy and paste Functions

Source: Internet
Author: User

I recently built a vim-ide on Ubuntu, but it cannot interact with the system clipboard .... I read n online strategies, all of which are "+ Y and" + P commands, but they do not work .... Finally, I found the cause. It turns out that my vim does not support the system clipboard ~~ Record related content and Solutions

1. Register Introduction

Vim has nine types of registers:

    1. Unnamed register:"", Cache the last operation content;
    2. Number (numbered) register:"0-" 9, Cache the content of the most recent operation, copy and delete;
    3. Small Delete registers:"-To delete content in the cache row;
    4. Name (named) register:"A-" ZOr"A-" Z, Indicating that it is available at regular intervals;
    5. Read-only registers:":," .., "% ,"#Cache recent commands, recently inserted text, current file name, and current Alternate file name respectively;
    6. Expression register:"=, Read-only, used to execute expression commands;
    7. Select and drop registers:"*," + ,"~To access the selected text in the GUI, which can be used to interact with external applications, provided that the system clipboard (Clipboard) is available;
    8. Black Hole register:"_, Does not cache the operation content (clean and delete );
    9. Mode register (last search pattern ):"/, Cache the latest search mode.

The above description is a brief overview and is not completely accurate. For details, refer to the manual:

: Help copy-move

Available registers under VI or Vim without graphical interfaces only include{A-zA-Z0-9.% #:-"}Obviously, this does not include"*Or"+And drag and drop the memory.

It can be seen that the key to implementing mutual copying and pasting between vim and external applications lies in the availability of the system clipboard For Vim.

 

2. Check whether Vim supports system clipboard and related solutions.

The command to check whether the vim clipboard is available is

 
Vim-version

The following is the result of my system (I only keepXterm_clipboardOne item)

Vim-VI improved 7.2 (2008 Aug 9, compiled Apr 16 2010 12:47:47) contains patches: 1-3 30 compilers buildd @ the giant version has no graphic interface. Available (+) and unavailable (-) features:-xterm_clipboard for non-Gui versions of VIM, clipboard is not available, the solution is very simple, just install it

Sudo Apt-GetInstall Gvim

The following is the result after installation:

 
Vim-VI improved 7.2 (2008 Aug 9, compiled Apr 16 2010 12:40:58) contains patches: 1-330 compilers buildd @ giant version with GTK2-GNOME GUI. Functions available (+) and unavailable (-): + xterm_clipboard

PS: During gvim installation, the system will prompt

The gvim package is a virtual package provided by the following package: vim-GTK. 3.429-2ubuntu2. 1 vim-Athena. 3.429-2ubuntu2. 1 vim-GNOME 2: 7. 3.429-2ubuntu2. 1. Select one for installation.

 

For Ubuntu, select vim-gnome, that is

 
Sudo apt-Get install vim-gnome

Reference Site: http://www.yulefox.com /? P = 1487

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.