mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 04:58:24 +08:00
Minor optimization to the prompt command
darcs-hash:20060204113512-ac50b-4604692cac17972b379a7f40599a30e0bbfc3f89.gz
This commit is contained in:
parent
ff00354305
commit
6920f039eb
@ -26,10 +26,8 @@ end
|
||||
# long it is.
|
||||
|
||||
function fish_prompt -d (_ "Write out the prompt")
|
||||
if not set -q __fish_prompt_whoami
|
||||
set -g __fish_prompt_whoami (whoami)
|
||||
end
|
||||
|
||||
|
||||
# Just calculate these once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
end
|
||||
@ -38,7 +36,9 @@ function fish_prompt -d (_ "Write out the prompt")
|
||||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
printf '%s@%s %s%s%s> \n' $__fish_prompt_whoami $__fish_prompt_hostname (set_color $fish_color_cwd) (prompt_pwd) $__fish_prompt_normal
|
||||
set -l prompt_color (set_color $fish_color_cwd)
|
||||
|
||||
printf '%s@%s %s%s%s> \n' $USER $__fish_prompt_hostname "$prompt_color" (prompt_pwd) "$__fish_prompt_normal"
|
||||
end
|
||||
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user