configure fish prompt

This commit is contained in:
Never Gude 2025-11-05 14:30:26 +01:00
parent 6a49608745
commit b12ac895c2
4 changed files with 59 additions and 46 deletions

View file

@ -1,30 +1,28 @@
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l normal (set_color normal)
set -l status_color (set_color brgreen)
set -l cwd_color (set_color $fish_color_cwd)
set -l vcs_color (set_color brpurple)
set -l prompt_status ""
# Since we display the prompt on a new line allow the directory names to be longer.
set -q fish_prompt_pwd_dir_length
or set -lx fish_prompt_pwd_dir_length 0
# Color the prompt differently when we're root
set -l suffix ''
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set cwd_color (set_color $fish_color_cwd_root)
end
set suffix '#'
end
# Color the prompt in red on error
if test $last_status -ne 0
set status_color (set_color $fish_color_error)
set prompt_status $status_color "[" $last_status "]" $normal
end
echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
echo -n -s $status_color $suffix ' ' $normal
function fish_prompt
if not set -q VIRTUAL_ENV_DISABLE_PROMPT
set -g VIRTUAL_ENV_DISABLE_PROMPT true
end
# set_color yellow
# printf '%s' $USER
# set_color normal
# printf ' at '
# set_color magenta
# echo -n (prompt_hostname)
# set_color normal
# printf ' in '
set -U fish_greeting
set_color $fish_color_cwd
printf '%s' (pwd)
set_color magenta
set -g __fish_git_prompt_show_informative_status true
printf '%s' (fish_vcs_prompt)
set_color normal
# Line 2
echo
if test -n "$VIRTUAL_ENV"
printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal)
end
printf '↪ '
set_color normal
end

View file

@ -0,0 +1,9 @@
function fish_right_prompt -d "Write out the right prompt"
if not set -q VIRTUAL_ENV_DISABLE_PROMPT
set -g VIRTUAL_ENV_DISABLE_PROMPT true
end
set_color brblack
date '+%H:%M:%S'
end