z_mirror/dotfiles

git clone https://git.raiguard.me/z_mirror/dotfiles

Caleb HeuerLet's try fish!464c06e

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