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.

4
  • 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, 2016 at 11:25
  • Both. Every time I cd in a new dir, unless I had changed manually before. Jun 28, 2016 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 section of the manual.
    – JigglyNaga
    Jun 28, 2016 at 21:10
  • I think this is what you are trying to do: Auto-update tmux status bar with active pane pwd
    – casonadams
    Jun 29, 2019 at 6:07

1 Answer 1

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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