diff --git a/vim/shortcuts.vim b/vim/shortcuts.vim index e60bd45..6c60a3f 100644 --- a/vim/shortcuts.vim +++ b/vim/shortcuts.vim @@ -98,23 +98,34 @@ nmap zz :Goyo 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", @") - nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p - xnoremap "*y :call system("wl-copy --primary", @") - nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')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 :let @"=substitute(system('wl-paste --no-newline'), '', '', 'g') \| exec 'normal! ' . v:count1 . 'p' + nnoremap "+P :let @"=substitute(system('wl-paste --no-newline'), '', '', 'g') \| exec 'normal! ' . v:count1 . 'P' else - "" Unkown platform + "" Unknown platform endif " Add shortcuts to yank/paste to unnamed/unnamedplus clipboards -noremap y "*y -noremap p "*p +" noremap y "*y +" noremap p "*p +noremap y "+y +noremap p "+P noremap Y "+y -noremap P "+p +noremap P "+P " A friggin python breakpoint. Invoke with @b "FIXME: make this decent let @b = 'A breakpoint()€ýajkj0'