From fca0e86eb9b36ddeab53865a6fef3c368db99da8 Mon Sep 17 00:00:00 2001 From: Rae Kim Date: Thu, 19 Nov 2020 19:08:17 +0900 Subject: [PATCH] tmux/screen check fix Original first if condition always return true because of default argument is "tmux" --- plugin/osc52.vim | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/plugin/osc52.vim b/plugin/osc52.vim index e975873..ac40ba5 100644 --- a/plugin/osc52.vim +++ b/plugin/osc52.vim @@ -29,16 +29,25 @@ let g:max_osc52_sequence=100000 " Sends a string to the terminal's clipboard using the OSC 52 sequence. function! SendViaOSC52(str) - if get(g:, 'osc52_term', 'tmux') == 'tmux' - let osc52 = s:get_OSC52_tmux(a:str) - elseif get(g:, 'osc52_term', 'tmux') == 'screen' - let osc52 = s:get_OSC52_DCS(a:str) - elseif !empty($TMUX) - let osc52 = s:get_OSC52_tmux(a:str) - elseif match($TERM, 'screen') > -1 - let osc52 = s:get_OSC52_DCS(a:str) - else - let osc52 = s:get_OSC52(a:str) + " If g:osc52_term is explicitly set use it + if exists('g:osc52_term') + if get(g:, 'osc52_term') == 'tmux' + let osc52 = s:get_OSC52_tmux(a:str) + elseif get(g:, 'osc52_term') == 'screen' + let osc52 = s:get_OSC52_DCS(a:str) + endif + endif + + " If g:osc52_term is not set or set to unsupported value, fallback to + " auto-detection. + if !exists('l:osc52') + if !empty($TMUX) + let osc52 = s:get_OSC52_tmux(a:str) + elseif match($TERM, 'screen') > -1 + let osc52 = s:get_OSC52_DCS(a:str) + else + let osc52 = s:get_OSC52(a:str) + endif endif let len = strlen(osc52)