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:
- Unnamed register:
""
, Cache the last operation content;
- Number (numbered) register:
"0-" 9
, Cache the content of the most recent operation, copy and delete;
- Small Delete registers:
"-
To delete content in the cache row;
- Name (named) register:
"A-" Z
Or"A-" Z
, Indicating that it is available at regular intervals;
- Read-only registers:
":," .., "% ,"#
Cache recent commands, recently inserted text, current file name, and current Alternate file name respectively;
- Expression register:
"=
, Read-only, used to execute expression commands;
- 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;
- Black Hole register:
"_
, Does not cache the operation content (clean and delete );
- 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_clipboard
One 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-Get
Install
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