Following your advice on preexec hook, I found a solution with help from
stackoverflow community. It's exactly what I needed, accurate, immediate
and probably elegant - depends on bash's hook elegance actually. I post
it here also in case somebody else looks for it:

Added this to .bashrc:

if [ -v "TMUX" ]; then
PS0='$(printf "\033k%s\033" "$(HISTTIMEFORMAT= history 1 | sed -e "s/^[
]*[0-9]*[ ]*//")")'
PROMPT_COMMAND="printf '\033kBASH\033\\'"

PS0, changes label to executed command, taking the string from history.
So for example, not only 'vi' but 'vi edited.file'. 'ranger', not 'python'.
PROMPT_COMMAND, returns label to BASH upon returing to shell. Actually
you can put whatever you like, something more fancy like '>_'

On tmux.conf:

set -g allow-rename on

--


Nicholas Marriott:
I think you want bash's "preexec" hook, although I am not sure exactly
how to use it. That is how iTerm2 sends its "before command" escape
sequences and whatnot.

--
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 [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/b11414f3-d4b7-3c27-a768-51395e9fcbdc%40gmx.com.

Reply via email to