GithubHelp home page GithubHelp logo

git-bash-powerline-net's Introduction

git-bash-powerline-net

Powerline for Git Bash, done in C#.

Powerline is great, but I wanted more customizations and also want to use it on Windows.

I ran into 2 powerline repositories by sschleemilch. One is done in C# and another one is done in C++.

Diving inside the repositories, I soon learnt how easy it was to create a program to do all the Powerline stuff for you.

So I went ahead to make my own variant.

Before You Continue...

For the glyphs to render properly, you need a font that can do all that. nerd-fonts is what I use for this.

I used specific glyphs from specific sets for certain symbols. If you are patching a font using Nerd Font's font-patcher and don't want to add every glyph set into your font, I've narrowed down on what glyph sets I used (the command-line options are what should be used in font-patcher to get the font with just the glyph sets that I used in this program):

  • Powerline Symbols (--powerline)
  • Octicons (--octicons)
  • Font Awesome Extension (--fontawesomeext)
  • Markdown (--markdown)

Setting Up

  1. Head over to the Releases page and download GitBashPowerlineNET.zip from the version you want.

  2. Unzip the zipped file. You should receive 2 files: git2-a2bde63.dll and GitBashPowerlineNET.exe. These 2 files must be placed beside each other, else the program will fail.

  3. Move the files to somewhere convenient.

  4. Open up your .bashrc file and append the following to it. Make sure to change path-to-exe to the path to where you moved the executable:

    function _set_ps1_to_powerline() {
        local last_command_exit_code=$?
        local path_to_exe="change-me-to-the-path-to-the-exe"
    
        # if the executable doesn't exist, then don't change PS1
        if [[ -e $path_to_exe ]]; then
            PS1_CONTENT="$("$path_to_exe" $last_command_exit_code)"
            PS1="\n$(echo -e $PS1_CONTENT) "
        fi
    }
    
    PROMPT_COMMAND="_set_ps1_to_powerline; $PROMPT_COMMAND"
  5. Re-launch Git Bash. You may also run source your-bash-rc instead, but take note that PROMPT_COMMAND will become longer, resulting in more commands to execute and thus, may cause slowdowns.

  6. Your Git Bash should now start showing powerline segments like this (some segments might not show up depending on your current directory):

    Screenshot of how the powerline segments might look like

    If so, congratulations!

Features

User, Current Directory and Prompt Segments

By default, your username, current directory and prompt will be shown.

Screenshot of how the user and current directory segments look like

Git Segment

The Git segment is placed on the left after the current directory and displays some information about the Git repository you're in.

By default, it shows the name of the branch you're currently checked out.

Screenshot of the Git segment

Detached

If you are currently checked out on a commit, the Git segment will update and show you the commit ID instead of the branch name.

Screenshot of Git segment on detached head status

Merge Status

If you're in a middle of a merge, the segment will display an icon to the right.

Screenshot of Git segment on merge status

Cherry Picking Status

If you're in the middle of a cherry pick, the segment will display an icon to the right.

Screenshot of Git segment on cherry-pick status

Rebasing Status

If you're in the middle of a rebase, the segment will display an icon to the right.

Screenshot of Git segment on rebase status

Revert Status

If you're in the middle of a revert, the segment will display an icon to the right.

Screenshot of Git segment on revert status

Bisect Status

If you're in the middle of bisecting, the segment will display an icon to the right.

Screenshot of Git segment on bisect status

Error Code Segment

If a non-zero error code is produced by the last command, then it will be shown the next time the prompt is displayed.

Screenshot of segment of powerline showing error code of last program

git-bash-powerline-net's People

Contributors

brandon-gui123 avatar

Watchers

 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.