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.
22 lines
583 B
VimL
22 lines
583 B
VimL
let s:tmux_option = '@vim'.substitute($TMUX_PANE, '%', '\\%', 'g')
|
|
|
|
function! tmux#inSession() abort
|
|
return $TMUX !=# ''
|
|
endfunction
|
|
|
|
function! tmux#setNavigationFlag() abort
|
|
call system('tmux set-window-option '.s:tmux_option.' 1')
|
|
endfunction
|
|
|
|
function! tmux#unsetNavigationFlag() abort
|
|
call system('tmux set-window-option -u '.s:tmux_option)
|
|
endfunction
|
|
|
|
function! tmux#isSetClipboardOn() abort
|
|
if !tmux#inSession()
|
|
return 0
|
|
endif
|
|
let l:set_clipboard = trim(system('tmux show-options -g set-clipboard'))
|
|
return l:set_clipboard ==# 'set-clipboard on'
|
|
endfunction
|