From 143851d9af9e77945253bc64c651f387256bbc4e Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 9 Aug 2022 18:03:26 +0200 Subject: [PATCH] vimrc: improve clipboard handling --- .vim/vimrc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.vim/vimrc b/.vim/vimrc index 19e40da..d5d7a47 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -453,10 +453,6 @@ nmap :ALEPreviousWrap nmap :ALENextWrap nnoremap a :ALEDetail -" ------ wayland copy -xnoremap "+y y:call system("wl-copy", @") -nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p -nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')p " [bro]wse [ol]d files nnoremap r :bro ol @@ -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 "+y y:call system("wl-copy", @") + xnoremap "*y y:call system("wl-copy", @") +endif +if s:env =~# 'LINUX' && executable('wl-paste') + nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p + nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')p +endif + inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\"