Window name := first letters of dir basename

11 views
Skip to first unread message

Niklas

unread,
Sep 25, 2020, 10:46:47 AM9/25/20
to tmux-users
How do I combine two commands two formatting commands?

I want to set the name of a window to the first 3 letters of my current directory.

Example: /some/dir/project
Goal: "proj"

In tmux I can realize this with:

set-option -g automatic-rename on
set-option -g automatic-rename-format 'string'

Where I can set string to either:
- #{=3:pane_current_path}  -> first five letters of path -> "/so"
- #{b:pane_current_path} -> current dir -> "project"

However, if I attempt to combine the two I just get an empty string. Did anyone else get this to work?

Cheers,
Niklas


Nicholas Marriott

unread,
Sep 25, 2020, 10:59:57 AM9/25/20
to Niklas, tmux-users
#{b;=3:pane_current_path} if you have 2.9 or later.

#{=3:#{b:pane_current_path}} will also work in some later versions.



--
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+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/a7c35c72-1510-4089-9c7b-b9eeeb053761n%40googlegroups.com.

Niklas

unread,
Sep 27, 2020, 12:32:21 PM9/27/20
to tmux-users
Thank you, the first option worked like a charm :-)
Reply all
Reply to author
Forward
0 new messages