arl / Gitmux
Projects that are alternatives of or similar to Gitmux
Gitmux shows git status in your tmux status bar
- easy. Install and forget about it
- minimal. It shows what you need when you need it
- discrete. Disappears if the current directory is not part of a Git tree
- shell-independent. Works with all shells bash, zsh, fish, whateversh
- customizable. Colors, symbols and layout can be customized
Prerequisites
Works with all decently recent tmux versions.
Installing
Binary release
Download the latest binary for your platform/architecture and uncompress it.
From source
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
Getting started
Add this line to your .tmux.conf
:
set -g status-right '#(gitmux "#{pane_current_path}")'
Customizing
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]'
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 characters -
styles
: tmux format strings -
layout
: list ofgitmux
layout components, defines the component to show and in their order. -
options
: additional configuration options
Symbols
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
Styles are tmux format strings used to specify text colors and attributes.
See tmux
styles reference.
Layout components
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-branch followed 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]
Additional options
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) |
Troubleshooting
Please report anything by filing an issue.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.