Skip to content

Instantly share code, notes, and snippets.

@dgoodlad
Created December 8, 2010 22:57
Show Gist options
  • Save dgoodlad/734082 to your computer and use it in GitHub Desktop.
Save dgoodlad/734082 to your computer and use it in GitHub Desktop.
diff --git a/cmd-set-option.c b/cmd-set-option.c
index e561d03..65d6782 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -155,6 +155,7 @@ const struct set_option_entry set_window_option_table[] = {
{ "mode-mouse", SET_OPTION_FLAG, 0, 0, NULL },
{ "monitor-activity", SET_OPTION_FLAG, 0, 0, NULL },
{ "monitor-content", SET_OPTION_STRING, 0, 0, NULL },
+ { "other-pane-width", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL },
{ "synchronize-panes", SET_OPTION_FLAG, 0, 0, NULL },
{ "utf8", SET_OPTION_FLAG, 0, 0, NULL },
diff --git a/layout-set.c b/layout-set.c
index 8c46d98..e812855 100644
--- a/layout-set.c
+++ b/layout-set.c
@@ -344,7 +344,7 @@ layout_set_main_v(struct window *w)
{
struct window_pane *wp;
struct layout_cell *lc, *lcmain, *lccolumn, *lcchild;
- u_int n, mainwidth, width, height, used;
+ u_int n, mainwidth, otherwidth, width, height, used;
u_int i, j, columns, rows, totalcolumns;
layout_print_cell(w->layout_root, __func__, 1);
@@ -365,6 +365,12 @@ layout_set_main_v(struct window *w)
/* Get the main pane width and add one for separator line. */
mainwidth = options_get_number(&w->options, "main-pane-width") + 1;
+ /* Get the optional 'other' pane width and add one for separator line. */
+ otherwidth = options_get_number(&w->options, "other-pane-width") + 1;
+ /* If an 'other' pane width was specified, honour it so long as it doesn't
+ * shrink the main width to less than the main-pane-width */
+ if (otherwidth > 1 && w->sx - otherwidth > mainwidth)
+ mainwidth = w->sx - otherwidth;
if (mainwidth < PANE_MINIMUM + 1)
mainwidth = PANE_MINIMUM + 1;
diff --git a/tmux.1 b/tmux.1
index 59eaac7..3a0acc6 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2141,6 +2141,18 @@ pattern
.Ar match-string
appears in the window, it is highlighted in the status line.
.Pp
+.It Ic other-pane-width Ar width
+Set the width of the other, non-main panes in the
+.Ic main-vertical
+layout.
+If this option is set to 0 (the default), it will have no effect.
+If both the
+.Ic main-pane-width
+and
+.Ic other-pane-width
+options are set, the main pane will grow wider to make the other panes the
+specified width, but will never shrink to do so.
+.Pp
.It Xo Ic remain-on-exit
.Op Ic on | off
.Xc
diff --git a/tmux.c b/tmux.c
index 159f809..ff994fb 100644
--- a/tmux.c
+++ b/tmux.c
@@ -414,6 +414,7 @@ main(int argc, char **argv)
options_set_number(wo, "mode-mouse", 0);
options_set_number(wo, "monitor-activity", 0);
options_set_string(wo, "monitor-content", "%s", "");
+ options_set_number(wo, "other-pane-width", 0);
options_set_number(wo, "window-status-attr", 0);
options_set_number(wo, "window-status-bg", 8);
options_set_number(wo, "window-status-current-attr", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment