radix/files/fish/functions/fish_prompt.fish

36 lines
1020 B
Fish
Raw Normal View History

2023-08-06 02:30:22 +00:00
function blue
set_color blue; printf $argv; set_color normal
end
function normal
set_color normal; printf $argv; set_color normal
end
function fish_cwd_prompt
set -l cwd (pwd)
test $cwd = $HOME && printf "~" || \
normal "%s/%s" (basename (dirname $cwd)) (basename $cwd)
end
function fish_prompt
if test -n "$GUIX_ENVIRONMENT"
normal "(env "; blue "%s" (basename $GUIX_ENVIRONMENT); normal ")"
git branch &>/dev/null
test $status -eq 0 && normal ":"
end
test $status && fish_git_prompt | sed 's/ //'
test $status || test -n "$GUIX_ENVIRONMENT" && printf '\n'
switch "$fish_key_bindings"
case fish_vi_key_bindings fish_hybrid_key_bindings
test $fish_bind_mode = 'default' && normal ':' || normal '+'
end
blue (whoami); normal ' at '; blue (prompt_hostname)
normal ' in '; blue (fish_cwd_prompt)
normal ' > '
end
function fish_default_mode_prompt -d "Display vi prompt mode"
# Do nothing
end