Auto sendEnterSequence with sendKeys

This commit is contained in:
Chris Toomey 2012-11-23 12:21:01 -05:00
parent fa3f90375d
commit e6a0136d8b

View File

@ -33,7 +33,6 @@ function! s:OpenRunnerPane()
call s:FocusVimPane() call s:FocusVimPane()
if g:VtrInitialCommand != "" if g:VtrInitialCommand != ""
call s:SendKeys(g:VtrInitialCommand) call s:SendKeys(g:VtrInitialCommand)
call s:SendEnterSequence()
call s:SendClearSequence() call s:SendClearSequence()
endif endif
endfunction endfunction
@ -75,13 +74,23 @@ function! s:TargetedTmuxCommand(command, target_pane)
return a:command . " -t " . a:target_pane return a:command . " -t " . a:target_pane
endfunction 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() function! s:SendEnterSequence()
call s:SendKeys("Enter") call s:_SendKeys("Enter")
endfunction endfunction
function! s:SendClearSequence() function! s:SendClearSequence()
call s:SendKeys("clear") call s:SendKeys("clear")
call s:SendEnterSequence()
sleep 50m sleep 50m
endfunction endfunction
@ -114,12 +123,6 @@ function! s:RotateRunner()
call s:FocusVimPane() call s:FocusVimPane()
endfunction 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) function! s:HighlightedInput(prompt)
echohl String | let input = shellescape(input(a:prompt)) | echohl None echohl String | let input = shellescape(input(a:prompt)) | echohl None
return input return input
@ -131,7 +134,6 @@ function! s:SendCommandToRunner()
call s:SendClearSequence() call s:SendClearSequence()
endif endif
call s:SendKeys(user_command) call s:SendKeys(user_command)
call s:SendEnterSequence()
endfunction endfunction
command! VTROpenRunner :call s:OpenRunnerPane() command! VTROpenRunner :call s:OpenRunnerPane()