From 028897b6fb4882ded8f1ec6b27774e2ff2f6ce56 Mon Sep 17 00:00:00 2001 From: Michael van der Kamp Date: Sat, 5 Jun 2021 17:45:04 -0600 Subject: [PATCH] Allow resetting the VimuxCloseOnExit option Instead of paying attention to the value when starting up, check the option's value at close. --- plugin/vimux.vim | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index e237a17..0737d74 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -41,12 +41,10 @@ command -bar VimuxClearTerminalScreen :call VimuxClearTerminalScreen() command -bar VimuxClearRunnerHistory :call VimuxClearRunnerHistory() command -bar VimuxTogglePane :call VimuxTogglePane() -if VimuxOption('VimuxCloseOnExit') - augroup VimuxAutocloseCommands - au! - autocmd VimLeave * call VimuxCloseRunner() - augroup END -endif +augroup VimuxAutocmds + au! + autocmd VimLeave * call s:autoclose() +augroup END function! VimuxRunCommandInDir(command, useFile) abort let l:file = '' @@ -270,3 +268,9 @@ function! s:hasRunner(index) abort let t = VimuxOption('VimuxRunnerType') return match(VimuxTmux('list-'.t."s -F '#{".t."_id}'"), a:index) endfunction + +function! s:autoclose() abort + if VimuxOption('VimuxCloseOnExit') + call VimuxCloseRunner() + endif +endfunction