:computer: Git in your tmux status bar
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 getto build and install
gitmux:
go get -u github.com/arl/gitmux
Add this line to your
.tmux.conf:
set -g status-right '#(gitmux "#{pane_current_path}")'
gitmuxoutput 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]' 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.confand modify it, replacing symbols, styles and layout to suit your needs.
In
tmuxstatus bar,
gitmuxoutput immediately reflects the changes you make to the configuration.
gitmuxconfiguration is split into 4 sections: -
symbols: they're just strings of unicode characters -
styles: tmux format strings -
layout: list of
gitmuxlayout components, defines the component to show and in their order. -
options: additional configuration options
symbols: branch: '⎇ ' # shown before `branch` hashprefix: ':' # shown before a Git hash (in 'detached HEAD' state) ahead: ↑· # shown before 'ahead count' when local/remote branch diverges` behind: ↓· # shown before 'behind count' when local/remote branch diverges` 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
Styles are tmux format strings used to specify text colors and attributes. See
tmuxstyles reference.
This is the list of the possible components of the
layout:
| Layout component | Description | Example | |:----------------:|:----------------------------------------------------------|:----------------------:| |
branch| local branch name |
master| |
remote-branch| remote branch name |
origin/master| |
divergence| divergence local/remote branch, if any |
↓·2↑·1| |
remote| alias for
remote-branchfollowed by
divergence|
origin/master ↓·2↑·1| |
flags| Symbols representing the working tree state |
✚ 1 ⚑ 1 … 2| | any string
foo| Any other string is directly shown |
foo|
Example layouts:
layout: [branch, '..', remote, ' - ', flags] layout: [branch, '..', remote-flags, divergence, ' - ', flags] layout: [branch] layout: [flags, branch] 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 discuss what you would like to change.