sh: Reintegrate clip script

Brought back an old universal clipping script and updated it to work
better - well, at all. Can now decide between wl-copy, xclip and xsel
and will do so in that order.
Can take clipping material from the following arguments (will clip any
and all following arguments) or from stdin. Stdin has precedence.
Not much more to say really, but makes writing other applications a bit
more universal when they rely on this universal little tool.
This commit is contained in:
Marty Oehme 2022-02-11 21:32:16 +01:00
parent ff78a1f32f
commit 94cd954df9
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 89 additions and 46 deletions

View file

@ -225,16 +225,17 @@ nnoremap e :!nvim %f<cr>
nnoremap gb :file &<cr>l
" yank current directory path into the clipboard
nnoremap yd :!echo -n %d | xclip -selection "clipboard" %i<cr>
" clip is universal clipper from `sh` module
nnoremap yd :!echo -n %d | clip %i<cr>
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | xclip -selection "clipboard" %i<cr>
nnoremap yf :!echo -n %c:p | clip %i<cr>
" yank current filename without path into the clipboard
nnoremap yt :!echo -n %c | xclip -selection "clipboard" %i<cr>
nnoremap yt :!echo -n %c | clip %i<cr>
" yank root of current file's name into the clipboard
nnoremap yr :!echo -n %c:r | xclip -selection "clipboard" %i<cr>
nnoremap yr :!echo -n %c:r | clip %i<cr>
" Mappings for faster renaming
nnoremap I cw<c-a>