|
|
@ -7,25 +7,47 @@ if !has("ruby")
|
|
|
|
finish
|
|
|
|
finish
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
command RunLastVimTmuxCommand :call RunLastVimTmuxCommand()
|
|
|
|
|
|
|
|
command CloseVimTmuxRunner :call CloseVimTmuxRunner()
|
|
|
|
|
|
|
|
command CloseVimTmuxPanes :call CloseVimTmuxPanes()
|
|
|
|
|
|
|
|
command CloseVimTmuxWindows :call CloseVimTmuxWindows()
|
|
|
|
|
|
|
|
command InspectVimTmuxRunner :call InspectVimTmuxRunner()
|
|
|
|
|
|
|
|
command InterruptVimTmuxRunner :call InterruptVimTmuxRunner()
|
|
|
|
|
|
|
|
command PromptVimTmuxCommand :call PromptVimTmuxCommand()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" New style commands with 'normalized' names
|
|
|
|
|
|
|
|
command VimuxRunLastCommand :call VimuxRunLastCommand()
|
|
|
|
|
|
|
|
command VimuxCloseRunner :call VimuxCloseRunner()
|
|
|
|
|
|
|
|
command VimuxClosePanes :call VimuxClosePanes()
|
|
|
|
|
|
|
|
command VimuxCloseWindows :call VimuxCloseWindows()
|
|
|
|
|
|
|
|
command VimuxInspectRunner :call VimuxInspectRunner()
|
|
|
|
|
|
|
|
command VimuxInterruptRunner :call VimuxInterruptRunner()
|
|
|
|
|
|
|
|
command VimuxPromptCommand :call VimuxPromptCommand()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" DEPRECATED
|
|
|
|
|
|
|
|
command RunLastVimTmuxCommand :call VimuxRunLastCommand()
|
|
|
|
|
|
|
|
command CloseVimTmuxRunner :call VimuxCloseRunner()
|
|
|
|
|
|
|
|
command CloseVimTmuxPanes :call VimuxClosePanes()
|
|
|
|
|
|
|
|
command CloseVimTmuxWindows :call VimuxCloseWindows()
|
|
|
|
|
|
|
|
command InspectVimTmuxRunner :call VimuxInspectRunner()
|
|
|
|
|
|
|
|
command InterruptVimTmuxRunner :call VimuxInterruptRunner()
|
|
|
|
|
|
|
|
command PromptVimTmuxCommand :call VimuxPromptCommand()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" new style functions
|
|
|
|
|
|
|
|
function VimuxRunCommand(command, ...)
|
|
|
|
|
|
|
|
let l:autoreturn = 1
|
|
|
|
|
|
|
|
|
|
|
|
command VimuxRunLastCommand :call RunLastVimTmuxCommand()
|
|
|
|
if exists("a:1")
|
|
|
|
command VimuxCloseRunner :call CloseVimTmuxRunner()
|
|
|
|
let l:autoreturn = a:1
|
|
|
|
command VimuxClosePanes :call CloseVimTmuxPanes()
|
|
|
|
endif
|
|
|
|
command VimuxCloseWindows :call CloseVimTmuxWindows()
|
|
|
|
|
|
|
|
command VimuxInspectRunner :call InspectVimTmuxRunner()
|
|
|
|
|
|
|
|
command VimuxInterruptRunner :call InterruptVimTmuxRunner()
|
|
|
|
|
|
|
|
command VimuxPromptCommand :call PromptVimTmuxCommand()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let g:_VimTmuxCmd = a:command
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if l:autoreturn == 1
|
|
|
|
|
|
|
|
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"), false)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" deprecated!
|
|
|
|
function RunVimTmuxCommand(command, ...)
|
|
|
|
function RunVimTmuxCommand(command, ...)
|
|
|
|
|
|
|
|
" TODO replace me with the direct function call!
|
|
|
|
|
|
|
|
echoerr "RunVimTmuxCommand is deprecated, use VimuxRunCommand instead."
|
|
|
|
let l:autoreturn = 1
|
|
|
|
let l:autoreturn = 1
|
|
|
|
|
|
|
|
|
|
|
|
if exists("a:1")
|
|
|
|
if exists("a:1")
|
|
|
@ -41,7 +63,8 @@ function RunVimTmuxCommand(command, ...)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function RunLastVimTmuxCommand()
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxRunLastCommand()
|
|
|
|
if exists("g:_VimTmuxCmd")
|
|
|
|
if exists("g:_VimTmuxCmd")
|
|
|
|
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
|
|
|
|
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -49,41 +72,97 @@ function RunLastVimTmuxCommand()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function ClearVimTmuxWindow()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function RunLastVimTmuxCommand()
|
|
|
|
|
|
|
|
echoerr "RunLastVimTmuxCommand is deprecated, use VimuxRunLastCommand instead."
|
|
|
|
|
|
|
|
call VimuxRunLastCommand()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxClearWindow()
|
|
|
|
if exists("g:_VimTmuxRunnerPane")
|
|
|
|
if exists("g:_VimTmuxRunnerPane")
|
|
|
|
unlet g:_VimTmuxRunnerPane
|
|
|
|
unlet g:_VimTmuxRunnerPane
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function CloseVimTmuxWindows()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function ClearVimTmuxWindow()
|
|
|
|
|
|
|
|
echoerr "ClearVimTmuxWindow is deprecated, use VimuxClearWindow instead."
|
|
|
|
|
|
|
|
call VimuxClearWindow()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxCloseWindows()
|
|
|
|
ruby CurrentTmuxSession.new.close_other_panes
|
|
|
|
ruby CurrentTmuxSession.new.close_other_panes
|
|
|
|
call ClearVimTmuxWindow()
|
|
|
|
call VimuxClearWindow()
|
|
|
|
echoerr "CloseVimTmuxWindows is deprecated, use CloseVimTmuxPanes"
|
|
|
|
echoerr "CloseVimTmuxWindows is deprecated, use VimuxClosePanes instead."
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function CloseVimTmuxRunner()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function CloseVimTmuxWindows()
|
|
|
|
|
|
|
|
echoerr "ClearVimTmuxWindow is deprecated, use VimuxClosePanes instead."
|
|
|
|
|
|
|
|
call VimuxCloseWindows()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxCloseRunner()
|
|
|
|
ruby CurrentTmuxSession.new.close_runner_pane
|
|
|
|
ruby CurrentTmuxSession.new.close_runner_pane
|
|
|
|
call ClearVimTmuxWindow()
|
|
|
|
call VimuxClearWindow()
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function CloseVimTmuxPanes()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function CloseVimTmuxRunner()
|
|
|
|
|
|
|
|
echoerr "CloseVimTmuxRunner is deprecated, use VimuxCloseRunner instead."
|
|
|
|
|
|
|
|
call VimuxCloseRunner()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxClosePanes()
|
|
|
|
ruby CurrentTmuxSession.new.close_other_panes
|
|
|
|
ruby CurrentTmuxSession.new.close_other_panes
|
|
|
|
call ClearVimTmuxWindow()
|
|
|
|
call VimuxClearWindow()
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function InterruptVimTmuxRunner()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function CloseVimTmuxPanes()
|
|
|
|
|
|
|
|
echoerr "CloseVimTmuxPanes is deprecated, use VimuxClosePanes instead."
|
|
|
|
|
|
|
|
call VimuxClosePanes()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxInterruptRunner()
|
|
|
|
ruby CurrentTmuxSession.new.interrupt_runner
|
|
|
|
ruby CurrentTmuxSession.new.interrupt_runner
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function InspectVimTmuxRunner()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function InterruptVimTmuxRunner()
|
|
|
|
|
|
|
|
echoerr "InterruptVimTmuxRunner is deprecated, use VimuxInterruptRunner instead."
|
|
|
|
|
|
|
|
call VimuxInterruptRunner()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxInspectRunner()
|
|
|
|
ruby CurrentTmuxSession.new.inspect_runner
|
|
|
|
ruby CurrentTmuxSession.new.inspect_runner
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function PromptVimTmuxCommand()
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function InspectVimTmuxRunner()
|
|
|
|
|
|
|
|
echoerr "InspectVimTmuxRunner is deprecated, use VimuxInspectRunner instead."
|
|
|
|
|
|
|
|
call VimuxInspectRunner()
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function VimuxPromptCommand()
|
|
|
|
let l:command = input("Command? ")
|
|
|
|
let l:command = input("Command? ")
|
|
|
|
call RunVimTmuxCommand(l:command)
|
|
|
|
call VimuxRunCommand(l:command)
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" deprecated!
|
|
|
|
|
|
|
|
function PromptVimTmuxCommand()
|
|
|
|
|
|
|
|
echoerr "PromptVimTmuxCommand is deprecated, use VimuxPromptCommand instead."
|
|
|
|
|
|
|
|
call VimuxPromptCommand()
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ruby << EOF
|
|
|
|
ruby << EOF
|
|
|
|
class TmuxSession
|
|
|
|
class TmuxSession
|
|
|
|
def initialize(session, window, pane)
|
|
|
|
def initialize(session, window, pane)
|
|
|
|