TMUX: Configure length of titles
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?
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.