Skip to content

Instantly share code, notes, and snippets.

@lomholdt
Last active January 7, 2023 05:48
Show Gist options
  • Save lomholdt/24997c21c89a491c9bd3447fddb5223d to your computer and use it in GitHub Desktop.
Save lomholdt/24997c21c89a491c9bd3447fddb5223d to your computer and use it in GitHub Desktop.
Add git branch to tmux status bar
set -g status-right '#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)'
@lomholdt
Copy link
Author

lomholdt commented Oct 9, 2017

To add something on the right side of the status bar, we set -g status-right.

  • To execute a command do #(...).
  • To access the tmux panes current path use #{pane_current_path}
  • To get the current git branch without the star use git rev-parse --abbrev-ref HEAD. You can also do it manually by git branch | grep \* | sed -e 's/[* ]//'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment