mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 03:21:30 +01:00
vim: shortcuts: fix clipboard yanking on linux
This commit is contained in:
parent
a8f17dfaa3
commit
185330490b
|
@ -98,23 +98,34 @@ nmap <leader>zz :Goyo<CR>
|
|||
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"
|
||||
"" 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
|
||||
"" Mac specific stuff
|
||||
elseif s:uname == "Linux"
|
||||
"" Linux specific stuff
|
||||
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