Add exit code to prompt

This commit is contained in:
Leon Kowarschick 2020-07-10 00:46:25 +02:00
parent c15e7375c6
commit 72c6115634
4 changed files with 12 additions and 6 deletions

View file

@ -1,4 +1,4 @@
{ {
"optOut": false, "optOut": false,
"lastUpdateCheck": 1594112599222 "lastUpdateCheck": 1594332763844
} }

View file

@ -13,7 +13,7 @@ set -U fish_greeting
#end #end
alias ls=lsd alias ls="exa --icons"
alias tcolors="env TERM=xterm-256color tcolors" alias tcolors="env TERM=xterm-256color tcolors"
abbr --add --global vim nvim abbr --add --global vim nvim
abbr --add --global tsh trash abbr --add --global tsh trash
@ -34,7 +34,7 @@ abbr --add --global gs "git status"
[ (hostname) = "garnix" ] && alias rm='echo "rm is disabled. Please use trash instead."; false' [ (hostname) = "garnix" ] && alias rm='echo "rm is disabled. Please use trash instead."; false'
function run_stuff function run_pipr
set -l commandline (commandline -b) set -l commandline (commandline -b)
pipr --out-file /tmp/pipr_out --default "$commandline" pipr --out-file /tmp/pipr_out --default "$commandline"
set -l result (cat /tmp/pipr_out) set -l result (cat /tmp/pipr_out)
@ -42,6 +42,8 @@ function run_stuff
commandline -f repaint commandline -f repaint
end end
bind \ca run_pipr
function c function c
set -l result (/home/leon/scripts/conf) set -l result (/home/leon/scripts/conf)
commandline -r "$result" commandline -r "$result"
@ -49,7 +51,6 @@ function c
end end
bind \ca run_stuff
function replace_with_yay function replace_with_yay

View file

@ -1 +1 @@
/nix/store/s34927zjmwyi3gbrk106f5l8ia09jifd-home-manager-files/.config/htop/htoprc /nix/store/dzc2rh4j312pnjqipsrgag71hm174vfn-home-manager-files/.config/htop/htoprc

View file

@ -1,3 +1,4 @@
local __bright_cyan="#8ec07c" local __bright_cyan="#8ec07c"
local __bright_white="#ebdbb2" local __bright_white="#ebdbb2"
local __bright_green="#b8bb26" local __bright_green="#b8bb26"
@ -14,6 +15,7 @@ dir() {
printf '%s\n' "${p:$CUTOFF}" printf '%s\n' "${p:$CUTOFF}"
} }
git_status() { git_status() {
local BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\s*\(.*\)/\1/') local BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\s*\(.*\)/\1/')
@ -25,12 +27,15 @@ git_status() {
} }
function _my_prompt() { function _my_prompt() {
local exit_code="$?"
echo -n "%F{$__bright_white}╭───" echo -n "%F{$__bright_white}╭───"
echo -n "%F{$__bright_cyan}$USER" echo -n "%F{$__bright_cyan}$USER"
echo -n "%F{$__bright_white} in" echo -n "%F{$__bright_white} in"
echo -n "%F{$__bright_green} $(dir)" echo -n "%F{$__bright_green} $(dir)"
echo -n "%F{$__bright_white} $(git_status)" echo -n "%F{$__bright_white} $(git_status)"
if [ ! "$exit_code" = 0 ]; then
echo -n "%F{red}$exit_code"
fi
echo echo
# %3{stuff%} tell's zsh that the characters are printed as 3 chars wide # %3{stuff%} tell's zsh that the characters are printed as 3 chars wide
echo -n "%F{$__bright_white}%3{╰─λ%} " echo -n "%F{$__bright_white}%3{╰─λ%} "