110

How can I specify a pane percentage in tmuxinator ?

Eg:

 project_name: ad_dev
 project_root: ~/Programming/WWW/Rails/projects/ApparelDreamDev
 rvm: ruby-1.9.2-p290@apparel_dev
 pre: SQL
 tabs:
   - editor:
       layout: main-vertical
       panes:
         - vim 75%  
         - #empty, will just run plain bash
         - top

eg: the vim pane would take 75% of the screen... is there a way to specify this ? or where in the documentation should I look ? Can't seem to find it anywhere.

1
  • If it is okay to change it for all layouts and tmuxinator configs, there is a tmux option main-pane-width which supports percentages.
    – nyi
    Commented Sep 6, 2022 at 8:25

1 Answer 1

222

The layout should be specified in the layout: line. But you are not limited to the five preset layouts (such as main-vertical). From the man page:

In addition, select-layout may be used to apply a previously used layout - 
the list-windows command displays the layout of each window in a form 
suitable for use with select-layout.  For example:

       $ tmux list-windows
       0: ksh [159x48]
           layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
       $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}

 tmux automatically adjusts the size of the layout for the current window
 size.  Note that a layout cannot be applied to a window with more panes
 than that from which the layout was originally defined.

First set up your layout just how you like it - you can adjust widths with resize-pane until it is just right for you. Then run tmux list-windows. And then you should be able to use the layout: line from the output unaltered in tmuxinator.conf

So based on the output from your gist:

0: tmux [208x73] [layout b147,208x73,0,0[208x62,0,0,208x10,0,63{104x10,0,63,103x10,105,63}]] (active)

The relevant section of the tmuxinator conf file should be:

  - editor:
       layout: b147,208x73,0,0[208x62,0,0,208x10,0,63{104x10,0,63,103x10,105,63}]
       panes:
         - vim
         - #empty, will just run plain bash
         - top
5
  • tmux list-windows gave me the following output ( gist.github.com/2324001 ). How would the tmuxinator layout line look according to that output ?
    – Goles
    Commented Apr 6, 2012 at 23:38
  • 6
    I didn't understand how to run the command tmux list-windows at first. Then I realized it was obvious. 1) Outside of your tmux session (detach or open a new console window) run the command like any other shell command. 2) Enter command mode (PREFIX :) within tmux and use the command list-windows
    – BeeZee
    Commented Mar 22, 2014 at 14:16
  • 3
    I think it should be made clear in the answer that the same number of panes listed by the list-panes command should be specified under the panes: section. For example, if 6 panes are defined 6 lines should appear under panes:, even if they only contain a - (saying do nothing in this pane). If not the window will not be formatted correctly as described by list-panes output. Commented Mar 15, 2017 at 10:34
  • 3
    Some may find this command useful in scripts to just print the layout portion: tmux list-windows | sed -n 's/.*layout \(.*\)] @.*/\1/p'
    – N7L
    Commented Jun 6, 2018 at 11:10
  • I think nowadays (tmux 3.2) you need to have parentheses around the layout.
    – Jonathan
    Commented Oct 22, 2023 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.