aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/tools/web_config/sample_prompts/classic_status.fish
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-10-02 14:02:53 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-10-02 18:41:01 -0700
commit3f11d90744ef1ab1b32f394d50eb4b911aaf50f3 (patch)
treedf62dbb610c4afbab4c974d99be44c8bb57a6a7e /share/tools/web_config/sample_prompts/classic_status.fish
parentae7b6156ac136f6cf7c30f5e0aeeda82dfc56af0 (diff)
# This is a combination of 2 commits.
# The first commit's message is: Simplify default fish_prompt No need for the set_color caching now that it's a builtin. Also simplify the 3 classic prompts in fish_config's sample_prompts set.
Diffstat (limited to 'share/tools/web_config/sample_prompts/classic_status.fish')
-rw-r--r--share/tools/web_config/sample_prompts/classic_status.fish43
1 files changed, 15 insertions, 28 deletions
diff --git a/share/tools/web_config/sample_prompts/classic_status.fish b/share/tools/web_config/sample_prompts/classic_status.fish
index 4b062c5d..fe64f793 100644
--- a/share/tools/web_config/sample_prompts/classic_status.fish
+++ b/share/tools/web_config/sample_prompts/classic_status.fish
@@ -1,7 +1,7 @@
# name: Classic + Status
# author: David Frascone
-function fish_prompt --description 'Write out the prompt'
+function fish_prompt --description "Write out the prompt"
# Save our status
set -l last_status $status
@@ -10,38 +10,25 @@ function fish_prompt --description 'Write out the prompt'
printf "%s(%d)%s " (set_color red --bold) $last_status (set_color normal)
end
- # Just calculate these once, to save a few cycles when displaying the prompt
+ # Just calculate this 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
- if not set -q __fish_prompt_normal
- set -g __fish_prompt_normal (set_color normal)
- end
-
- set -l user_prompt '>'
+ set -l color_cwd
+ set -l suffix
switch $USER
- # Set our root colors, if we're root :)
- case root toor
- set user_prompt '#'
- if not set -q __fish_prompt_cwd
- if set -q fish_color_cwd_root
- set -g __fish_prompt_cwd (set_color $fish_color_cwd_root)
- else
- set -g __fish_prompt_cwd (set_color $fish_color_cwd)
- end
- end
- case '*'
- if not set -q __fish_prompt_cwd
- set -g __fish_prompt_cwd (set_color $fish_color_cwd)
- end
+ case root toor
+ if set -q fish_color_cwd_root
+ set color_cwd $fish_color_cwd_root
+ else
+ set color_cwd $fish_color_cwd
+ end
+ set suffix '#'
+ case '*'
+ set color_cwd $fish_color_cwd
+ set suffix '>'
end
- #printf '%s@%s %s%s%s# ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal"
- #printf "LAST STATUS STRING: $last_status_string \n"
- printf '%s@%s %s%s%s%s%s ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $user_prompt
-end
-
-function fish_title
- echo $_ ' ' (prompt_pwd)
+ echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
end