mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 19:41:14 -03:00
fish_prompt: Don't do work outside of the function
That just makes it annoying to use `funced`. Also sync the classic_vcs prompt again.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
# name: Classic + Vcs
|
||||
# name: Classic + Vcs (the default)
|
||||
# author: Lily Ballard
|
||||
|
||||
set __fish_prompt_status_generation $status_generation
|
||||
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -l last_status $status
|
||||
@@ -25,7 +23,9 @@ function fish_prompt --description 'Write out the prompt'
|
||||
end
|
||||
|
||||
# Write pipestatus
|
||||
# If the status was carried over (e.g. after `set`), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
|
||||
if test $__fish_prompt_status_generation = $status_generation
|
||||
set bold_flag
|
||||
end
|
||||
|
||||
@@ -23,7 +23,14 @@ function fish_prompt --description 'Write out the prompt'
|
||||
end
|
||||
|
||||
# Write pipestatus
|
||||
set -l prompt_status (__fish_print_pipestatus $last_status " [" "]" "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus)
|
||||
# If the status was carried over (e.g. after `set`), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
|
||||
if test $__fish_prompt_status_generation = $status_generation
|
||||
set bold_flag
|
||||
end
|
||||
set __fish_prompt_status_generation $status_generation
|
||||
set -l prompt_status (__fish_print_pipestatus $last_status " [" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus)
|
||||
|
||||
echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal $prompt_status $suffix " "
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user