1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-21 19:11:30 +01:00

vim: cleanup wayland copy/paste

This commit is contained in:
bretello 2023-09-14 13:07:36 +02:00
parent 24fc7dd2ed
commit 323542a705
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -126,20 +126,9 @@ if g:uname ==? 'Darwin'
"" Mac specific stuff "" Mac specific stuff
elseif g:uname ==? 'Linux' elseif g:uname ==? 'Linux'
"" Linux specific stuff "" Linux specific stuff
function! s:WaylandYank() xnoremap "+y y:call system("wl-copy", @")<cr>
if v:event['regname'] ==# '+' || (v:event['regname'] ==# 'w' && s:plus_to_w)
call system('wl-copy', getreg(v:event['regname']))
endif
endfunction
" run s:WaylandYank() after every time text is yanked
augroup waylandyank
autocmd!
autocmd TextYankPost * call s:WaylandYank()
augroup END
map "+p :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'p'<cr> map "+p :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'p'<cr>
map "+P :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'P'<cr> map "*p :<C-U>let @"=substitute(system('wl-paste --no-newline --primary'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'P'<cr>
else else
"" Unknown platform "" Unknown platform
endif endif
@ -147,8 +136,7 @@ endif
" Add shortcuts to yank/paste to unnamed/unnamedplus clipboards " Add shortcuts to yank/paste to unnamed/unnamedplus clipboards
map <Leader>y "+y map <Leader>y "+y
map <Leader>p "+P map <Leader>p "+P
map <Leader>Y "+y map <Leader>P "*p
map <Leader>P "+P
map <Leader>yp <Plug>yankstack_substitute_older_paste map <Leader>yp <Plug>yankstack_substitute_older_paste
map <leader>yn <Plug>yankstack_substitute_newer_paste map <leader>yn <Plug>yankstack_substitute_newer_paste