VIM system pasting

Source: Internet
Author: User

 

We can use the X11 clipboard to share text with other graphic interfaces. PS: X11 is a graphical environment for most desktop environments such as Gnome and KDE.

X11 has two global cache zones to cache content among multiple applications. One is called cut-buffer, which stores the copied and pasted content, this is what we first thought of when talking about system clipbord. The other name is "selection". In X11, when we select a piece of content with the mouse, We can click and paste the content to the cursor.

It is exciting that VIM can access these two cache zones, get the content of these two cache zones, and put the content in these two cache zones.

In VIM, we can use the command "+ to access" cut-buffer ", for example:

 

"+ Y can extract the selected region and store it to" cut-buffer ".

"+ P paste the content of" cut-buffer "(paste) to the cursor.

"+ Dd can cut the current row and store it to" cut-buffer ".

"+ Yy can extract the current row and store it to" cut-buffer ".

 

 

In VIM, we can use the command "× to access" selecttion ", for example:

"* Y can extract the selected region and store it to" selecttion ".

"* P paste the content of" selecttion "(paste) to the cursor.

"* Dd can cut the current row and store it to" selecttion ".

"* Yy can extract the current row and store it to" selecttion ".

 

Note:

If we use xterm to log on to Vim, VIm must support xterm clipboard during compilation. How can we determine that Vim does not support it?

 

Vim -- version | grep "xterm_clipboard"

 

My display:

 

 

+ X11-xfontset + xim + xsmp_interact + xterm_clipboard-xterm_save

 

+ "+" In front of xterm_clipboard indicates support, and "-" indicates not support. (It is not supported if no display is available)

 

Alternatively, you can use the preceding command and then type reg in vim to check the content in the Register to determine whether the support is not supported.

Vim installed using sudo apt-get install VIm is not supported by default, that is,-xterm_clipboard. Therefore, saving the system clipboard is not supported. It is quite painful to paste vim content into other applications. Instead of re-compiling, I installed sudo apt-get install vim-gnome to install gvim and then support it!

Http://www.jveweb.net/en/archives/2011/02/vim-and-the-x11-clipboard.html, Translation

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.