From 1f3d65e326562bee13e9ff44caad589d0b3e507e Mon Sep 17 00:00:00 2001 From: "navid.sassan" Date: Fri, 14 Aug 2020 15:21:39 +0200 Subject: [PATCH] added VtrSetCommand function --- plugin/vim-tmux-runner.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugin/vim-tmux-runner.vim b/plugin/vim-tmux-runner.vim index 1f9c6b4..884cf38 100644 --- a/plugin/vim-tmux-runner.vim +++ b/plugin/vim-tmux-runner.vim @@ -362,6 +362,20 @@ function! s:FlushCommand() endif endfunction +function! s:SetCommand(...) + if exists("a:1") && a:1 != "" + let s:user_command = shellescape(a:1) + return + endif + let s:user_command = s:HighlightedPrompt(g:VtrPrompt) + let escaped_empty_string = "''" + if s:user_command == escaped_empty_string + unlet s:user_command + call s:EchoError("command string required") + return + endif +endfunction + function! s:SendTmuxCopyModeExit() let l:session = s:TmuxInfo('session_name') let l:win = s:TmuxInfo('window_index') @@ -485,6 +499,7 @@ function! s:DefineCommands() command! VtrReattachRunner call s:ReattachPane() command! VtrClearRunner call s:SendClearSequence() command! VtrFlushCommand call s:FlushCommand() + command! -nargs=? VtrSetCommand call s:SetCommand() command! VtrSendCtrlD call s:SendCtrlD() command! VtrSendCtrlC call s:SendCtrlC() command! -bang -nargs=? -bar VtrAttachToPane call s:AttachToPane() @@ -530,6 +545,6 @@ endfunction call s:InitializeVariables() call s:DefineCommands() -call s:DefineKeymaps() +" call s:DefineKeymaps() " vim: set fdm=marker