Gitmux shows git status in your tmux status bar
Works with all decently recent tmux versions.
Download the latest binary for your platform/architecture and uncompress it.
Download and install a Go compiler (Go 1.10 or later).Run go get
to build and install gitmux
:
go get -u github.com/arl/gitmux
If your tmux
version supports pane_current_path
(tmux v2.1+),just add this line to your .tmux.conf
:
set -g status-right '#(gitmux "#{pane_current_path}")'
If your tmux
doesn't support pane_current_path
then you can usea bash-specific solutionto achieve relatively similar behaviour: gitmux
will refresh after every shell commandyou run or when you switch windows, however it won't refresh automatically, nor when switching panes.
Note that tmux v2.1
was released in 2015 so you're probably better off updating to a more recent version anyway
gitmux
output can be customized via a configuration file in YAML format.
The gitmux configuration file is in YAML format.
tmux:
symbols:
branch: '⎇ '
hashprefix: ':'
ahead: ↑·
behind: ↓·
staged: '● '
conflict: '✖ '
modified: '✚ '
untracked: '… '
stashed: '⚑ '
clean: ✔
styles:
clear: '#[fg=default]'
state: '#[fg=red,bold]'
branch: '#[fg=white,bold]'
remote: '#[fg=cyan]'
staged: '#[fg=green,bold]'
conflict: '#[fg=red,bold]'
modified: '#[fg=red,bold]'
untracked: '#[fg=magenta,bold]'
stashed: '#[fg=cyan,bold]'
clean: '#[fg=green,bold]'
divergence: "#[fg=yellow]"
layout: [branch, .., remote, " - ", flags]
options:
branch_max_len: 0
First, save the default configuration to a new file:
gitmux -printcfg > .gitmux.conf
Modify the line in .tmux.conf
, passing the path of the configuration file as argument to gitmux
gitmux -cfg .gitmux.conf
Open .gitmux.conf
and modify it, replacing symbols, styles and layout to suit your needs.
In tmux
status bar, gitmux
output immediately reflects the changes you make to the configuration.
gitmux
configuration is split into 4 sections:
symbols
: they're just strings of unicode charactersstyles
: tmux format stringslayout
: list of gitmux
layout components, defines the component to show and in their order.options
: additional configuration optionsThe symbols
section describes the symbols gitmux
prints for the various components of the status string.
symbols:
branch: '⎇ ' # Shown before a branch
hashprefix: ':' # Shown before a Git hash (in 'detached HEAD' state)
ahead: ↑· # Shown before the 'ahead count' when local and remote branch diverge
behind: ↓· # Shown before the 'behind count' when local/remote branch diverge
staged: '● ' # Shown before the 'staged' files count
conflict: '✖ ' # Shown before the 'conflicts' count
modified: '✚ ' # Shown before the 'modified' files count
untracked: '… ' # Shown before the 'untracked' files count
stashed: '⚑ ' # Shown before the 'stash' count
clean: ✔ # Shown when the working tree is clean (empty staging area)
Styles are tmux format strings used to specify text colors and attributes.See tmux
styles reference.
styles:
clear: '#[fg=default]' # Style clearing previous styles (printed before each component)
state: '#[fg=red,bold]' # Style of the special states strings like [rebase], [merge], etc.
branch: '#[fg=white,bold]' # Style of the local branch name
remote: '#[fg=cyan]' # Style of the remote branch name
divergence: "#[fg=yellow]" # Style of the 'divergence' string
staged: '#[fg=green,bold]' # Style of the 'staged' files count
conflict: '#[fg=red,bold]' # Style of the 'conflicts' count
modified: '#[fg=red,bold]' # Style of the 'modified' files count
untracked: '#[fg=magenta,bold]' # Style of the 'modified' files count
stashed: '#[fg=cyan,bold]' # Style of the 'stash' entries count
clean: '#[fg=green,bold]' # Style of the 'clean' symbol
The layout is a list of the components gitmux
shows, and the order inwhich they appear on tmux
status bar.
For example, the default gitmux
layout shows is:
layout: [branch, .., remote-branch, divergence, " - ", flags]
It shows, in that order:
..
,-
characterNote that elements only appear when they make sense, for example if local andremote branch are aligned, the divergence string won't show up. Same thing forthe remote branch, etc.
But you can anyway choose to never show some components if you wish, or to presentthem in a different order.
This is the list of the possible components of the layout
:
Layout component | Description | Example |
---|---|---|
branch |
local branch name | main |
remote-branch |
remote branch name | origin/main |
divergence |
divergence local/remote branch, if any | ↓·2↑·1 |
remote |
alias for remote-branch followed by divergence |
origin/main ↓·2↑·1 |
flags |
Symbols representing the working tree state | ✚ 1 ⚑ 1 … 2 |
any string foo |
Any other string is directly shown | foo |
Some example layouts:
layout: [branch, .., remote-branch, divergence, " - ", flags]
layout: [branch, divergence, " - ", flags]
layout: [flags, " ", branch]
This is the list of additional configuration options
:
Option | Description | Default |
---|---|---|
branch_max_len |
Maximum displayed length for local and remote branch names | 0 (no limit) |
Please report anything by filing an issue.
Pull requests are welcome.
For major changes, please open an issue first to open a discussion.