vim-config icon indicating copy to clipboard operation
vim-config copied to clipboard

Yank doesn't seem to work in Vim8 if nvim also installed

Open chrischen opened this issue 5 years ago • 4 comments

It seems if you do yank in vim8 it doesn't go into the yank history. But if you open neovim and yank, it shows up in the history in vim8.

Put (pasting) in vim8 then does not work. Interestingly enough OS clipboard works.

chrischen avatar Apr 22 '20 08:04 chrischen

I found the issue in line 48 of general.vim

if has('clipboard') && has('vim_starting')
	set clipboard& clipboard+=unnamedplus
endif

Not sure why it causes the problem in vim8 but not in neovim though.

chrischen avatar Apr 22 '20 09:04 chrischen

Was able to fix by changing to

if has('clipboard') && has('vim_starting')
	set clipboard& clipboard^=unnamed,unnamedplus
endif

Thanks to https://stackoverflow.com/questions/30691466/what-is-difference-between-vims-clipboard-unnamed-and-unnamedplus-settings.

Works in both vim and neovim now. I will do a pull request tomorrow.

chrischen avatar Apr 22 '20 09:04 chrischen

Hi @chrischen - are you referring to _numbered registers? e.g. "1..9? These are only for deletions, not yanks. Try testing with just deletions.

rafi avatar Jul 24 '20 14:07 rafi

@chrischen What is your OS? What's your output for :echo g:clipboard ?

rafi avatar Sep 01 '21 16:09 rafi

Pushed a whole new rewrite of vim-config, 100% lua and lazy.nvim as package-manager, check it out...

rafi avatar Apr 07 '23 16:04 rafi