Skip to content

Commit

Permalink
Use copy-mode -q to leave copy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanderkamp committed Aug 27, 2024
1 parent b110cd9 commit 49eaa8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions doc/vimux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,17 @@ Default: 1
*VimuxConfiguration_reset_sequence*
4.4 g:VimuxResetSequence~

The keys sent to the runner pane before running a command. By default it sends
`q` to make sure the pane is not in scroll-mode and `C-u` to clear the line.
The keys sent to the runner pane before running a command.

When vimux runs a tmux command, it first makes sure that the runner is not in
copy mode by running `copy-mode -q` on the runner. This sequence is then sent
to make sure that the runner is ready to receive input.

The default sends `C-u` to clear the line.
>
let g:VimuxResetSequence = ""
<
Default: "q C-u"
Default: "C-u"

------------------------------------------------------------------------------
*VimuxPromptString*
Expand Down
3 changes: 2 additions & 1 deletion plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let g:VimuxHeight = get(g:, 'VimuxHeight', '20%')
let g:VimuxOpenExtraArgs = get(g:, 'VimuxOpenExtraArgs', '')
let g:VimuxOrientation = get(g:, 'VimuxOrientation', 'v')
let g:VimuxPromptString = get(g:, 'VimuxPromptString', 'Command? ')
let g:VimuxResetSequence = get(g:, 'VimuxResetSequence', 'q C-u')
let g:VimuxResetSequence = get(g:, 'VimuxResetSequence', 'C-u')
let g:VimuxRunnerName = get(g:, 'VimuxRunnerName', '')
let g:VimuxRunnerType = get(g:, 'VimuxRunnerType', 'pane')
let g:VimuxRunnerQuery = get(g:, 'VimuxRunnerQuery', {})
Expand Down Expand Up @@ -73,6 +73,7 @@ function! VimuxRunCommand(command, ...) abort
endif
let resetSequence = VimuxOption('VimuxResetSequence')
let g:VimuxLastCommand = a:command
call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex)
call VimuxSendKeys(resetSequence)
call VimuxSendText(a:command)
if l:autoreturn ==# 1
Expand Down

0 comments on commit 49eaa8d

Please sign in to comment.