feat: Improve powerline support
This commit is contained in:
parent
217eb70b58
commit
ece4edeb18
35
rc.d/prompt
35
rc.d/prompt
@ -2,23 +2,32 @@
|
|||||||
|
|
||||||
# Customize the prompt
|
# Customize the prompt
|
||||||
|
|
||||||
POWERLINE=$(which powerline || which powerline-go) &> /dev/null
|
POWERLINE_LOCATION=$(command -v powerline-go || command -v powerline) &>/dev/null
|
||||||
if [ -x "$POWERLINE" ]; then
|
POWERLINE=$(basename "$POWERLINE_LOCATION")
|
||||||
|
|
||||||
|
if [ "${POWERLINE}" = "powerline-go" ]; then
|
||||||
|
|
||||||
|
echo "Using $POWERLINE"
|
||||||
|
|
||||||
function _update_ps1() {
|
function _update_ps1() {
|
||||||
PS1="$($POWERLINE -error $? -jobs $(jobs -p | wc -l))"
|
PS1=$($POWERLINE -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace" -newline)
|
||||||
|
|
||||||
# Uncomment the following line to automatically clear errors after showing
|
|
||||||
# them once. This not only clears the error for powerline-go, but also for
|
|
||||||
# everything else you run in that shell. Don't enable this if you're not
|
|
||||||
# sure this is what you want.
|
|
||||||
|
|
||||||
#set "?"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$TERM" != "linux" ]; then
|
if [ "$TERM" != "linux" ]; then PROMPT_COMMAND="$PROMPT_COMMAND; _update_ps1"; fi
|
||||||
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
|
||||||
fi
|
elif [ "${POWERLINE}" = "powerline" ]; then
|
||||||
|
|
||||||
|
echo "Using $POWERLINE"
|
||||||
|
|
||||||
|
# Run powerline daemon
|
||||||
|
powerline-daemon -q
|
||||||
|
# Cache powerline location
|
||||||
|
# To locate this directory, run: pip show powerline-status
|
||||||
|
export POWERLINE_LOCATION="/home/xavier/.local/lib/python3.10//site-packages/powerline" # Set up powerline environment
|
||||||
|
export POWERLINE_CONFIG_COMMAND=powerline-config
|
||||||
|
export POWERLINE_BASH_CONTINUATION=1
|
||||||
|
export POWERLINE_BASH_SELECT=1# Invoke binding script
|
||||||
|
. "$POWERLINE_LOCATION/bindings/bash/powerline.sh"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user