From 8fac5fb74f18c29b5d98a34a9c107813017b7df1 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 2 Apr 2020 12:12:57 +0100 Subject: [PATCH] Add OSC 52 escape sequence yank If the `tmux` `set-clipboard` option is set to `on` add the `osc52yank` plugin and change `y` mapping to use it. --- plugin/mappings.vim | 14 +++++++++----- vimrc | 7 +++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugin/mappings.vim b/plugin/mappings.vim index 7c189de..ab9675c 100644 --- a/plugin/mappings.vim +++ b/plugin/mappings.vim @@ -76,11 +76,15 @@ nnoremap tm :tabmove " Clear search highlights nnoremap :nohlsearch -" System clipboard yank/put -noremap y "+y -noremap Y "+Y -noremap p "+p -noremap P "+P +if g:use_osc52 + noremap y :Oscyank +else + " System clipboard yank/put + noremap y "+y + noremap Y "+Y + noremap p "+p + noremap P "+P +endif " Quickly access spelling menu inoremap us diff --git a/vimrc b/vimrc index b5000b6..67c19f8 100644 --- a/vimrc +++ b/vimrc @@ -199,3 +199,10 @@ Pack 'mustache/vim-mustache-handlebars' Pack 'joshglendenning/vim-caddyfile' Pack 'kbenzie/vim-khr' Pack 'jrozner/vim-antlr' + +" Plugins for remote integrations +Pack 'greymd/oscyank.vim', {'type': 'opt'} +let g:use_osc52 = trim(system('tmux show-options -g set-clipboard')) ==# 'set-clipboard on' +if g:use_osc52 + packadd oscyank.vim +endif