From 359fb925b7e03d1d90b6c22938ad7380eed8acfc Mon Sep 17 00:00:00 2001 From: benmills Date: Mon, 9 Apr 2012 20:03:54 -0500 Subject: [PATCH] VimuxOrientation option to set the inital orientation of the runner pane. Fixes #5 --- README.mkd | 13 ++++++++++--- plugin/vimux.vim | 11 ++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.mkd b/README.mkd index 627f031..94a08d0 100644 --- a/README.mkd +++ b/README.mkd @@ -118,8 +118,15 @@ Set the percent height of the runner pane opened by `RunVimTmuxCommand`. let VimuxHeight = "50" ``` -## Todo +### VimuxOrientation +Set the default position of the runner pane. -The features I would like to add in the near future. +**Acceptable Values:** +`"v"` Vertical +`"h"` Horizontal -* Add the ability to target any tmux session, window and pane +**Default: `"v"`** + +```viml +let VimuxOrientation = "h" +``` diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 5e79867..f7b58b5 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -90,6 +90,14 @@ class TmuxSession end end + def orientation + if Vim.evaluate('exists("g:VimuxOrientation")') != 0 && ["h", "v"].include?(Vim.evaluate('g:VimuxOrientation')) + "-#{Vim.evaluate('g:VimuxOrientation')}" + else + "-v" + end + end + def inspect_runner _run("select-pane -t #{target(:pane => runner_pane)}") _run("copy-mode") @@ -121,7 +129,8 @@ class TmuxSession def runner_pane if @runner_pane.nil? - _run("split-window -p #{height}") + type = Vim.evaluate('exists("g:_VimTmuxInspecting")') != 0 + _run("split-window -p #{height} #{orientation}") @runner_pane = active_pane_id Vim.command("let g:_VimTmuxRunnerPane = '#{@runner_pane}'") end