I cannot copy into the + or * register.
:echo has('clipboard') from within Vim returns 0 meaning I don't have that feature flag, I don't want to recompile.
I'm running wayland so I cannot use X11 based solutions
I cannot copy into the + or * register.
:echo has('clipboard') from within Vim returns 0 meaning I don't have that feature flag, I don't want to recompile.
I'm running wayland so I cannot use X11 based solutions
On
The feature the author is asking for will be hopefully implemented in vim. See for details: https://github.com/vim/vim/issues/5157
There is also a workaround plugin: https://github.com/jasonccox/vim-wayland-clipboard
As for me, I'm using my own workaround:
" Yank into all these at once:
" vim y/p register
" wayland primary
" wayland clipboard
xnoremap <silent> <leader>y y:call system("wl-copy --trim-newline", @*)<cr>:call system("wl-copy -p --trim-newline", @*)<cr>
On
Install the wl-clipboard package.
Then, adding this to ~/.config/nvim/init.vim (NeoVIM) works well for me:
set clipboard=unnamed
let g:clipboard = {
\ 'copy': {
\ '+': ['wl-copy', '--trim-newline'],
\ '*': ['wl-copy', '--trim-newline'],
\ },
\ 'paste': {
\ '+': ['wl-paste', '--no-newline'],
\ '*': ['wl-paste', '--no-newline'],
\ },
\ }
I had trouble finding resources so here is what ended up working by adding in
~/.vimrc.wl-copyis a Command-line copy/paste utilities for Wayland and it will copy the piped content you give it to system clipboard.What mapping above achieves is
Ctrl + @. or choose any convenient key combonnoremap <C-@>take the contents of the
"register,@"argumentand pipe contents of
@"as an argument to the systemwl-copyfunction:call system("wl-copy", @").Alternatively
Assuming you only want to copy line sections of the file, do
shift+vto go into visual mode and only highlight the lines I want to copy. Then do.where
'<,'>- means you used visual mode to select a range (you don't type this)w !{cmd}- write the range to the stdin ofcmd, see more at:help w_cYou can map that with
xnoremap: mapping will work in visual mode only<silent>: mapping which will not be echoed on the command line<C-@>: desired key combination:w !{cmd}: write the range to the stdin ofcmd<CR><CR>: two enters are needed otherwise command line waits for another command