Prompt now shows exit code

This commit is contained in:
RealStickman 2021-06-11 10:17:42 +02:00
parent 6544808952
commit f427ac411d

View File

@ -19,30 +19,56 @@ set fish_color_selection brcyan
set fish_color_search_match magenta
set fish_color_operator blue
set fish_color_escape green
set fish_color_cwd yellow
set fish_color_autosuggestion brwhite
set fish_color_user yellow
set fish_color_host brwhite
set fish_color_host_remote brwhite
set fish_color_cancel brred
# used in prompt
set fish_color_user --bold red
set fish_color_separator --bold yellow
set fish_color_host cyan
set fish_color_cwd yellow
# environment variables
# for ranger
#set RANGER_LOAD_DEFAULT_RC FALSE
# custom prompt
# Defined in /home/marc/.config/fish/functions/fish_prompt.fish @ line 2
# slightly modified from defaults
function fish_prompt
set_color --bold red
echo -n (whoami)
set_color --bold yellow
echo -n "@"
set_color normal
set_color cyan
echo -n (hostname)
set_color yellow
echo -n ' '(prompt_pwd)
set_color normal
echo -n '> '
set -l last_pipestatus $pipestatus
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
set -l normal (set_color normal)
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd
set -l suffix '>'
#if functions -q fish_is_root_user; and fish_is_root_user
# if set -q fish_color_cwd_root
# set color_cwd $fish_color_cwd_root
# end
# set suffix '#'
#end
# If we're running via SSH, change the host color.
set -l color_host $fish_color_host
#if set -q SSH_TTY
# set color_host $fish_color_host_remote
#end
# Write pipestatus
# If the status was carried over (e.g. after `set`), don't bold it.
set -l bold_flag --bold
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
if test $__fish_prompt_status_generation = $status_generation
set bold_flag
end
set __fish_prompt_status_generation $status_generation
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus)
echo -n -s (set_color $fish_color_user) "$USER" $normal (set_color $fish_color_separator) @ $normal (set_color $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
#echo -n -s (set_color --bold red) "$USER" $normal (set_color --bold yellow) @ $normal (set_color cyan) (prompt_hostname) $normal ' ' (set_color yellow) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
end
# text editor
@ -153,4 +179,4 @@ alias wgqu="sudo wg-quick up"
alias wgqd="sudo wg-quick down"
#execute stuff
neofetch
#neofetch