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

Regards,

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

Reply via email to