fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Nahorcolor: prefer `set_color --reset` over `set_color normal`867946468

master
1.3 KiB32 linesraw
1# name: Default
2# author: Lily Ballard
3
4function fish_prompt --description 'Write out the prompt'
5    set -l last_pipestatus $pipestatus
6    set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
7    set -l normal (set_color --reset)
8
9    # Color the prompt differently when we're root
10    set -l color_cwd $fish_color_cwd
11    set -l suffix '>'
12    if functions -q fish_is_root_user; and fish_is_root_user
13        if set -q fish_color_cwd_root
14            set color_cwd $fish_color_cwd_root
15        end
16        set suffix '#'
17    end
18
19    # Write pipestatus
20    # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it.
21    set -l bold_flag --bold
22    set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
23    if test $__fish_prompt_status_generation = $status_generation
24        set bold_flag
25    end
26    set __fish_prompt_status_generation $status_generation
27    set -l status_color (set_color $fish_color_status)
28    set -l statusb_color (set_color $bold_flag $fish_color_status)
29    set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
30
31    echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
32end