From 6920f039eb377ef0b1e8818dee6cdfced0b5e043 Mon Sep 17 00:00:00 2001 From: axel Date: Sat, 4 Feb 2006 21:35:12 +1000 Subject: [PATCH] Minor optimization to the prompt command darcs-hash:20060204113512-ac50b-4604692cac17972b379a7f40599a30e0bbfc3f89.gz --- init/fish_interactive.fish.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init/fish_interactive.fish.in b/init/fish_interactive.fish.in index 8a38509c9..acb44c408 100644 --- a/init/fish_interactive.fish.in +++ b/init/fish_interactive.fish.in @@ -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 #