Permalink
Browse files

Merge pull request #15 from antonishen/master

Fix: runner path issue, handle tmux not running. Fixes #13
  • Loading branch information...
2 parents f0bdd95 + de99c54 commit 252693ec5750ac50d8b60e6cc44e10b83fb68bac @benmills committed Apr 15, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 plugin/vimux.vim
View
@@ -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
@@ -189,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)
@@ -205,5 +210,9 @@ class CurrentTmuxSession < TmuxSession
def get_session
_run("display -p '#S'").strip
end
+
+ def tmux?
+ `echo $TMUX` =~ /.+/ ? true : false
+ end
end
EOF

0 comments on commit 252693e

Please sign in to comment.