From c08a2663d2a94e0cc911c91fa8f0e6b743f5b533 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sun, 19 Nov 2023 15:12:10 -0800 Subject: [PATCH 1/3] Construct the command only once --- plugin/vimux.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 9d0076e..51fcbf5 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -192,11 +192,12 @@ function! VimuxPromptCommand(...) abort endfunction function! VimuxTmux(arguments) abort + let l:tmuxCommand = VimuxOption('VimuxTmuxCommand').' '.a:arguments if VimuxOption('VimuxDebug') - echom VimuxOption('VimuxTmuxCommand').' '.a:arguments + echom l:tmuxCommand endif if has_key(environ(), 'TMUX') - return system(VimuxOption('VimuxTmuxCommand').' '.a:arguments) + return system(l:tmuxCommand) else throw 'Aborting, because not inside tmux session.' endif From 5a7f37b43eaa5be7a5e90c56d48dbbae0a0f7337 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sun, 19 Nov 2023 15:16:52 -0800 Subject: [PATCH 2/3] Add docs about VimuxDebug --- doc/vimux.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/vimux.txt b/doc/vimux.txt index 8ab6ad3..3936164 100644 --- a/doc/vimux.txt +++ b/doc/vimux.txt @@ -469,5 +469,16 @@ runner is created instead, positioned according to `VimuxOrientation`. < Default: {} +------------------------------------------------------------------------------ + *VimuxDebug* +4.13 g:VimuxDebug~ + +If you're having trouble with vimux, set this option to get vimux to pass each +tmux command to |echomsg| before running it. +> + let g:VimuxDebug = v:true +< +Default: v:false + ============================================================================== vim:tw=78:ts=2:sw=2:expandtab:ft=help:norl: From dac3388a4c344bddc080c0886a2ee13994307555 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sun, 19 Nov 2023 15:28:38 -0800 Subject: [PATCH 3/3] Throw error if system call fails --- plugin/vimux.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 51fcbf5..3f72ac1 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -197,7 +197,11 @@ function! VimuxTmux(arguments) abort echom l:tmuxCommand endif if has_key(environ(), 'TMUX') - return system(l:tmuxCommand) + let l:output = system(l:tmuxCommand) + if v:shell_error + throw 'Tmux command failed with message:' . l:output + endif + return l:output else throw 'Aborting, because not inside tmux session.' endif