From 62ded6f2810eddaf228569e1c5464956e265e72c Mon Sep 17 00:00:00 2001 From: Joshua Antonishen Date: Sun, 15 Apr 2012 02:06:21 -0400 Subject: [PATCH 1/2] ensure new panes are in the correct directory --- plugin/vimux.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 1e99183..8d93641 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -137,6 +137,7 @@ class TmuxSession _run("split-window -p #{height} #{orientation}") end @runner_pane = active_pane_id + _send_command("cd #{`pwd`}", target(:pane => runner_pane)) Vim.command("let g:_VimTmuxRunnerPane = '#{@runner_pane}'") end From de99c54046fb2d8d8d3a54aab483784622a7748f Mon Sep 17 00:00:00 2001 From: Joshua Antonishen Date: Sun, 15 Apr 2012 02:07:03 -0400 Subject: [PATCH 2/2] don't explode if you aren't in a tmux session --- plugin/vimux.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 8d93641..99f6519 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -190,11 +190,15 @@ end class CurrentTmuxSession < TmuxSession def initialize - session = self.get_session - window = self.get_property(:active, :window) - pane = self.get_property(:active, :pane) + if tmux? + session = self.get_session + window = self.get_property(:active, :window) + pane = self.get_property(:active, :pane) - super(session, window, pane) + super(session, window, pane) + else + raise "You are not in a tmux session" + end end def get_property(match, type) @@ -206,5 +210,9 @@ class CurrentTmuxSession < TmuxSession def get_session _run("display -p '#S'").strip end + + def tmux? + `echo $TMUX` =~ /.+/ ? true : false + end end EOF