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_search_match magenta
set fish_color_operator blue set fish_color_operator blue
set fish_color_escape green set fish_color_escape green
set fish_color_cwd yellow
set fish_color_autosuggestion brwhite set fish_color_autosuggestion brwhite
set fish_color_user yellow
set fish_color_host brwhite
set fish_color_host_remote brwhite set fish_color_host_remote brwhite
set fish_color_cancel brred 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 # environment variables
# for ranger # for ranger
#set RANGER_LOAD_DEFAULT_RC FALSE #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 function fish_prompt
set_color --bold red set -l last_pipestatus $pipestatus
echo -n (whoami) set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
set_color --bold yellow set -l normal (set_color normal)
echo -n "@"
set_color normal # Color the prompt differently when we're root
set_color cyan set -l color_cwd $fish_color_cwd
echo -n (hostname) set -l suffix '>'
set_color yellow #if functions -q fish_is_root_user; and fish_is_root_user
echo -n ' '(prompt_pwd) # if set -q fish_color_cwd_root
set_color normal # set color_cwd $fish_color_cwd_root
echo -n '> ' # 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 end
# text editor # text editor
@ -153,4 +179,4 @@ alias wgqu="sudo wg-quick up"
alias wgqd="sudo wg-quick down" alias wgqd="sudo wg-quick down"
#execute stuff #execute stuff
neofetch #neofetch