diff --git a/doc/vim-tmux-runner.txt b/doc/vim-tmux-runner.txt index b391d35..65fa4cd 100644 --- a/doc/vim-tmux-runner.txt +++ b/doc/vim-tmux-runner.txt @@ -1,4 +1,4 @@ -*vim-tmux-runner.txt* For Vim version 7.3 Last change: 2012 Nov 25 +*vim-tmux-runner.txt* For Vim version 7.3 Last change: 2020 May 29 Vim Tmux Runner Vim and tmux, sittin' in a tree... @@ -20,7 +20,9 @@ CONTENTS *vtr-contents* 2.10 ............................... |VtrClearRunner| 2.11 ............................... |VtrFlushCommand| 2.12 ............................... |VtrSendCtrlD| - 2.13 ............................... |VtrSendFile| + 2.13 ............................... |VtrSendCtrlC| + 2.14 ............................... |VtrSendKeysRaw| + 2.15 ............................... |VtrSendFile| 3. Configuration ................... |VTR-Configuration| 3.1 ................................ |VtrPercentage| 3.2 ................................ |VtrOrientation| @@ -217,9 +219,24 @@ Send Ctrl-D key sequence to the runner without resetting the current command. This is useful if you are repeatedly running a script in the debugger and regularly need to kill the repl. +------------------------------------------------------------------------------ + *VtrSendCtrlC* +2.13 VtrSendCtrlC~ + +Send Ctrl-C key sequence to the runner without resetting the current command. +This is useful if you are repeatedly running a script in the debugger and +regularly need to interrupt the process. + +------------------------------------------------------------------------------ + *VtrSendKeysRaw* +2.14 VtrSendKeysRaw~ + +Send a key sequence to the runner. |VtrSendCtrlD| and |VtrSendCtrlC| wrap this +to send Ctrl-D and Ctrl-C to the runner. + ------------------------------------------------------------------------------ *VtrSendFile* -2.13 VtrSendFile~ +2.15 VtrSendFile~ Send a command to execute the current file as a script. The command will be crafted based on the filetype of the current buffer, e.g. for a file "foo.rb" diff --git a/plugin/vim-tmux-runner.vim b/plugin/vim-tmux-runner.vim index 5c90a26..fa19ffa 100644 --- a/plugin/vim-tmux-runner.vim +++ b/plugin/vim-tmux-runner.vim @@ -178,6 +178,19 @@ function! s:SendKeys(keys) call s:SendEnterSequence() endfunction +function! s:SendKeysRaw(keys) + if !s:ValidRunnerPaneSet() | return | endif + call s:_SendKeys(a:keys) +endfunction + +function! s:SendCtrlD() + call s:SendKeysRaw('') +endfunction + +function! s:SendCtrlC() + call s:SendKeysRaw('') +endfunction + function! s:SendEnterSequence() call s:_SendKeys("Enter") endfunction @@ -425,12 +438,6 @@ function! s:SendTextToRunner(lines) call s:SendTmuxCommand(targeted_cmd) endfunction -function! s:SendCtrlD() - if !s:ValidRunnerPaneSet() | return | endif - call s:SendTmuxCopyModeExit() - call s:SendKeys('') -endfunction - function! s:SendFileViaVtr(ensure_pane) let runners = s:CurrentFiletypeRunners() if has_key(runners, &filetype) @@ -480,7 +487,9 @@ function! s:DefineCommands() command! VtrClearRunner call s:SendClearSequence() command! VtrFlushCommand call s:FlushCommand() command! VtrSendCtrlD call s:SendCtrlD() - command! -bang -nargs=? -bar VtrAttachToPane call s:AttachToPane() + command! VtrSendCtrlC call s:SendCtrlC() + command! VtrAttachToPane call s:PromptForRunnerToAttach() + command! -nargs=1 VtrSendKeysRaw call s:SendKeysRaw() endfunction function! s:DefineKeymaps()