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 " 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 " 'v' or 'V' or Ctrl-v, then type '<leader>y'.
" '<leader>y' ('<leader>' is ',' since it is set in base settings) : " ('<leader>' is ',' since it is set in base settings).
" the selected lines are piped to 'wl-copy' and can be pasted " the selected lines are piped to the first clipboard tool available
" anywhere (C-v, middle click). note : the range is whole lines, a " on the machine (wl-copy (wayland), then xclip, then xsel (X11)),
" partial-line selection copies the full lines. requires " and can be pasted anywhere.
" 'wl-clipboard' installed (for the screen-level equivalent, see " note : the range is whole lines, a partial-line selection copies
" the 'C-a Y' binding in .screenrc) " the full lines.
vnoremap <leader>y :w !wl-copy<CR><CR> vnoremap <leader>y :w !sh -c 'wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || xsel --clipboard --input'<CR><CR>
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" indentation " indentation