Just found some problems with using "rename-window" in the approach outlined below...
* John Magolske <listm...@b79.net> [120802 20:30]: > Ok, figured out something that works... > > * John Magolske <listm...@b79.net> [120801 09:15]: > > I'm trying to get the title of the active pane in the status line to > > display $PWD when no command is active, and the current command when > > a command is active. So, for example, if I cd to ~/Mail in the active > > pane of window 7 the status line would be simply: 7*Mail > > > > Then if I invoke the vifm file browser: 7*vifm > > view a file with less: 7*less > > or edit a file with vim: 7*vim > > And upon quiting any of these & returning to the command prompt: 7*Mail > > So now, with these in ~/.zshrc : > > preexec () { > local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} > [[ "$TERM" == tmux* ]] && tmux rename-window "$CMD" > } > > precmd () { > [[ $TERM == tmux* ]] && tmux rename-window ${PWD//*\//} > } > > And #W in ~/.tmux.conf like so: > > setw -g window-status-current-format '#I#F#W ' > setw -g window-status-format '#I#F#W ' > > I can get the title behaviour described above. Additionally, a more > verbose & customized title for Vim can be had with this in ~/.vimrc : > > set title > " show 'V:filename' as window name > set titlestring=\%(\%M%)V:%t An example illustrating the problem: With Mutt running in window 1, switch to window 2 and run the mairix command, then switch back to Mutt in window 1. As soon as mairix is done running, the title of window 1 will change from "mutt" to the $PWD of window 2, and the title of window 2 will remain "mairix" until cd'ing to another dir or running another command in that window. Another approach which works better but has different problems: ~/.zshrc : preexec () { local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} [[ "$TERM" == tmux* ]] && printf "\033]2;$CMD\033\\" } precmd () { [[ "$TERM" == tmux* ]] && printf "\033]2;`basename ${PWD}`\033\\" } ~/.tmux.conf : setw -g window-status-current-format '#I#F#T ' setw -g window-status-format '#I#F#T ' This works fairly well, but I'm not finding a way to set the title of windows created using the "new-window" command. For example: bind-key + run-shell 'tmux new-window -n ether-up "ifup_ether"' only shows $HOST as the title of the window created while running that command. The previous approach using "rename-window" and #W allows the window to be titled "ether-up" as specified by the -n flag. Also, this second approach does not allow for the more customized titles with Vim using "set titlestring=..." in ~/.vimrc (just shows "vim" as the window title). Thanks for any help sorting this out, John -- John Magolske http://B79.net/contact ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users