I have a line in my .tmux.conf which simply shows me the git branch I am on.
set -g status-right ' #[bg=colour33] Branch #[(git branch)] '
When working in tmux, I regularly have panels in different directories. So my question becomes, is there a way to have the status command re-execute based on my "panel's cwd", instead of what it is doing now, where it seems to just hold onto the directory I was in when tmux was first opened.. ?
In newer versions of tmux, you can use pane_current_path
to achieve this:
set -g status-right '#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)'
See this answer - Pane Title in Tmux - you would probably need to override the chpwd
function which is invoked whenever you change working directories in bash/zsh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With