#Linux #bash #git #Powerline
If you ever have to reinstall Powerline on another machine this are the easy steps to follow to give you a nice looking prompt with git status and branch name in your bash terminal. Steps where done on Deepin Linux 15.7 but should also work on Debian / Ubuntu.
pip install powerline-status
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
# NOTE: adjust fonts paths properly!
mv PowerlineSymbols.otf /usr/share/fonts/
fc-cache -vf /usr/share/fonts/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
# add this to your .bashrc
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. {powerline-installation-dir}/bindings/bash/powerline.sh
# NOTE: use `pip show powerline-status` to find your **{powerline-installation-dir}**
mkdir -p ~/.config/powerline
# NOTE: adjust your {powerline-installation-dir} properly!
cp /{powerline-installation-dir}/config_files/config.json ~/.config/powerline
# edit ~/.config/powerline/config.json to see git branch name in prompt
# --> "theme": "default_leftonly",
# edit /{powerline-installation-dir}/segments/common/vcs.py to color highlight git status (sudo?)
# --> def __call__(self, pl, segment_info, create_watcher, status_colors=True, ignore_statuses=()):
# optionally set "ignore_statuses=()" to "ignore_statuses=(["U"])" to ignore untracked files
powerline-daemon --replace
# close all terminal windows
# FINISH
NOTE: If you run into issues scroll down and check my latest comments - hope it helps ♥
How to install Powerline in 10 steps on Linux and configure it for bash terminal with git status.
-
pip install powerline-status
Download fonts file and fontconfig file.
-
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
Move the symbol font to a valid X fonts path. Valid fonts paths can be listed with xset q
(--> Font Path: ...
).
-
# NOTE: adjust fonts path properly! mv PowerlineSymbols.otf /usr/share/fonts/
Update fonts cache.
-
# NOTE: adjust fonts path properly! fc-cache -vf /usr/share/fonts/
Install fontconfig.
-
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
Add this lines to your .bashrc
-
powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . {powerline-installation-dir}/bindings/bash/powerline.sh
NOTE: use
pip show powerline-status
to determine your {powerline-installation-dir} (e.g.Location: /usr/local/...
)
-
mkdir -p ~/.config/powerline
Copy config.json
from {powerline-installation-dir}/config_files/
to ~/.config/powerline
-
# NOTE: adjust your {powerline-installation-dir} properly! cp /usr/lib/python3.6/site-packages/powerline/config_files/config.json ~/.config/powerline
To see git branch name and color highlighted git status in prompt you have to
- change shell/theme property from
default
todefault_left_only
in~/.config/powerline/config.json
(see 9.) - copy
default_leftonly.json
to your user config directory (~/.config/powerline
) and modify it (see 10.).
-
# edit ~/.config/powerline/config.json { ... "ext": { ... "shell": { "colorscheme": "default", "theme": "default_leftonly", "local_themes": { "continuation": "continuation", "select": "select" } }, ... } }
-
# copy default_leftonly.json from powerline installation dir to user config dir cp {powerline-installation-dir}/config_files/themes/shell/default_leftonly.json ~/.config/powerline # modify default_leftonly.json in user config dir nano ~/.config/powerline/default_leftonly.json
{ "function": "powerline.segments.common.vcs.branch", "priority": 40, "args": { "status_colors": true, "ignore_statuses": ["U"] } },
Your changes will not apply until you restart the daemon
powerline-daemon --replace
Need even more details? --> Official Documentation
Some ideas came from this post powerline/powerline#186
Liked this one a lot