Ubuntu12.04 cannot use the VIM system Clipboard Solution

Source: Internet
Author: User

Previously working in VIM requires copying things between vim and other editors, using Shift + Ctrl + v/c. Feel this is inconvenient, today in the online search for the following can be used "+y/p, but their own experiment how also do not, in command mode after you enter Reg" +. Originally installed with apt-get install Vim can not use the system Clipboard, that is, copy: "+y, and paste" +p can not be used;

Software Environment:

I'm using Ubuntu 12.04.

Solutions

Install the relevant package first, and then install Vim.

Before this, remove the previously installed related packages with Apt-get. Apt-get Purge Uninstall clean.

To install the relevant package:

[Plain]View PlainCopy print?
    1. $ sudo apt-get install build-essential
    2. $ sudo apt-get install Ncurses-dev
    3. $ sudo apt-get install Xorg-dev
    4. $ sudo apt-get install Libgtk2.0-dev



Install Vim

[Plain]View PlainCopy print?
    1. $ sudo apt-get install vim vim-scripts vim-gtk vim-gnome
    2. $ sudo apt-get install exuberant-ctags cscope

To set the mapping:

[Plain]View PlainCopyprint?
    1. Let Mapleader = ","
    2. Let G:mapleader = ","
    3. Map Y "+y
    4. Map P "+p

Please use the ": Reg" command now, see? The output on the screen! It's not very familiar, right! Is everything you've ever copied! Perhaps at this time you also found that the vim of the shear plate has so many, according to the numbers and symbols of a separate area, here to cite a number example-"5, see?" It starts with ". And also! Have you seen the Clipboard with the number "+"? Is the content inside the text that you copied in the browser just now? Oh...... That's right! The system Clipboard number is "+".
Well, now that you know how to view all of the previous clipboard contents, we'll try to copy the contents of a particular shear board into the file we're editing. We know that Vim's paste instruction is "P", but if you want to paste a particular clipboard, just use p to not, then what? Simple! Can you put the number on the clipboard? Now press ESC, exit edit mode, and then press the word "+p" three characters (how do I press?). No way! "and + How to press?" Use Shift! ), All right! You see, the text that was previously copied in the browser is pasted into the document?
You already know how to copy the contents of the system Clipboard into vim. So how do you paste the characters copied in vim somewhere else? Very simple, we just need to copy the text, copied into the "+ Shear board is not OK?" In Vim, the copied instruction is Y (press Y in non-edit mode), that is, to copy the text into the specified clipboard, and paste the contents of the specified Clipboard as a method, just need to add the Clipboard number. For example, we want to copy a piece of text from vim and then paste it into the browser's address bar: The first step is to select the text that needs to be copied (not in edit mode), then press the "+y" button on the keyboard, and then click the three characters, ok! has been copied down, now with: Reg command to see, is not in the "+ Clipboard?"

Ubuntu12.04 cannot use the VIM system Clipboard Solution

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.