vimrc: improve clipboard handling

This commit is contained in:
surtur 2022-08-09 18:03:26 +02:00
parent 5942afdee6
commit 143851d9af
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -453,10 +453,6 @@ nmap <silent> <C-k> :ALEPreviousWrap<cr>
nmap <silent> <C-j> :ALENextWrap<cr>
nnoremap <Leader>a :ALEDetail<cr>
" ------ wayland copy
xnoremap <silent>"+y y:call system("wl-copy", @")<cr>
nnoremap <silent>"+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
" [bro]wse [ol]d files
nnoremap <leader>r :bro ol<cr>
@ -507,6 +503,17 @@ augroup END
"------------------------------------
exec "source " . escape(expand("~/.vim"),' ') . "/" . "gotags.vimrc"
" ------ wayland copy and pasting
let s:env = toupper(substitute(system('uname'), '\n', '', ''))
if s:env =~# 'LINUX' && executable('wl-copy')
xnoremap <silent>"+y y:call system("wl-copy", @")<cr>
xnoremap <silent>"*y y:call system("wl-copy", @")<cr>
endif
if s:env =~# 'LINUX' && executable('wl-paste')
nnoremap <silent>"+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
endif
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<left>"