diff --git a/share/tools/web_config/sample_prompts/acidhub.fish b/share/tools/web_config/sample_prompts/acidhub.fish index afb702463..08fd47fe7 100644 --- a/share/tools/web_config/sample_prompts/acidhub.fish +++ b/share/tools/web_config/sample_prompts/acidhub.fish @@ -12,8 +12,8 @@ function fish_prompt -d "Write out the prompt" if [ (_git_branch_name) ] set -l git_branch (set_color -o blue)(_git_branch_name) if [ (_is_git_dirty) ] - for i in (git branch -qv --no-color| string match -r \*|cut -d' ' -f4-|cut -d] -f1|tr , \n)\ - (git status --porcelain | cut -c 1-2 | uniq) + for i in (git branch -qv --no-color | string match -r \* | cut -d' ' -f4- | cut -d] -f1 | tr , \n)\ + (git status --porcelain | cut -c 1-2 | uniq) switch $i case "*[ahead *" set git_status "$git_status"(set_color red)⬆ @@ -39,29 +39,10 @@ function fish_prompt -d "Write out the prompt" set git_info "(git$git_status$git_branch"(set_color white)")" end set_color -b black - printf '%s%s%s%s%s%s%s%s%s%s%s%s%s'\ - (set_color -o white) \ - '❰' \ - (set_color green) \ - $USER \ - (set_color white) \ - '❙' \ - (set_color yellow) \ - (echo $PWD | sed -e "s|^$HOME|~|") \ - (set_color white) \ - $git_info \ - (set_color white) \ - '❱' \ - (set_color white) + printf '%s%s%s%s%s%s%s%s%s%s%s%s%s' (set_color -o white) '❰' (set_color green) $USER (set_color white) '❙' (set_color yellow) (echo $PWD | sed -e "s|^$HOME|~|") (set_color white) $git_info (set_color white) '❱' (set_color white) if test $laststatus -eq 0 - printf "%s✔%s≻%s " \ - (set_color -o green)\ - (set_color white) \ - (set_color normal) + printf "%s✔%s≻%s " (set_color -o green) (set_color white) (set_color normal) else - printf "%s✘%s≻%s " \ - (set_color -o red) \ - (set_color white) \ - (set_color normal) + printf "%s✘%s≻%s " (set_color -o red) (set_color white) (set_color normal) end end diff --git a/share/tools/web_config/sample_prompts/classic.fish b/share/tools/web_config/sample_prompts/classic.fish index 4310d9594..2eaa4ddd0 100644 --- a/share/tools/web_config/sample_prompts/classic.fish +++ b/share/tools/web_config/sample_prompts/classic.fish @@ -1,19 +1,19 @@ # name: Classic function fish_prompt --description "Write out the prompt" - set -l color_cwd - set -l suffix - switch $USER - 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 + set -l color_cwd + set -l suffix + switch $USER + 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 - echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix " + echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix " end diff --git a/share/tools/web_config/sample_prompts/classic_status.fish b/share/tools/web_config/sample_prompts/classic_status.fish index d180a4d74..dd0548949 100644 --- a/share/tools/web_config/sample_prompts/classic_status.fish +++ b/share/tools/web_config/sample_prompts/classic_status.fish @@ -13,16 +13,16 @@ function fish_prompt --description "Write out the prompt" set -l color_cwd set -l suffix switch $USER - case root toor - if set -q fish_color_cwd_root - set color_cwd $fish_color_cwd_root - else + 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 - end - set suffix '#' - case '*' - set color_cwd $fish_color_cwd - set suffix '>' + set suffix '>' end echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix " diff --git a/share/tools/web_config/sample_prompts/classic_vcs.fish b/share/tools/web_config/sample_prompts/classic_vcs.fish index 683e91778..beac87a8b 100644 --- a/share/tools/web_config/sample_prompts/classic_vcs.fish +++ b/share/tools/web_config/sample_prompts/classic_vcs.fish @@ -3,65 +3,68 @@ # vim: set noet: function fish_prompt --description 'Write out the prompt' - set -l last_status $status - set -l normal (set_color normal) + set -l last_status $status + set -l normal (set_color normal) - # Hack; fish_config only copies the fish_prompt function (see #736) - if not set -q -g __fish_classic_git_functions_defined - set -g __fish_classic_git_functions_defined + # Hack; fish_config only copies the fish_prompt function (see #736) + if not set -q -g __fish_classic_git_functions_defined + set -g __fish_classic_git_functions_defined - function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes" - if status --is-interactive - commandline -f repaint ^/dev/null - end - end + function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes" + if status --is-interactive + commandline -f repaint ^/dev/null + end + end - function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes" - if status --is-interactive - commandline -f repaint ^/dev/null - end - end + function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes" + if status --is-interactive + commandline -f repaint ^/dev/null + end + end - function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes" - if status --is-interactive - commandline -f repaint ^/dev/null - end - end + function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes" + if status --is-interactive + commandline -f repaint ^/dev/null + end + end - function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes" - if status --is-interactive - commandline -f repaint ^/dev/null - end - end + function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes" + if status --is-interactive + commandline -f repaint ^/dev/null + end + end - # initialize our new variables - if not set -q __fish_classic_git_prompt_initialized - set -qU fish_color_user; or set -U fish_color_user -o green - set -qU fish_color_host; or set -U fish_color_host -o cyan - set -qU fish_color_status; or set -U fish_color_status red - set -U __fish_classic_git_prompt_initialized - end - end + # initialize our new variables + if not set -q __fish_classic_git_prompt_initialized + set -qU fish_color_user + or set -U fish_color_user -o green + set -qU fish_color_host + or set -U fish_color_host -o cyan + set -qU fish_color_status + or set -U fish_color_status red + set -U __fish_classic_git_prompt_initialized + end + end - set -l color_cwd - set -l prefix - switch $USER - 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 + set -l color_cwd + set -l prefix + switch $USER + 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 - set -l prompt_status - if test $last_status -ne 0 - set prompt_status ' ' (set_color $fish_color_status) "[$last_status]" "$normal" - end + set -l prompt_status + if test $last_status -ne 0 + set prompt_status ' ' (set_color $fish_color_status) "[$last_status]" "$normal" + end - echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $fish_color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (__fish_vcs_prompt) $normal $prompt_status "> " + echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $fish_color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (__fish_vcs_prompt) $normal $prompt_status "> " end diff --git a/share/tools/web_config/sample_prompts/debian_chroot.fish b/share/tools/web_config/sample_prompts/debian_chroot.fish index a1666ea97..249dc91ab 100644 --- a/share/tools/web_config/sample_prompts/debian_chroot.fish +++ b/share/tools/web_config/sample_prompts/debian_chroot.fish @@ -2,48 +2,55 @@ # author: Maurizio De Santis function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present' - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) + if not set -q __fish_prompt_normal + set -g __fish_prompt_normal (set_color normal) + end + + if not set -q __fish_prompt_chroot_env + set -g __fish_prompt_chroot_env (set_color yellow) + end + + # Set variable identifying the chroot you work in (used in the prompt below) + if begin + not set -q debian_chroot + and test -r /etc/debian_chroot end - - if not set -q __fish_prompt_chroot_env - set -g __fish_prompt_chroot_env (set_color yellow) + set debian_chroot (cat /etc/debian_chroot) + end + if begin + not set -q __fish_debian_chroot_prompt + and set -q debian_chroot + and test -n $debian_chroot end + set -g __fish_debian_chroot_prompt "($debian_chroot)" + end - # Set variable identifying the chroot you work in (used in the prompt below) - if begin; not set -q debian_chroot; and test -r /etc/debian_chroot; end - set debian_chroot (cat /etc/debian_chroot) - end - if begin; not set -q __fish_debian_chroot_prompt; and set -q debian_chroot; and test -n $debian_chroot; end - set -g __fish_debian_chroot_prompt "($debian_chroot)" - end + # Prepend the chroot environment if present + if set -q __fish_debian_chroot_prompt + echo -n -s "$__fish_prompt_chroot_env" "$__fish_debian_chroot_prompt" "$__fish_prompt_normal" ' ' + end - # Prepend the chroot environment if present - if set -q __fish_debian_chroot_prompt - echo -n -s "$__fish_prompt_chroot_env" "$__fish_debian_chroot_prompt" "$__fish_prompt_normal" ' ' - end + switch $USER - switch $USER + case root toor - case root toor - - 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 + 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 - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '# ' + echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '# ' - case '*' + case '*' - if not set -q __fish_prompt_cwd - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end + if not set -q __fish_prompt_cwd + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '> ' + echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '> ' - end + end end diff --git a/share/tools/web_config/sample_prompts/informative.fish b/share/tools/web_config/sample_prompts/informative.fish index 41468b39e..3f084bd30 100644 --- a/share/tools/web_config/sample_prompts/informative.fish +++ b/share/tools/web_config/sample_prompts/informative.fish @@ -6,41 +6,41 @@ function fish_prompt --description 'Write out the prompt' #Save the return status of the previous command set stat $status -if not set -q __fish_prompt_normal + if not set -q __fish_prompt_normal set -g __fish_prompt_normal (set_color normal) end -if not set -q __fish_color_blue + if not set -q __fish_color_blue set -g __fish_color_blue (set_color -o blue) end -#Set the color for the status depending on the value + #Set the color for the status depending on the value set __fish_color_status (set_color -o green) if test $stat -gt 0 set __fish_color_status (set_color -o red) end -switch $USER + switch $USER -case root toor + case root toor -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 + 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 + + printf '%s@%s %s%s%s# ' $USER (prompt_hostname) "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" + + case '*' + + if not set -q __fish_prompt_cwd set -g __fish_prompt_cwd (set_color $fish_color_cwd) end - end -printf '%s@%s %s%s%s# ' $USER (prompt_hostname) "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" - -case '*' - -if not set -q __fish_prompt_cwd - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end - -printf '[%s] %s%s@%s %s%s %s(%s)%s \f\r> ' (date "+%H:%M:%S") "$__fish_color_blue" $USER (prompt_hostname) "$__fish_prompt_cwd" "$PWD" "$__fish_color_status" "$stat" "$__fish_prompt_normal" + printf '[%s] %s%s@%s %s%s %s(%s)%s \f\r> ' (date "+%H:%M:%S") "$__fish_color_blue" $USER (prompt_hostname) "$__fish_prompt_cwd" "$PWD" "$__fish_color_status" "$stat" "$__fish_prompt_normal" -end + end end diff --git a/share/tools/web_config/sample_prompts/informative_vcs.fish b/share/tools/web_config/sample_prompts/informative_vcs.fish index c9fe667f6..f8d01faf8 100644 --- a/share/tools/web_config/sample_prompts/informative_vcs.fish +++ b/share/tools/web_config/sample_prompts/informative_vcs.fish @@ -4,94 +4,94 @@ function fish_prompt --description 'Write out the prompt' - if not set -q __fish_git_prompt_show_informative_status - set -g __fish_git_prompt_show_informative_status 1 - end - if not set -q __fish_git_prompt_hide_untrackedfiles - set -g __fish_git_prompt_hide_untrackedfiles 1 - end + if not set -q __fish_git_prompt_show_informative_status + set -g __fish_git_prompt_show_informative_status 1 + end + if not set -q __fish_git_prompt_hide_untrackedfiles + set -g __fish_git_prompt_hide_untrackedfiles 1 + end - if not set -q __fish_git_prompt_color_branch - set -g __fish_git_prompt_color_branch magenta --bold - end - if not set -q __fish_git_prompt_showupstream - set -g __fish_git_prompt_showupstream "informative" - end - if not set -q __fish_git_prompt_char_upstream_ahead - set -g __fish_git_prompt_char_upstream_ahead "↑" - end - if not set -q __fish_git_prompt_char_upstream_behind - set -g __fish_git_prompt_char_upstream_behind "↓" - end - if not set -q __fish_git_prompt_char_upstream_prefix - set -g __fish_git_prompt_char_upstream_prefix "" - end + if not set -q __fish_git_prompt_color_branch + set -g __fish_git_prompt_color_branch magenta --bold + end + if not set -q __fish_git_prompt_showupstream + set -g __fish_git_prompt_showupstream "informative" + end + if not set -q __fish_git_prompt_char_upstream_ahead + set -g __fish_git_prompt_char_upstream_ahead "↑" + end + if not set -q __fish_git_prompt_char_upstream_behind + set -g __fish_git_prompt_char_upstream_behind "↓" + end + if not set -q __fish_git_prompt_char_upstream_prefix + set -g __fish_git_prompt_char_upstream_prefix "" + end - if not set -q __fish_git_prompt_char_stagedstate - set -g __fish_git_prompt_char_stagedstate "●" - end - if not set -q __fish_git_prompt_char_dirtystate - set -g __fish_git_prompt_char_dirtystate "✚" - end - if not set -q __fish_git_prompt_char_untrackedfiles - set -g __fish_git_prompt_char_untrackedfiles "…" - end - if not set -q __fish_git_prompt_char_conflictedstate - set -g __fish_git_prompt_char_conflictedstate "✖" - end - if not set -q __fish_git_prompt_char_cleanstate - set -g __fish_git_prompt_char_cleanstate "✔" - end + if not set -q __fish_git_prompt_char_stagedstate + set -g __fish_git_prompt_char_stagedstate "●" + end + if not set -q __fish_git_prompt_char_dirtystate + set -g __fish_git_prompt_char_dirtystate "✚" + end + if not set -q __fish_git_prompt_char_untrackedfiles + set -g __fish_git_prompt_char_untrackedfiles "…" + end + if not set -q __fish_git_prompt_char_conflictedstate + set -g __fish_git_prompt_char_conflictedstate "✖" + end + if not set -q __fish_git_prompt_char_cleanstate + set -g __fish_git_prompt_char_cleanstate "✔" + end - if not set -q __fish_git_prompt_color_dirtystate - set -g __fish_git_prompt_color_dirtystate blue - end - if not set -q __fish_git_prompt_color_stagedstate - set -g __fish_git_prompt_color_stagedstate yellow - end - if not set -q __fish_git_prompt_color_invalidstate - set -g __fish_git_prompt_color_invalidstate red - end - if not set -q __fish_git_prompt_color_untrackedfiles - set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal - end - if not set -q __fish_git_prompt_color_cleanstate - set -g __fish_git_prompt_color_cleanstate green --bold - end + if not set -q __fish_git_prompt_color_dirtystate + set -g __fish_git_prompt_color_dirtystate blue + end + if not set -q __fish_git_prompt_color_stagedstate + set -g __fish_git_prompt_color_stagedstate yellow + end + if not set -q __fish_git_prompt_color_invalidstate + set -g __fish_git_prompt_color_invalidstate red + end + if not set -q __fish_git_prompt_color_untrackedfiles + set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal + end + if not set -q __fish_git_prompt_color_cleanstate + set -g __fish_git_prompt_color_cleanstate green --bold + end - set -l last_status $status + set -l last_status $status - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) - end + if not set -q __fish_prompt_normal + set -g __fish_prompt_normal (set_color normal) + end - set -l color_cwd - set -l prefix - switch $USER - 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 + set -l color_cwd + set -l prefix + switch $USER + 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 - # PWD - set_color $color_cwd - echo -n (prompt_pwd) - set_color normal + # PWD + set_color $color_cwd + echo -n (prompt_pwd) + set_color normal - printf '%s ' (__fish_vcs_prompt) + printf '%s ' (__fish_vcs_prompt) - if not test $last_status -eq 0 - set_color $fish_color_error - end + if not test $last_status -eq 0 + set_color $fish_color_error + end - echo -n "$suffix " + echo -n "$suffix " - set_color normal + set_color normal end diff --git a/share/tools/web_config/sample_prompts/justadollar.fish b/share/tools/web_config/sample_prompts/justadollar.fish index d39a2f4a2..a9b438a00 100644 --- a/share/tools/web_config/sample_prompts/justadollar.fish +++ b/share/tools/web_config/sample_prompts/justadollar.fish @@ -1,4 +1,4 @@ # name: Just a Dollar function fish_prompt - echo -n '$ ' + echo -n '$ ' end diff --git a/share/tools/web_config/sample_prompts/lonetwin.fish b/share/tools/web_config/sample_prompts/lonetwin.fish index cd4abfdc8..a8844017d 100644 --- a/share/tools/web_config/sample_prompts/lonetwin.fish +++ b/share/tools/web_config/sample_prompts/lonetwin.fish @@ -2,13 +2,13 @@ # author: Steve function fish_prompt --description 'Write out the prompt' - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) - end + if not set -q __fish_prompt_normal + set -g __fish_prompt_normal (set_color normal) + end - if not set -q __fish_prompt_cwd - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end + if not set -q __fish_prompt_cwd + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) (__fish_vcs_prompt) "$__fish_prompt_normal" '> ' + echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) (__fish_vcs_prompt) "$__fish_prompt_normal" '> ' end diff --git a/share/tools/web_config/sample_prompts/minimalist.fish b/share/tools/web_config/sample_prompts/minimalist.fish index 14cc04458..70fb357f6 100644 --- a/share/tools/web_config/sample_prompts/minimalist.fish +++ b/share/tools/web_config/sample_prompts/minimalist.fish @@ -2,8 +2,8 @@ # author: ridiculous_fish function fish_prompt - set_color $fish_color_cwd - echo -n (basename $PWD) - set_color normal - echo -n ' ) ' + set_color $fish_color_cwd + echo -n (basename $PWD) + set_color normal + echo -n ' ) ' end diff --git a/share/tools/web_config/sample_prompts/nim.fish b/share/tools/web_config/sample_prompts/nim.fish index ef3de3242..6c6616821 100644 --- a/share/tools/web_config/sample_prompts/nim.fish +++ b/share/tools/web_config/sample_prompts/nim.fish @@ -2,8 +2,11 @@ # author: Guilhem "Nim" Saurel − https://github.com/nim65s/dotfiles/ function fish_prompt - and set retc green; or set retc red - tty|string match -q -r tty; and set tty tty; or set tty pts + and set retc green + or set retc red + tty | string match -q -r tty + and set tty tty + or set tty pts set_color $retc if [ $tty = tty ] @@ -46,16 +49,16 @@ function fish_prompt echo -n (date +%X) set_color -o green echo -n ] - + if type -q acpi - if [ (acpi -a 2> /dev/null | string match -r off) ] - echo -n '─[' - set_color -o red - echo -n (acpi -b|cut -d' ' -f 4-) - set_color -o green - echo -n ']' - end - end + if [ (acpi -a 2> /dev/null | string match -r off) ] + echo -n '─[' + set_color -o red + echo -n (acpi -b|cut -d' ' -f 4-) + set_color -o green + echo -n ']' + end + end echo set_color normal for job in (jobs) diff --git a/share/tools/web_config/sample_prompts/pythonista.fish b/share/tools/web_config/sample_prompts/pythonista.fish index 6607e5b87..9529035c4 100644 --- a/share/tools/web_config/sample_prompts/pythonista.fish +++ b/share/tools/web_config/sample_prompts/pythonista.fish @@ -3,28 +3,28 @@ function fish_prompt - if not set -q VIRTUAL_ENV_DISABLE_PROMPT - set -g VIRTUAL_ENV_DISABLE_PROMPT true - end - set_color yellow - printf '%s' (whoami) - set_color normal - printf ' at ' + if not set -q VIRTUAL_ENV_DISABLE_PROMPT + set -g VIRTUAL_ENV_DISABLE_PROMPT true + end + set_color yellow + printf '%s' (whoami) + set_color normal + printf ' at ' - set_color magenta - echo -n (prompt_hostname) - set_color normal - printf ' in ' + set_color magenta + echo -n (prompt_hostname) + set_color normal + printf ' in ' - set_color $fish_color_cwd - printf '%s' (prompt_pwd) - set_color normal + set_color $fish_color_cwd + printf '%s' (prompt_pwd) + set_color normal - # Line 2 - echo - if test $VIRTUAL_ENV - printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal) - end - printf '↪ ' - set_color normal + # Line 2 + echo + if test $VIRTUAL_ENV + printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal) + end + printf '↪ ' + set_color normal end diff --git a/share/tools/web_config/sample_prompts/robbyrussell.fish b/share/tools/web_config/sample_prompts/robbyrussell.fish index 0a895ba4b..1e94127f9 100644 --- a/share/tools/web_config/sample_prompts/robbyrussell.fish +++ b/share/tools/web_config/sample_prompts/robbyrussell.fish @@ -3,74 +3,76 @@ function fish_prompt - if not set -q -g __fish_robbyrussell_functions_defined - set -g __fish_robbyrussell_functions_defined - function _git_branch_name - echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') + if not set -q -g __fish_robbyrussell_functions_defined + set -g __fish_robbyrussell_functions_defined + function _git_branch_name + echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') + end + + function _is_git_dirty + echo (git status -s --ignore-submodules=dirty ^/dev/null) + end + + function _is_git_repo + type -q git + or return 1 + git status -s >/dev/null ^/dev/null + end + + function _hg_branch_name + echo (hg branch ^/dev/null) + end + + function _is_hg_dirty + echo (hg status -mard ^/dev/null) + end + + function _is_hg_repo + type -q hg + or return 1 + hg summary >/dev/null ^/dev/null + end + + function _repo_branch_name + eval "_$argv[1]_branch_name" + end + + function _is_repo_dirty + eval "_is_$argv[1]_dirty" + end + + function _repo_type + if _is_hg_repo + echo 'hg' + else if _is_git_repo + echo 'git' + end + end end - function _is_git_dirty - echo (git status -s --ignore-submodules=dirty ^/dev/null) + set -l cyan (set_color -o cyan) + set -l yellow (set_color -o yellow) + set -l red (set_color -o red) + set -l blue (set_color -o blue) + set -l normal (set_color normal) + + set -l arrow "$red➜ " + if [ $USER = 'root' ] + set arrow "$red# " end - function _is_git_repo - type -q git; or return 1 - git status -s >/dev/null ^/dev/null + set -l cwd $cyan(basename (prompt_pwd)) + + set -l repo_type (_repo_type) + if [ $repo_type ] + set -l repo_branch $red(_repo_branch_name $repo_type) + set repo_info "$blue $repo_type:($repo_branch$blue)" + + if [ (_is_repo_dirty $repo_type) ] + set -l dirty "$yellow ✗" + set repo_info "$repo_info$dirty" + end end - function _hg_branch_name - echo (hg branch ^/dev/null) - end - - function _is_hg_dirty - echo (hg status -mard ^/dev/null) - end - - function _is_hg_repo - type -q hg; or return 1 - hg summary >/dev/null ^/dev/null - end - - function _repo_branch_name - eval "_$argv[1]_branch_name" - end - - function _is_repo_dirty - eval "_is_$argv[1]_dirty" - end - - function _repo_type - if _is_hg_repo - echo 'hg' - else if _is_git_repo - echo 'git' - end - end - end - - set -l cyan (set_color -o cyan) - set -l yellow (set_color -o yellow) - set -l red (set_color -o red) - set -l blue (set_color -o blue) - set -l normal (set_color normal) - - set -l arrow "$red➜ " - if [ $USER = 'root' ] - set arrow "$red# " - end - - set -l cwd $cyan(basename (prompt_pwd)) - - set -l repo_type (_repo_type) - if [ $repo_type ] - set -l repo_branch $red(_repo_branch_name $repo_type) - set repo_info "$blue $repo_type:($repo_branch$blue)" - - if [ (_is_repo_dirty $repo_type) ] - set -l dirty "$yellow ✗" - set repo_info "$repo_info$dirty" - end - end - - echo -n -s $arrow ' '$cwd $repo_info $normal ' ' + echo -n -s $arrow ' '$cwd $repo_info $normal ' ' end diff --git a/share/tools/web_config/sample_prompts/screen_savvy.fish b/share/tools/web_config/sample_prompts/screen_savvy.fish index 3d72178ec..411a55019 100644 --- a/share/tools/web_config/sample_prompts/screen_savvy.fish +++ b/share/tools/web_config/sample_prompts/screen_savvy.fish @@ -1,9 +1,9 @@ # name: Screen Savvy # author: Matthias function fish_prompt -d "Write out the prompt" - if test -z $WINDOW - printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) - else - printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) - end + if test -z $WINDOW + printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) + else + printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) + end end diff --git a/share/tools/web_config/sample_prompts/sorin.fish b/share/tools/web_config/sample_prompts/sorin.fish index 0869c22b6..60f40307c 100644 --- a/share/tools/web_config/sample_prompts/sorin.fish +++ b/share/tools/web_config/sample_prompts/sorin.fish @@ -2,51 +2,55 @@ # author: Ivan Tham function fish_prompt - test $SSH_TTY; and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' ' - test $USER = 'root'; and echo (set_color red)"#" + test $SSH_TTY + and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' ' + test $USER = 'root' + and echo (set_color red)"#" # Main - echo -n (set_color cyan)(prompt_pwd) (set_color red)'❯'(set_color yellow)'❯'(set_color green)'❯ ' + echo -n (set_color cyan)(prompt_pwd) (set_color red)'❯'(set_color yellow)'❯'(set_color green)'❯ ' end function fish_right_prompt # last status - test $status != 0; and printf (set_color red)"⏎ " + test $status != 0 + and printf (set_color red)"⏎ " - if git rev-parse ^ /dev/null + if git rev-parse ^/dev/null # Magenta if branch detached else green git branch -qv | grep "\*" | string match -rq detached - and set_color brmagenta - or set_color brgreen + and set_color brmagenta + or set_color brgreen # Need optimization on this block (eliminate space) git name-rev --name-only HEAD # Merging state - git merge -q ^ /dev/null; or printf ':'(set_color red)'merge' + git merge -q ^/dev/null + or printf ':'(set_color red)'merge' printf ' ' # Symbols - for i in (git branch -qv --no-color|grep \*|cut -d' ' -f4-|cut -d] -f1|tr , \n)\ - (git status --porcelain | cut -c 1-2 | uniq) - switch $i + for i in (git branch -qv --no-color|grep \*|cut -d' ' -f4-|cut -d] -f1|tr , \n)\ + (git status --porcelain | cut -c 1-2 | uniq) + switch $i case "*[ahead *" printf (set_color magenta)⬆' ' case "*behind *" printf (set_color magenta)⬇' ' - case "." - printf (set_color green)✚' ' - case " D" - printf (set_color red)✖' ' - case "*M*" - printf (set_color blue)✱' ' + case "." + printf (set_color green)✚' ' + case " D" + printf (set_color red)✖' ' + case "*M*" + printf (set_color blue)✱' ' case "*R*" printf (set_color brmagenta)➜' ' case "*U*" printf (set_color bryellow)═' ' - case "??" - printf (set_color brwhite)◼' ' - end - end - end + case "??" + printf (set_color brwhite)◼' ' + end + end + end end diff --git a/share/tools/web_config/sample_prompts/terlar.fish b/share/tools/web_config/sample_prompts/terlar.fish index c8dfefc39..d49ef340c 100644 --- a/share/tools/web_config/sample_prompts/terlar.fish +++ b/share/tools/web_config/sample_prompts/terlar.fish @@ -2,35 +2,35 @@ # author: terlar - https://github.com/terlar function fish_prompt --description 'Write out the prompt' - set -l last_status $status + set -l last_status $status - # User - set_color $fish_color_user - echo -n (whoami) - set_color normal + # User + set_color $fish_color_user + echo -n (whoami) + set_color normal - echo -n '@' + echo -n '@' - # Host - set_color $fish_color_host - echo -n (prompt_hostname) - set_color normal + # Host + set_color $fish_color_host + echo -n (prompt_hostname) + set_color normal - echo -n ':' + echo -n ':' - # PWD - set_color $fish_color_cwd - echo -n (prompt_pwd) - set_color normal + # PWD + set_color $fish_color_cwd + echo -n (prompt_pwd) + set_color normal - __terlar_git_prompt - __fish_hg_prompt - echo + __terlar_git_prompt + __fish_hg_prompt + echo - if not test $last_status -eq 0 - set_color $fish_color_error - end + if not test $last_status -eq 0 + set_color $fish_color_error + end - echo -n '➤ ' - set_color normal + echo -n '➤ ' + set_color normal end diff --git a/share/tools/web_config/sample_prompts/user_host_path.fish b/share/tools/web_config/sample_prompts/user_host_path.fish index c7483b6a0..4082610a6 100644 --- a/share/tools/web_config/sample_prompts/user_host_path.fish +++ b/share/tools/web_config/sample_prompts/user_host_path.fish @@ -2,12 +2,14 @@ # author: Jon Clayden function fish_prompt -d "Write out the prompt" - set -l home_escaped (echo -n $HOME | sed 's/\//\\\\\//g') - set -l pwd (echo -n $PWD | sed "s/^$home_escaped/~/" | sed 's/ /%20/g') - set -l prompt_symbol '' - switch $USER - case root toor; set prompt_symbol '#' - case '*'; set prompt_symbol '$' - end - printf "[%s@%s %s%s%s]%s " $USER (prompt_hostname) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol + set -l home_escaped (echo -n $HOME | sed 's/\//\\\\\//g') + set -l pwd (echo -n $PWD | sed "s/^$home_escaped/~/" | sed 's/ /%20/g') + set -l prompt_symbol '' + switch $USER + case root toor + set prompt_symbol '#' + case '*' + set prompt_symbol '$' + end + printf "[%s@%s %s%s%s]%s " $USER (prompt_hostname) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol end