I'd like to create a "focus mode" for the terminal using tmux, sort of like what goyo does for vim:

goyo screenshot

Problem 1: sizing the panes

My thinking was to achieve this by splitting the window into three panes, then setting the center pane to a fixed max value (maybe 80 columns? Maybe 100? Maybe different maxes depending on terminal window size, like responsive web layouts?) and setting the side panes to fill the remaining columns equally. I'd also like this to work on screens of varying sizes, so that I can use it on both my laptop and my desktop.

Currently, the only way I can think to do this is with cooperation from the shell (i.e., to get the terminal width with tput cols and then calculate the width needed for each pane with math operations using $(())). I'm okay with this, but if there were a built-in way to accomplish this in tmux, I'd feel really silly for missing it.

So... is there?

Problem 2: blanking the side panes

This is less crucial; it's really not so bad to see a mostly blank pane with a prompt at the top. I know that tmux has clock-mode (for instance), which overrides the contents of the panes and displays something else instead. So I'm wondering if there's a way to hide the content of an inactive pane entirely. So far, the best I can come up with is to set the fg and bg to the same color:

:select-pane -t:.1 -P 'fg=black,bg=black'

Or, the Holy Grail

This could all be accomplished much more easily if there were a facility for margins on a pane in tmux. To my knowledge, this feature does not exist, but I'm far from a tmux expert. Is there any chance it's there and I just don't know about it?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.