在tmuxinator项目中指定窗格百分比


95

如何在tmuxinator中指定窗格百分比?

例如:

 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

例如:vim窗格将占据75%的屏幕...可以指定此方法吗?还是应该在文档中查找?似乎在任何地方都找不到。

Answers:


196

布局应layout:在行中指定。但是,您不限于五个预设布局(例如,主-垂直)。从手册页

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.

首先根据自己的喜好设置布局-可以调整宽度,resize-pane直到恰好适合您。然后运行tmux list-windows。然后您应该能够使用layout:tmuxinator.conf中未更改的输出行

因此,根据您的要旨输出:

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

tmuxinator conf文件的相关部分应为:

  - 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

tmux list-windows给了我以下输出(gist.github.com/2324001)。根据该输出,tmuxinator布局线的外观如何?
Goles 2012年

3
我一开始不了解如何运行命令tmux list-windows。然后我意识到这很明显。1)在您的tmux会话之外(分离或打开新的控制台窗口),像其他任何shell命令一样运行命令。2)PREFIX :在tmux中进入命令模式(),并使用命令list-windows
caspyin 2014年

2
我认为应该在答案中明确指出,list-panes应在该panes:部分下指定该命令列出的相同窗格数。例如,如果定义了6个窗格panes:,则即使它们仅包含,也应在下方显示6行-(说在此窗格中什么也不做)。否则,窗口将无法按照list-panes输出说明正确格式化。
詹姆斯·麦考马克

1
某些人可能会发现此命令在仅打印布局部分的脚本中很有用:tmux list-windows | sed -n 's/.*layout \(.*\)] @.*/\1/p'
Nathanael
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.