From 019acfc350777ea54355b3b499b63690cc411bf3 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 28 Jun 2021 13:00:31 +0200 Subject: Switch to powerline-go for nix-shell support --- system/.bashrc | 20 ++++++++--- system/.config/powerline/config.json | 7 ---- system/.config/powerline/themes/shell/custom.json | 42 ---------------------- system/bin/powerline-go | Bin 0 -> 3979108 bytes 4 files changed, 16 insertions(+), 53 deletions(-) delete mode 100644 system/.config/powerline/config.json delete mode 100644 system/.config/powerline/themes/shell/custom.json create mode 100755 system/bin/powerline-go (limited to 'system') diff --git a/system/.bashrc b/system/.bashrc index 98d3078..9d74f8f 100644 --- a/system/.bashrc +++ b/system/.bashrc @@ -118,10 +118,22 @@ fi GPG_TTY=$(tty) export GPG_TTY -powerline-daemon -q -POWERLINE_BASH_CONTINUATION=1 -POWERLINE_BASH_SELECT=1 -. /usr/local/lib/python3.7/dist-packages/powerline/bindings/bash/powerline.sh +function _update_ps1() { + PS1="$( +$HOME/bin/powerline-go \ + -max-width 40 \ + -modules host,user,cwd,git,nix-shell,jobs,exit \ + -priority host,user,git,cwd,nix-shell,jobs,exit \ + -error $? \ + -git-disable-stats untracked \ + -hostname-only-if-ssh \ + -jobs $(jobs -p | wc -l) + )" +} + +if [ "$TERM" != "linux" ] && [ -f "$HOME/bin/powerline-go" ]; then + PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" +fi PATH="/home/camil/perl5/bin${PATH+:}${PATH}"; export PATH; PERL5LIB="/home/camil/perl5/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB; diff --git a/system/.config/powerline/config.json b/system/.config/powerline/config.json deleted file mode 100644 index 432a56d..0000000 --- a/system/.config/powerline/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ext": { - "shell": { - "theme": "custom" - } - } -} diff --git a/system/.config/powerline/themes/shell/custom.json b/system/.config/powerline/themes/shell/custom.json deleted file mode 100644 index 030de37..0000000 --- a/system/.config/powerline/themes/shell/custom.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "segments": { - "left": [ - { - "function": "powerline.segments.common.net.hostname", - "priority": 10 - }, - { - "function": "powerline.segments.common.env.user", - "args": { - "hide_user": "camil" - }, - "priority": 30 - }, - { - "function": "powerline.segments.shell.cwd", - "args": { - "dir_limit_depth": 3, - "dir_shorten_len": 4, - "use_path_separator": true - }, - "priority": 10 - }, - { - "function": "powerline.segments.common.vcs.branch", - "args": { - "status_colors": true, - "ignore_statuses": ["U"] - }, - "priority": 40 - }, - { - "function": "powerline.segments.shell.jobnum", - "priority": 20 - }, - { - "function": "powerline.segments.shell.last_pipe_status", - "priority": 10 - } - ] - } -} diff --git a/system/bin/powerline-go b/system/bin/powerline-go new file mode 100755 index 0000000..3cf39c3 Binary files /dev/null and b/system/bin/powerline-go differ -- cgit v1.2.3