Reputation: 4026
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.. ?
Upvotes: 5
Views: 1845
Reputation: 2432
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)'
Upvotes: 4
Reputation: 94739
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.
Upvotes: 1