fish/functions/fish_prompt.fish

24 lines
1.1 KiB
Fish
Raw Normal View History

2023-05-19 08:36:32 +01:00
function fish_prompt --description 'Informative prompt'
#Save the return status of the previous command
set -l last_pipestatus $pipestatus
if test -n "$IN_NIX_SHELL"
printf "%s<nix-shell>%s " (set_color red) (set_color normal)
end
switch "$USER"
case root toor
printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root
and set_color $fish_color_cwd_root
or set_color $fish_color_cwd) \
(prompt_pwd) (set_color normal)
case '*'
set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) \
(set_color --bold $fish_color_status) $last_pipestatus)
printf '[%s] %s%s@%s %s\f\r%s%s%s > ' (date "+%H:%M:%S") (set_color brblue) \
$USER (prompt_hostname) $pipestatus_string \
(set_color $fish_color_cwd) (pwd | sed "s/^\/home\/$USER/~/") (set_color normal)
end
end