Vscode-neovim: Make Yank etc. copy to clipboard

Created on 12 Jul 2020  路  4Comments  路  Source: asvetliakov/vscode-neovim

Hi,
When I do yank in VS Code, it would be nice to copy it to the clipboard. If I directly use neovim on the command line, yank does copy it to the clipboard as I have the following setting.

set clipboard+=unnamedplus

In the vscode-neovim setting, I'm pointing it to the init.vm which has the above setting.

Is there some setting I'm missing? Please let me know.

need more info

Most helpful comment

I can confirm that with set clipboard=unnamedplus in init.vim yanking from VS Code works with the clipboard.

I am using Linux Centos8 and I have installed xclip, this is VITAL for it to work in Linux when using Xorg. @asvetliakov You might want to add that to the README, took me a while to work that out. From the manual:

Nvim looks for these clipboard tools, in order of priority:

  - |g:clipboard|
  - pbcopy, pbpaste (macOS)
  - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
  - xclip (if $DISPLAY is set)
  - xsel (if $DISPLAY is set)
  - lemonade (for SSH) https://github.com/pocke/lemonade
  - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
  - win32yank (Windows)
  - tmux (if $TMUX is set)

All 4 comments

I just set my clipboard to unnamedplus and it worked as expected. Try :set clipboard? to make sure yours is set correctly.

@RAbraham as pointed above set clipboard should work just fine. But not in case of WSL now (although you can think workaround it by running xserver and configuring clipboard to use xserver clipboard)

I can confirm that with set clipboard=unnamedplus in init.vim yanking from VS Code works with the clipboard.

I am using Linux Centos8 and I have installed xclip, this is VITAL for it to work in Linux when using Xorg. @asvetliakov You might want to add that to the README, took me a while to work that out. From the manual:

Nvim looks for these clipboard tools, in order of priority:

  - |g:clipboard|
  - pbcopy, pbpaste (macOS)
  - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
  - xclip (if $DISPLAY is set)
  - xsel (if $DISPLAY is set)
  - lemonade (for SSH) https://github.com/pocke/lemonade
  - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
  - win32yank (Windows)
  - tmux (if $TMUX is set)

Seems to work for me once I add that line as well. However be aware of the files you put in, ~/.vimrc or ~/.nvimrc doesn't work anymore it has to be ~/.config/nvim/init.vim

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hholst80 picture hholst80  路  3Comments

mizagog picture mizagog  路  5Comments

bogdan0083 picture bogdan0083  路  4Comments

zeljkofilipin picture zeljkofilipin  路  3Comments

Liquidmantis picture Liquidmantis  路  3Comments