vimclipboard

What is difference between Vim's clipboard "unnamed" and "unnamedplus" settings?


What is the difference between these 2 settings?

set clipboard=unnamed
set clipboard=unnamedplus

Which one should I use in order to have multi-platform .vimrc?


Solution

  • In Vim, the text you yank or cut without providing a specific register goes into the " register by default, also called "unnamed register".

    One can choose to synchronize that register with their system clipboard(s). This is done with the :help 'clipboard' option.

    On Mac OS X and Windows, the * and + registers both point to the system clipboard so the clipboard values unnamed (for the * register) and unnamedplus (for the + register) have the same effect: the unnamed register is synchronized with the system clipboard.

    On Linux, you have essentially two clipboards: one is pretty much the same as in the other OSes (CtrlC and CtrlV in other programs, mapped to register * in Vim), the other is the "selection" clipboard (mapped to register + in Vim).

    Using only unnamed on Linux, Windows and Mac OS X allows you to:

    If you also want to use Linux's "selection" clipboard, you will also need unnamedplus.

    Here is a cross-platform value:

    set clipboard^=unnamed,unnamedplus
    

    Reference:

    :h 'clipboard'
    (and follow the tags)