From 076e13b77cede04cf697a44cb5e91c816e87d409 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sat, 17 Sep 2022 10:21:05 -0700 Subject: [PATCH 1/2] Directly return empty string when not using existing runner - This should have been happening anyway due to a later conditional, but may not if tmux changed its behaviour. --- plugin/vimux.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 04d1884..324681a 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -235,7 +235,9 @@ function! s:existingRunnerId() abort let runnerType = VimuxOption('VimuxRunnerType') let query = get(VimuxOption('VimuxRunnerQuery'), runnerType, '') if empty(query) - if !empty(VimuxOption('VimuxUseNearest')) + if empty(VimuxOption('VimuxUseNearest')) + return '' + else return s:nearestRunnerId() endif endif From 2344b96fed6350832b7b2534cb28eb837fbfcaa0 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sat, 17 Sep 2022 10:23:56 -0700 Subject: [PATCH 2/2] Add a guard against queries matching current pane --- plugin/vimux.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 324681a..9d0076e 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -242,12 +242,17 @@ function! s:existingRunnerId() abort endif endif " Try finding the runner using the provided query + let currentId = s:tmuxIndex() let message = VimuxTmux('select-'.runnerType.' -t '.query.'') if message ==# '' - " Success! + " A match was found. Make sure it isn't the current vim pane/window + " though! let runnerId = s:tmuxIndex() - call VimuxTmux('last-'.runnerType) - return runnerId + if runnerId !=# currentId + " Success! + call VimuxTmux('last-'.runnerType) + return runnerId + endif endif return '' endfunction