10

By default, tmux sets the current pane title as the active command (ex:vim), even if allow-rename is off.

I want to change it to current folder name (basename $PWD).

Note that I do not want to dynamically change window name, since I sometimes use rename-window to set a custom name. In this case, the custom window name must persist.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
paulodiovani
  • 271
  • 3
  • 8
  • Please clarify - when/how often do you want to change the pane title to the current folder name? Only when you specifically request it (with a shortcut/key-binding/command)? Or automatically, every time you `cd`? – JigglyNaga Jun 28 '16 at 11:25
  • Both. Every time I `cd` in a new dir, unless I had changed manually before. – paulodiovani Jun 28 '16 at 21:00
  • I thought it was the window name you wanted to change manually? The window name and pane title can be set independently of each other, using different escape sequences - see the [Names and Titles](http://man7.org/linux/man-pages/man1/tmux.1.html#NAMES_AND%20TITLES) section of the manual. – JigglyNaga Jun 28 '16 at 21:10
  • I think this is what you are trying to do: [Auto-update tmux status bar with active pane pwd](https://stackoverflow.com/questions/19200589/auto-update-tmux-status-bar-with-active-pane-pwd/56653295#56653295) – casonadams Jun 29 '19 at 06:07

1 Answers1

3

I do this by setting the title using an echo command and having it executed in the PROMPT_COMMAND environment variable. This comes up as a common question in other environments. Here's really good information on it.

Set dynamic window title based on command input

Joshua K
  • 868
  • 6
  • 8