24 lines
1.1 KiB
Fish
24 lines
1.1 KiB
Fish
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 > ' (printf "[%s]" (date "+%H:%M:%S") | trans-text -) \
|
|
(printf "%s@%s" $USER (prompt_hostname) | trans-text -) "$pipestatus_string" \
|
|
(pwd | sed "s/^\/home\/$USER/~/" | tr -d '\n' | trans-text - ) (set_color normal)
|
|
end
|
|
end
|