Skip to content

Commit

Permalink
only exit copy-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tradiff committed Sep 20, 2024
1 parent 165eb24 commit ea85852
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ function! VimuxRunCommand(command, ...) abort
if exists('a:1')
let l:autoreturn = a:1
endif
let l:resetSequence = VimuxOption('VimuxResetSequence')
let g:VimuxLastCommand = a:command

call s:reset()
call s:exitCopyMode()
call VimuxSendKeys(l:resetSequence)
call VimuxSendText(a:command)
if l:autoreturn ==# 1
call VimuxSendKeys('Enter')
Expand Down Expand Up @@ -168,7 +170,7 @@ endfunction

function! VimuxClearTerminalScreen() abort
if exists('g:VimuxRunnerIndex') && s:hasRunner(g:VimuxRunnerIndex) !=# -1
call s:reset()
call s:exitCopyMode()
call VimuxSendKeys('C-l')
endif
endfunction
Expand Down Expand Up @@ -208,18 +210,15 @@ function! VimuxTmux(arguments) abort
endif
endfunction

function! s:reset() abort
let l:resetSequence = VimuxOption('VimuxResetSequence')

function! s:exitCopyMode() abort
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
call VimuxSendKeys('q')
endif
endtry
call VimuxSendKeys(l:resetSequence)
endfunction

function! s:tmuxSession() abort
Expand Down

0 comments on commit ea85852

Please sign in to comment.