From 4867db442997c8449db865258cc6d46b533c2882 Mon Sep 17 00:00:00 2001 From: benmills Date: Tue, 13 Mar 2012 08:57:14 -0500 Subject: [PATCH] Renamed CloseVimTmuxWindows to CloseVimTmuxPanes and check to make sure other windows exist before running. Fixes #2 --- README.mkd | 6 +++--- plugin/vimux.vim | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.mkd b/README.mkd index 26430d5..7832c66 100644 --- a/README.mkd +++ b/README.mkd @@ -48,12 +48,12 @@ Move into the tmux runner pane created by `RunVimTmuxCommand` and enter copy mod map ri :InspectVimTmuxRunner ``` -### CloseVimTmuxWindows +### CloseVimTmuxPanes Close all other tmux panes in the current window. ```viml " Close all other tmux panes in current window -map rx :CloseVimTmuxWindows +map rx :CloseVimTmuxPanes ``` ### InterruptVimTmuxRunner @@ -80,7 +80,7 @@ map rl :RunLastVimTmuxCommand map ri :InspectVimTmuxRunner " Close all other tmux panes in current window -map rx :CloseVimTmuxWindows +map rx :CloseVimTmuxPanes " Interrupt any command running in the runner pane map rs :InterruptVimTmuxRunner diff --git a/plugin/vimux.vim b/plugin/vimux.vim index fbebc64..9818b94 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -3,6 +3,7 @@ if !has("ruby") end command RunLastVimTmuxCommand :call RunLastVimTmuxCommand() +command CloseVimTmuxPanes :call CloseVimTmuxPanes() command CloseVimTmuxWindows :call CloseVimTmuxWindows() command InspectVimTmuxRunner :call InspectVimTmuxRunner() command InterruptVimTmuxRunner :call InterruptVimTmuxRunner() @@ -30,6 +31,12 @@ endfunction function! CloseVimTmuxWindows() ruby CurrentTmuxSession.new.close_other_panes call ClearVimTmuxWindow() + echoerr "CloseVimTmuxWindows is deprecated, use CloseVimTmuxPanes" +endfunction + +function! CloseVimTmuxPanes() + ruby CurrentTmuxSession.new.close_other_panes + call ClearVimTmuxWindow() endfunction function! InterruptVimTmuxRunner() @@ -125,7 +132,9 @@ class TmuxSession end def close_other_panes - run("kill-pane -a") + # if run("list-panes").split("\n").length > 1 + run("kill-pane -a") + # end end def move_up_pane