diff --git a/plugin/vimux.vim b/plugin/vimux.vim index f345d30..650c3e9 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -71,19 +71,9 @@ function! VimuxRunCommand(command, ...) abort if exists('a:1') let l:autoreturn = a:1 endif - let l:resetSequence = VimuxOption('VimuxResetSequence') let g:VimuxLastCommand = a:command - try - call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex) - catch - let l:versionString = s:tmuxProperty('#{version}') - if str2float(l:versionString) < 3.2 - let l:resetSequence = 'q '.l:resetSequence - endif - endtry - call VimuxSendKeys(l:resetSequence) - + call s:reset() call VimuxSendText(a:command) if l:autoreturn ==# 1 call VimuxSendKeys('Enter') @@ -178,6 +168,7 @@ endfunction function! VimuxClearTerminalScreen() abort if exists('g:VimuxRunnerIndex') && s:hasRunner(g:VimuxRunnerIndex) !=# -1 + call s:reset() call VimuxSendKeys('C-l') endif endfunction @@ -217,6 +208,20 @@ function! VimuxTmux(arguments) abort endif endfunction +function! s:reset() abort + let l:resetSequence = VimuxOption('VimuxResetSequence') + + try + call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex) + catch + let l:versionString = s:tmuxProperty('#{version}') + if str2float(l:versionString) < 3.2 + let l:resetSequence = 'q '.l:resetSequence + endif + endtry + call VimuxSendKeys(l:resetSequence) +endfunction + function! s:tmuxSession() abort return s:tmuxProperty('#S') endfunction