7

I have tmux configured to show my current working directory for each window (it gets this from bash) The problem is, sometimes the directory names get too long and it takes up a lot of space. In screen, this size used to be limited for the "non-active" windows, but in tmux it is expanded for everything.

Is there a way to limit the size of the title?

9

You can probably adjust the window options window-status-format and window-status-current-format to get your desired effect.

Both of those options have the same default value (#I:#W#F: window index, a colon, window name, and window flags), so they are displayed identically by default. You could limit the length of the displayed window name of inactive windows by setting window-status-format to something like #I:#10W#F (this “maximum length” is described in the man page, under status-left).

So, in your ~/.tmux.conf, you might use this:

set-option -gw window-status-format "#I:#10W#F" # limit the length of inactive window name

Note: The above example adjusts the global value, but each window can have its own custom values since these are window options. If you end up with a some particular window that you always want to be displayed in full, then you can (re)set just that window’s window-status-format value.

  • As far as I know, the #10W will not works with tmux 2.1, only the #W – andras.tim Aug 12 '16 at 12:45
  • 3
    @andras.tim: The syntax for #10W in newer tmux versions is '#{=10:window_name}' – Chris Johnsen Aug 13 '16 at 8:42

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.

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