Archive

Posts Tagged ‘powerline-status’

powerline-gitstatus

July 23, 2017 Leave a comment

Problem:
Git status with powerline

Solution:
https://github.com/jaspernbrouwer/powerline-gitstatus

1. pip install –user powerline-gitstatus

Follow the instructions in on site https://github.com/jaspernbrouwer/powerline-gitstatus
2. Add custom highlight groups.

vim .local/lib/python2.7/site-packages/powerline/config_files/colorschemes/default.json

Example

{
  "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_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": [] }
  }
}

3. Activate the Gitstatus segment.

vim .local/lib/python2.7/site-packages/powerline/config_files/colorschemes/default.json

Example

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

4. Show most recent tag reachable in the current branch.

vim .local/lib/python2.7/site-packages/powerline/config_files/themes/shell/__main__.json

Example

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

These are json files. Be careful with syntax. If editing existing files, remember to add the necessary commas where needed.

Source:
https://github.com/jaspernbrouwer/powerline-gitstatus

Advertisements

powerline-status

July 23, 2017 Leave a comment

Problem:
Installing powerline-status

Solution:
1. pip install –user powerline-status
2. Add the following to .bashrc

if [ -d "$HOME/.local/bin" ]; then
    PATH="$HOME/.local/bin:$PATH"
fi

export POWERLINE_COMMAND=powerline
powerline-daemon -q

POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
REPOSITORY_ROOT=/home/rodnee/.local/lib/python2.7/site-packages
. ${REPOSITORY_ROOT}/powerline/bindings/bash/powerline.sh

3. Source .bashrc. It may give some errors. Open up a new terminal and see if the changes have taken effect.

$ source .bashrc
bash: /home/rodnee/.local/lib/python2.7/site-packages/powerline/bindings/bash/../../../scripts/powerline-config: No such file or directory
bash: /home/rodnee/.local/lib/python2.7/site-packages/powerline/bindings/bash/../../../scripts/powerline-config: No such file or directory

Source:
http://powerline.readthedocs.io/en/master/index.html
https://github.com/powerline/powerline/issues/850

Note:
I could not get it to work with zsh. Opted for https://pseudoscripter.wordpress.com/2017/07/23/a-powerline-style-prompt-for-your-shell/ instead.

Categories: bash Tags: ,