7 years too late I found my way here. I'm sure I won't be the only one 
finding this thread in their search engine, so I'll leave the answer. This 
works for current tmux as of 2023.

set-option -g automatic-rename-format 
'#{?#{==:#{pane_current_command},bash},#{=-20:pane_current_path},#{pane_current_command}}'

If the command is bash (we're at the prompt) then use the last 20 
characters of the path (so "window titles too long" isn't a problem), 
otherwise use the command we're running.
I decided I'd like to see a little of the path with the command name 
(command names tend to be fairly short, so there's room, so I'm actually 
using

set-option -g automatic-rename-format 
'#{?#{==:#{pane_current_command},bash},#{=-20:pane_current_path},#{=-7:pane_current_path}>
 
#{pane_current_command}}'

Hope this helps.
On Wednesday, March 16, 2016 at 10:34:00 PM UTC+11 Thomas Sattler wrote:

> To have this working in "current stable" tmux-2.1 use this:
>
> #(test "#{pane_current_command}" == "bash" &&
> echo "#{pane_current_path}" ||
> echo "#{pane_current_command}")
>
> or even
>
> #(test "#{pane_current_command}" == "bash" &&
> echo "#{pane_current_command}:#{pane_current_path}" ||
> echo "#{pane_current_command}")
>
>
> Personally I don't like it as it makes window titles to long.
>
> Thomas
>

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tmux-users+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/0958ad3e-f01b-45ed-a5e4-01ffd206a46en%40googlegroups.com.

Reply via email to