Refactor tmux and set-clipboard detection

Move logic to `autoload/tmux.vim` to detect the `vim` is being run
inside a `tmux` sessions and if the `set-clipboard` option is enabled.
This cleans up adding the optional `oscyank.vim` plugin when needed.
This commit is contained in:
2020-12-10 18:07:24 +00:00
parent 76acb9cd90
commit c17f7ea0d9
3 changed files with 14 additions and 4 deletions

4
vimrc
View File

@@ -200,9 +200,7 @@ Pack 'jrozner/vim-antlr'
" Plugins for remote integrations
Pack 'greymd/oscyank.vim', {'type': 'opt'}
let g:use_osc52 = $TMUX !=# '' &&
\ trim(system('tmux show-options -g set-clipboard')) ==# 'set-clipboard on'
if g:use_osc52 && isdirectory(expand('~/.vim/pack/minpac/opt/oscyank.vim'))
if tmux#isSetClipboardOn()
packadd oscyank.vim
endif