I would like to have tmux to automatically rename the window with the current working directory (cwd). As it is by default, it names the tab/window as the name of the current process, such as zsh or vim.
When I open a new window in tmux, the name is reattach-to-use-namespace
and then it immediately switches to zsh
.
I'm on OS X 10.10.2, I use zshell, and I have tmux 1.9a.
To be clear, I don't want the entire path in the name of the window, just the current directory, so for example, I want projectName
, not /Users/username/Development/projectName
.
If you want to see my current tmux.conf
, here it is.
With tmux 2.3+, the b:
format modifier shows the "basename" (or "tail") of a path.
set-option -g status-interval 5 set-option -g automatic-rename on set-option -g automatic-rename-format '#{b:pane_current_path}'
The FORMATS section of man tmux
describes other modifiers, such as #{d:}
and even #{s/foo/bar/:}
.
With tmux 2.2 or older, the basename
shell command can be used instead.
set-option -g status-interval 5 set-option -g automatic-rename on set-option -g automatic-rename-format '#(basename "#{pane_current_path}")'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With