mirror of https://codeberg.org/anemofilia/zero
radio: files: fish: Update fish_prompt
parent
f79c1d9f87
commit
569e0142df
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue