mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-05 01:01:30 +01:00
vim: shortcuts: fix clipboard yanking on linux
This commit is contained in:
parent
e6953b53d9
commit
273b49776d
|
@ -99,22 +99,33 @@ let s:uname=''
|
|||
let s:uname = system('uname | tr -d "\n"') " Get platform name (stripping the trailing newline)
|
||||
if s:uname == "Darwin"
|
||||
"" Mac specific stuff
|
||||
elseif s:uname == "linux"
|
||||
elseif s:uname == "Linux"
|
||||
"" Linux specific stuff
|
||||
" Wayland clipboard fix https://github.com/vim/vim/issues/5157
|
||||
xnoremap "+y :call system("wl-copy", @")<CR>
|
||||
nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
|
||||
xnoremap "*y :call system("wl-copy --primary", @")<CR>
|
||||
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
|
||||
function! s:WaylandYank()
|
||||
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
|
||||
|
||||
nnoremap "+p :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'p'<cr>
|
||||
nnoremap "+P :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'P'<cr>
|
||||
else
|
||||
"" Unkown platform
|
||||
"" Unknown platform
|
||||
endif
|
||||
|
||||
" Add shortcuts to yank/paste to unnamed/unnamedplus clipboards
|
||||
noremap <Leader>y "*y
|
||||
noremap <Leader>p "*p
|
||||
" noremap <Leader>y "*y
|
||||
" noremap <Leader>p "*p
|
||||
noremap <Leader>y "+y
|
||||
noremap <Leader>p "+P
|
||||
noremap <Leader>Y "+y
|
||||
noremap <Leader>P "+p
|
||||
noremap <Leader>P "+P
|
||||
|
||||
" A friggin python breakpoint. Invoke with @b "FIXME: make this decent
|
||||
let @b = 'A
breakpoint()ýajkj0'
|
||||
|
|
Loading…
Reference in New Issue
Block a user