radio: files: fish: Update fish_prompt

impermanence
Luis Guilherme Coelho 2024-08-25 15:58:32 -03:00
parent f79c1d9f87
commit 569e0142df
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 15 additions and 18 deletions

View File

@ -24,16 +24,15 @@ function fish_cwd_prompt
case "/"
printf "/"
case "*"
set -l parent_dir (dirname $cwd)
set -l parent_dir (dirname "$cwd")
switch "$parent_dir"
case "$HOME"
printf "~/%s" (basename $cwd)
printf "~/%s" (basename "$cwd")
case "/"
printf "/%s" (basename $cwd)
case "/gnu/store"
printf "/gnu/store/%s" (basename $cwd)
printf "/%s" (basename "$cwd")
case "*"
printf "%s/%s" (basename $parent_dir) (basename $cwd)
test (dirname "$parent_dir") = "/" && printf "/"
printf "%s/%s" (basename "$parent_dir") (basename "$cwd")
end
end
end
@ -46,16 +45,15 @@ end
# Actual prompt
function fish_prompt
if test -n "$GUIX_ENVIRONMENT"
set -l fish_environment_prompt_length \
(displayed_string_length (fish_environment_prompt))
set -l fish_git_prompt_length \
(displayed_string_length (fish_git_prompt))
set -l fish_git_prompt (fish_git_prompt)
set -l fish_environment_prompt (fish_environment_prompt)
set -l fish_environment_prompt_length (displayed_string_length "$fish_environment_prompt")
set -l fish_git_prompt_length (displayed_string_length "$fish_git_prompt")
set -l fish_prompt_padding (math $COLUMNS - $fish_environment_prompt_length - $fish_git_prompt_length)
fish_environment_prompt
printf (padding (math $COLUMNS - $fish_environment_prompt_length \
- $fish_git_prompt_length))
fish_git_prompt | string replace -ra ' ' ''
printf '\n'
printf "$fish_environment_prompt"
printf (padding $fish_prompt_padding)
printf "$fish_git_prompt\n"
else
function fish_right_prompt
fish_git_prompt
@ -74,6 +72,5 @@ function fish_prompt
end
function fish_default_mode_prompt -d "Display vi prompt mode"
# Do nothing
end