|
| 1 | +function fish_prompt |
| 2 | + # Cache exit status |
| 3 | + set -l last_status $status |
| 4 | + |
| 5 | + # Just calculate these once, to save a few cycles when displaying the prompt |
| 6 | + if not set -q __fish_prompt_hostname |
| 7 | + set -g __fish_prompt_hostname (hostname|cut -d . -f 1) |
| 8 | + end |
| 9 | + if not set -q __fish_prompt_char |
| 10 | + switch (id -u) |
| 11 | + case 0 |
| 12 | + set -g __fish_prompt_char '#' |
| 13 | + case '*' |
| 14 | + set -g __fish_prompt_char 'λ' |
| 15 | + end |
| 16 | + end |
| 17 | + |
| 18 | + # Setup colors |
| 19 | + #use extended color pallete if available |
| 20 | +#if [[ $terminfo[colors] -ge 256 ]]; then |
| 21 | +# turquoise="%F{81}" |
| 22 | +# orange="%F{166}" |
| 23 | +# purple="%F{135}" |
| 24 | +# hotpink="%F{161}" |
| 25 | +# limegreen="%F{118}" |
| 26 | +#else |
| 27 | +# turquoise="%F{cyan}" |
| 28 | +# orange="%F{yellow}" |
| 29 | +# purple="%F{magenta}" |
| 30 | +# hotpink="%F{red}" |
| 31 | +# limegreen="%F{green}" |
| 32 | +#fi |
| 33 | + set -l normal (set_color normal) |
| 34 | + set -l white (set_color white) |
| 35 | + set -l turquoise (set_color cyan) |
| 36 | + set -l orange (set_color yellow) |
| 37 | + set -l hotpink (set_color red) |
| 38 | + set -l blue (set_color blue) |
| 39 | + set -l limegreen (set_color green) |
| 40 | + set -l purple (set_color magenta) |
| 41 | + |
| 42 | + # Configure __fish_git_prompt |
| 43 | + set -g __fish_git_prompt_char_stateseparator ' ' |
| 44 | + set -g __fish_git_prompt_color cyan |
| 45 | + set -g __fish_git_prompt_color_flags yellow |
| 46 | + set -g __fish_git_prompt_color_prefix white |
| 47 | + set -g __fish_git_prompt_color_suffix white |
| 48 | + set -g __fish_git_prompt_showdirtystate true |
| 49 | + set -g __fish_git_prompt_showuntrackedfiles true |
| 50 | + set -g __fish_git_prompt_showstashstate true |
| 51 | + set -g __fish_git_prompt_show_informative_status true |
| 52 | + |
| 53 | + # Line 1 |
| 54 | + echo -n $white'╭─'$hotpink$USER$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd)$turquoise |
| 55 | + __fish_git_prompt " (%s)" |
| 56 | + echo |
| 57 | + |
| 58 | + # Line 2 |
| 59 | + echo -n $white'╰─'$__fish_prompt_char $normal |
| 60 | +end |
| 61 | + |
| 62 | + |
0 commit comments