Skip to content
forked from arl/gitmux

💻 Git in your tmux status bar

License

Notifications You must be signed in to change notification settings

leland-kwong/gitmux

 
 

Repository files navigation

Gitmux shows git status in your tmux status bar


travis-ci goreport

demo

  • 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 of gitmux 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.

License: MIT

About

💻 Git in your tmux status bar

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%