diff --git a/plugin/vimux.vim b/plugin/vimux.vim index bd1f247..23c94f3 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -15,6 +15,7 @@ let g:VimuxRunnerType = get(g:, 'VimuxRunnerType', 'pane') let g:VimuxTmuxCommand = get(g:, 'VimuxTmuxCommand', 'tmux') let g:VimuxUseNearest = get(g:, 'VimuxUseNearest', v:true) let g:VimuxExpandCommand = get(g:, 'VimuxExpandCommand', v:false) +let g:VimuxCloseOnExit = get(g:, 'VimuxCloseOnExit', v:false) function! VimuxOption(name) abort return get(b:, a:name, get(g:, a:name)) @@ -39,6 +40,13 @@ 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 + function! VimuxRunCommandInDir(command, useFile) let l:file = '' if a:useFile ==# 1