GithubHelp home page GithubHelp logo

mjg / powerline-gitstatus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaspernbrouwer/powerline-gitstatus

0.0 3.0 0.0 39 KB

A Powerline segment for showing the status of a Git working copy

License: MIT License

Python 100.00%

powerline-gitstatus's Introduction

Powerline Gitstatus

A Powerline segment for showing the status of a Git working copy.

By Jasper N. Brouwer.

It will show the branch-name, or the commit hash if in detached head state.

It will also show the number of commits behind, commits ahead, staged files, unmerged files (conflicts), changed files, untracked files and stashed files if that number is greater than zero.

screenshot

Glossary

  • : in-progress information (if enabled) 
  • : branch name or commit hash
  • : most recent tag (if enabled)
  • : n commits behind
  • : n commits ahead
  • : n staged files
  • : n unmerged files (conflicts)
  • : n changed files
  • : n untracked files
  • : n stashed files

Requirements

The Gitstatus segment requires git! Preferably, but not limited to, version 1.8.5 or higher.

Version 1.8.5 will enable the usage of the -C parameter, which is more performant and accurate.

Installation

Installing the Gitstatus segment can be done with pip:

pip install powerline-gitstatus

The Gitstatus segment uses a couple of custom highlight groups. You'll need to define those groups in your colorscheme, for example in .config/powerline/colorschemes/default.json:

{
  "groups": {
    "gitstatus":                 { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch":          { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_clean":    { "fg": "green",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_dirty":    { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_detached": { "fg": "mediumpurple",    "bg": "gray2", "attrs": [] },
    "gitstatus_tag":             { "fg": "darkcyan",        "bg": "gray2", "attrs": [] },
    "gitstatus_inprogress":      { "fg": "red",             "bg": "gray2", "attrs": [] },
    "gitstatus_behind":          { "fg": "gray10",          "bg": "gray2", "attrs": [] },
    "gitstatus_ahead":           { "fg": "gray10",          "bg": "gray2", "attrs": [] },
    "gitstatus_staged":          { "fg": "green",           "bg": "gray2", "attrs": [] },
    "gitstatus_unmerged":        { "fg": "brightred",       "bg": "gray2", "attrs": [] },
    "gitstatus_changed":         { "fg": "mediumorange",    "bg": "gray2", "attrs": [] },
    "gitstatus_untracked":       { "fg": "brightestorange", "bg": "gray2", "attrs": [] },
    "gitstatus_stashed":         { "fg": "darkblue",        "bg": "gray2", "attrs": [] },
    "gitstatus:divider":         { "fg": "gray8",           "bg": "gray2", "attrs": [] }
  }
}

Then you can activate the Gitstatus segment by adding it to your segment configuration, for example in .config/powerline/themes/shell/default.json:

{
    "function": "powerline_gitstatus.gitstatus",
    "priority": 40
}

The Gitstatus segment will use the -C argument by default, but this requires git 1.8.5 or higher.

If you cannot meet that requirement, you'll have to disable the usage of -C. Do this by passing false to the use_dash_c argument, for example in .config/powerline/themes/shell/__main__.json:

"gitstatus": {
    "args": {
        "use_dash_c": false
    }
}

Optionally the most recent tag reachable in the current branch can be shown. You can enable this by passing true to the show_tag argument, for example in .config/powerline/themes/shell/__main__.json:

"gitstatus": {
    "args": {
        "show_tag": true
    }
}

You can also specify any describe style that git-prompt.sh supports (via its GIT_PS1_DESCRIBE_STYLE) by passing "contains", "branch", "tag", "describe" or "exact" (which is git-prompt.sh's "default"). Git is executed an additional time to find this tag, so it is disabled by default.

Optionally in-progress information can be show (BISECTING, MERGING etc.). You can enable this by passing true to the show_inprogress argument (see above).

License

Licensed under the MIT License.

powerline-gitstatus's People

Contributors

jaspernbrouwer avatar mjg avatar adamk33n3r avatar askmrsinh avatar dan-manges avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.