Error when running commands without a runner pane
Previous behavior was to implicitly open a runner pane if none attached. I regularly ran into this in unwanted circumstances. With the recent updated to make AttachToPane smarter, an error plus quick manual attach is nearly as quick as the implicit form, but is much better overall. Closes #36 - Explicitly error when running without a pane attached
This commit is contained in:
parent
f39a860595
commit
e1749bc7fb
@ -35,9 +35,7 @@ function! s:CreateRunnerPane(...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:DetachRunnerPane()
|
function! s:DetachRunnerPane()
|
||||||
if !s:RequireRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
return
|
|
||||||
endif
|
|
||||||
call s:BreakRunnerPaneToTempWindow()
|
call s:BreakRunnerPaneToTempWindow()
|
||||||
let cmd = join(["rename-window -t", s:detached_window, g:VtrDetachedName])
|
let cmd = join(["rename-window -t", s:detached_window, g:VtrDetachedName])
|
||||||
call s:SendTmuxCommand(cmd)
|
call s:SendTmuxCommand(cmd)
|
||||||
@ -84,9 +82,7 @@ function! s:KillDetachedWindow()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:KillRunnerPane()
|
function! s:KillRunnerPane()
|
||||||
if !s:RequireLocalPaneOrDetached()
|
if !s:RequireLocalPaneOrDetached() | return | endif
|
||||||
return
|
|
||||||
endif
|
|
||||||
if exists("s:runner_pane")
|
if exists("s:runner_pane")
|
||||||
call s:KillLocalRunner()
|
call s:KillLocalRunner()
|
||||||
else
|
else
|
||||||
@ -120,13 +116,13 @@ function! s:RunnerPaneDimensions()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:FocusRunnerPane()
|
function! s:FocusRunnerPane()
|
||||||
call s:EnsureRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
call s:FocusTmuxPane(s:runner_pane)
|
call s:FocusTmuxPane(s:runner_pane)
|
||||||
call s:SendTmuxCommand("resize-pane -Z")
|
call s:SendTmuxCommand("resize-pane -Z")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ZoomRunnerPane()
|
function! s:ZoomRunnerPane()
|
||||||
call s:EnsureRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
let copy_mode_cmd = s:TargetedTmuxCommand("copy-mode", s:runner_pane)
|
let copy_mode_cmd = s:TargetedTmuxCommand("copy-mode", s:runner_pane)
|
||||||
let zoom_command = s:TargetedTmuxCommand("resize-pane -Z", s:runner_pane)
|
let zoom_command = s:TargetedTmuxCommand("resize-pane -Z", s:runner_pane)
|
||||||
call s:SendTmuxCommand(copy_mode_cmd)
|
call s:SendTmuxCommand(copy_mode_cmd)
|
||||||
@ -163,9 +159,7 @@ function! s:SendEnterSequence()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SendClearSequence()
|
function! s:SendClearSequence()
|
||||||
if !s:RequireRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
return
|
|
||||||
endif
|
|
||||||
call s:_SendKeys(g:VtrClearSequence)
|
call s:_SendKeys(g:VtrClearSequence)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -282,9 +276,7 @@ function! s:ValidRunnerPaneNumber(desired_pane)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ReattachPane()
|
function! s:ReattachPane()
|
||||||
if !s:RequireDetachedPane()
|
if !s:RequireDetachedPane() | return | endif
|
||||||
return
|
|
||||||
endif
|
|
||||||
call s:_ReattachPane()
|
call s:_ReattachPane()
|
||||||
call s:FocusVimPane()
|
call s:FocusVimPane()
|
||||||
if g:VtrClearOnReattach
|
if g:VtrClearOnReattach
|
||||||
@ -293,9 +285,7 @@ function! s:ReattachPane()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ReorientRunner()
|
function! s:ReorientRunner()
|
||||||
if !s:RequireRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
return
|
|
||||||
endif
|
|
||||||
let temp_window = s:BreakRunnerPaneToTempWindow()
|
let temp_window = s:BreakRunnerPaneToTempWindow()
|
||||||
call s:ToggleOrientationVariable()
|
call s:ToggleOrientationVariable()
|
||||||
call s:_ReattachPane()
|
call s:_ReattachPane()
|
||||||
@ -317,6 +307,7 @@ function! s:FlushCommand()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SendCommandToRunner(...)
|
function! s:SendCommandToRunner(...)
|
||||||
|
if !s:RequireRunnerPane() | return | endif
|
||||||
if exists("a:1") && a:1 != ""
|
if exists("a:1") && a:1 != ""
|
||||||
let s:user_command = shellescape(a:1)
|
let s:user_command = shellescape(a:1)
|
||||||
endif
|
endif
|
||||||
@ -329,7 +320,6 @@ function! s:SendCommandToRunner(...)
|
|||||||
call s:EchoError("VTR: command string required")
|
call s:EchoError("VTR: command string required")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call s:EnsureRunnerPane()
|
|
||||||
if g:VtrClearBeforeSend
|
if g:VtrClearBeforeSend
|
||||||
call s:SendClearSequence()
|
call s:SendClearSequence()
|
||||||
endif
|
endif
|
||||||
@ -369,7 +359,7 @@ function! s:PrepareLines(lines)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SendTextToRunner(lines)
|
function! s:SendTextToRunner(lines)
|
||||||
call s:EnsureRunnerPane()
|
if !s:RequireRunnerPane() | return | endif
|
||||||
let prepared = s:PrepareLines(a:lines)
|
let prepared = s:PrepareLines(a:lines)
|
||||||
let joined_lines = join(prepared, "\r") . "\r"
|
let joined_lines = join(prepared, "\r") . "\r"
|
||||||
let send_keys_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane)
|
let send_keys_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane)
|
||||||
@ -378,6 +368,7 @@ function! s:SendTextToRunner(lines)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SendCtrlD()
|
function! s:SendCtrlD()
|
||||||
|
if !s:RequireRunnerPane() | return | endif
|
||||||
call s:SendKeys('')
|
call s:SendKeys('')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user