Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In vim what is the difference between "+ and "* registers? Which one should be used for copying from and pasting to vim from other aplications? Do I need to append anything in .vimrc file to get those two registers to work?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

The registers are an X11 feature; they are not Linux-specific or even Unix-specific but work on any OS that uses X11.

As described in Vim documentation (:help quoteplus), the "+ register corresponds to the 'CLIPBOARD' selection in X11, while the "* register corresponds to the 'PRIMARY' selection.

  • More detailed explanation:

    The X11 graphical environment has support for multiple clipboard-like buffers, called selections. There are three standard ones, two of which are in wide use:

    • The PRIMARY selection is updated every time you select text. To paste from it (in graphical programs), middle-click or use ShiftInsert. In Vim, it is accessible through the "* register.

    • The CLIPBOARD selection is updated when you explicitly cut or copy anything (text or other data). In other words, it is used just like the Windows or Mac OS clipboards. To paste from it, the usual shortcut is CtrlV in grapical programs. In Vim, it is accessible through the "+ register.

You don't need any special settings to use them; however, your Vim must be configured with X11 support (look for +X11 in vim --version), and – obviously – the registers only work inside X11.

It doesn't matter whether you are using the GUI or terminal version of Vim, however. (On Arch Linux, the gvim package provides both GUI and terminal versions with the X11 support enabled.)

Resources:

share|improve this answer
    
What is the definition of X11? –  Geek Jul 25 '13 at 19:06
    
X11 aka X Window System 11 is the system and protocol used for the graphical interfaces in Linux, BSDs, most other Unix-like operating systems, as well as a few others like OpenVMS. (Surely, as a Geek, you should be able to figure that one out...) –  grawity Jul 25 '13 at 19:48
    
I have been using :r! xclip to get what has always been in "+ and "*. facepalm –  Ярослав Рахматуллин Jul 26 '13 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.