From 506f681a7a45a5ca9a06637a0c33fc29c0304fc9 Mon Sep 17 00:00:00 2001 From: benmills Date: Wed, 29 Feb 2012 19:19:53 -0600 Subject: [PATCH] Runner panes can be interupted with InterruptVimTmuxRunner --- README.mkd | 15 +++++++++++++-- plugin/vimux.vim | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.mkd b/README.mkd index c30c356..afe788a 100644 --- a/README.mkd +++ b/README.mkd @@ -60,6 +60,16 @@ Close all other tmux panes in the current window. map rx :CloseVimTmuxWindows ``` +### InterruptVimTmuxRunner +Interrupt any command that is running inside the runner pane. + +*Example:* + +```viml +" Interrupt any command running in the runner pane +map rs :InspectVimTmuxRunner +``` + ### Full Example Code ```viml @@ -77,6 +87,9 @@ map ri :InspectVimTmuxRunner " Close all other tmux panes in current window map rx :CloseVimTmuxWindows + +" Interrupt any command running in the runner pane +map rs :InspectVimTmuxRunner ``` ## Options @@ -94,5 +107,3 @@ let VimuxHeight = "50" The features I would like to add in the near future. * Add the ability to target any tmux session, window and pane -* Implment an interupt command that stops the currently running command -* Exit copy-mode before running a command diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 1868040..fbebc64 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -5,6 +5,7 @@ end command RunLastVimTmuxCommand :call RunLastVimTmuxCommand() command CloseVimTmuxWindows :call CloseVimTmuxWindows() command InspectVimTmuxRunner :call InspectVimTmuxRunner() +command InterruptVimTmuxRunner :call InterruptVimTmuxRunner() command PromptVimTmuxCommand :call PromptVimTmuxCommand() function! RunVimTmuxCommand(command) @@ -31,6 +32,10 @@ function! CloseVimTmuxWindows() call ClearVimTmuxWindow() endfunction +function! InterruptVimTmuxRunner() + ruby CurrentTmuxSession.new.interrupt_runner +endfunction + function! InspectVimTmuxRunner() ruby CurrentTmuxSession.new.inspect_runner endfunction @@ -110,6 +115,10 @@ class TmuxSession runner_pane end + def interrupt_runner + run("send-keys -t #{target(:pane => runner_pane)} ^c") + end + def run_shell_command(command) send_command(command, target(:pane => runner_pane)) move_up_pane