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,
"lastUpdateCheck": 1594112599222
"lastUpdateCheck": 1594332763844
}

View file

@ -13,7 +13,7 @@ set -U fish_greeting
#end
alias ls=lsd
alias ls="exa --icons"
alias tcolors="env TERM=xterm-256color tcolors"
abbr --add --global vim nvim
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'
function run_stuff
function run_pipr
set -l commandline (commandline -b)
pipr --out-file /tmp/pipr_out --default "$commandline"
set -l result (cat /tmp/pipr_out)
@ -42,6 +42,8 @@ function run_stuff
commandline -f repaint
end
bind \ca run_pipr
function c
set -l result (/home/leon/scripts/conf)
commandline -r "$result"
@ -49,7 +51,6 @@ function c
end
bind \ca run_stuff
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_white="#ebdbb2"
local __bright_green="#b8bb26"
@ -14,6 +15,7 @@ dir() {
printf '%s\n' "${p:$CUTOFF}"
}
git_status() {
local BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\s*\(.*\)/\1/')
@ -25,12 +27,15 @@ git_status() {
}
function _my_prompt() {
local exit_code="$?"
echo -n "%F{$__bright_white}╭───"
echo -n "%F{$__bright_cyan}$USER"
echo -n "%F{$__bright_white} in"
echo -n "%F{$__bright_green} $(dir)"
echo -n "%F{$__bright_white} $(git_status)"
if [ ! "$exit_code" = 0 ]; then
echo -n "%F{red}$exit_code"
fi
echo
# %3{stuff%} tell's zsh that the characters are printed as 3 chars wide
echo -n "%F{$__bright_white}%3{╰─λ%} "