From e6a0136d8b60b26db55400e585b5c3f7fad6a6d2 Mon Sep 17 00:00:00 2001 From: Chris Toomey Date: Fri, 23 Nov 2012 12:21:01 -0500 Subject: [PATCH] Auto sendEnterSequence with sendKeys --- plugin/vim-tmux-runner.vim | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugin/vim-tmux-runner.vim b/plugin/vim-tmux-runner.vim index 8c600b1..f8f2099 100644 --- a/plugin/vim-tmux-runner.vim +++ b/plugin/vim-tmux-runner.vim @@ -33,7 +33,6 @@ function! s:OpenRunnerPane() call s:FocusVimPane() if g:VtrInitialCommand != "" call s:SendKeys(g:VtrInitialCommand) - call s:SendEnterSequence() call s:SendClearSequence() endif endfunction @@ -75,13 +74,23 @@ function! s:TargetedTmuxCommand(command, target_pane) return a:command . " -t " . a:target_pane endfunction +function! s:_SendKeys(keys) + let targeted_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane) + let full_command = join([targeted_cmd, a:keys]) + call s:SendTmuxCommand(full_command) +endfunction + +function! s:SendKeys(keys) + call s:_SendKeys(a:keys) + call s:SendEnterSequence() +endfunction + function! s:SendEnterSequence() - call s:SendKeys("Enter") + call s:_SendKeys("Enter") endfunction function! s:SendClearSequence() call s:SendKeys("clear") - call s:SendEnterSequence() sleep 50m endfunction @@ -114,12 +123,6 @@ function! s:RotateRunner() call s:FocusVimPane() endfunction -function! s:SendKeys(keys) - let targeted_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane) - let full_command = join([targeted_cmd, a:keys]) - call s:SendTmuxCommand(full_command) -endfunction - function! s:HighlightedInput(prompt) echohl String | let input = shellescape(input(a:prompt)) | echohl None return input @@ -131,7 +134,6 @@ function! s:SendCommandToRunner() call s:SendClearSequence() endif call s:SendKeys(user_command) - call s:SendEnterSequence() endfunction command! VTROpenRunner :call s:OpenRunnerPane()