make the vim clipboard mapping portable : wl-copy, xclip or xsel

Generated by Mistral Vibe.
This commit is contained in:
hugogogo
2026-10-31 00:26:19 +01:00
parent 5fb900f1c3
commit 6860151b8d
+8 -8
View File
@@ -64,14 +64,14 @@ highlight nonText ctermbg=NONE
" ---------------------------------------------------------------------
" copy to the clipboard from vim : in visual mode, select text with
" 'v' (or 'V' for whole lines, Ctrl-v for a block), then type
" '<leader>y' ('<leader>' is ',' since it is set in base settings) :
" the selected lines are piped to 'wl-copy' and can be pasted
" anywhere (C-v, middle click). note : the range is whole lines, a
" partial-line selection copies the full lines. requires
" 'wl-clipboard' installed (for the screen-level equivalent, see
" the 'C-a Y' binding in .screenrc)
vnoremap <leader>y :w !wl-copy<CR><CR>
" 'v' or 'V' or Ctrl-v, then type '<leader>y'.
" ('<leader>' is ',' since it is set in base settings).
" the selected lines are piped to the first clipboard tool available
" on the machine (wl-copy (wayland), then xclip, then xsel (X11)),
" and can be pasted anywhere.
" note : the range is whole lines, a partial-line selection copies
" the full lines.
vnoremap <leader>y :w !sh -c 'wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || xsel --clipboard --input'<CR><CR>
" ---------------------------------------------------------------------
" indentation