1

How can I merge OS clipboard and Vim's one? I want them to be the same, so that I don't have to use "*y or "*p or "*d, instead just y, or p or d. How can I do that?

3
  • See vi.stackexchange.com/a/89/205
    – muru
    Commented Feb 2, 2017 at 6:40
  • 2
    Maybe, maybe not. See the help center before responding further.
    – muru
    Commented Feb 2, 2017 at 7:07
  • Note that the linked question should contain the answer: "If you want to "automatically" interface with the system's clipboard instead of referring to it manually all the time, you can set the clipboard variable: [...]" Commented Feb 3, 2017 at 1:52

1 Answer 1

2

From :h 'cb:

                    *clipboard-unnamed*
unnamed     When included, Vim will use the clipboard register '*'
        for all yank, delete, change and put operations which
        would normally go to the unnamed register.  When a
        register is explicitly specified, it will always be
        used regardless of whether "unnamed" is in 'clipboard'
        or not.  The clipboard register can always be
        explicitly accessed using the "* notation.  Also see
        |gui-clipboard|.

So, maybe you could try to prepend the value 'unnamed' to the option 'clipboard':

set clipboard^=unnamed

As the help explains, this should tell Vim to use the * register for all yank, delete, change and put operations.

2
  • why maybe? will that work for sure?
    – Torito
    Commented Feb 2, 2017 at 7:01
  • @Torito I said maybe because I'm not using exactly this setting. I'm using this : set clipboard^=unnamedplus. It should work, but it can lead to problems if you're using plugins. Often, plugin authors forget to take into consideration that the user may change their 'clipboard' option. Because of this, sometimes a functionality they provide doesn't work as expected. Here is an example: github.com/tpope/vim-scriptease/blob/master/plugin/… Here, you just have to prepend "" in front of the p command, but still, it can be annoying to find where the fix is needed. Commented Feb 2, 2017 at 7:09

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