fork/fish-shell

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

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

master
1.2 KiB34 linesraw
1# name: Astronaut
2# author: Radu Potop
3# description: A prompt theme similar to Starship.rs but without the emojis.
4
5function fish_prompt --description 'Write out the prompt'
6    set -l last_status $status
7    set -l normal (set_color --reset)
8    set -l status_color (set_color brgreen)
9    set -l cwd_color (set_color $fish_color_cwd)
10    set -l vcs_color (set_color brpurple)
11    set -l prompt_status ""
12
13    # Since we display the prompt on a new line allow the directory names to be longer.
14    set -q fish_prompt_pwd_dir_length
15    or set -lx fish_prompt_pwd_dir_length 0
16
17    # Color the prompt differently when we're root
18    set -l suffix '❯'
19    if functions -q fish_is_root_user; and fish_is_root_user
20        if set -q fish_color_cwd_root
21            set cwd_color (set_color $fish_color_cwd_root)
22        end
23        set suffix '#'
24    end
25
26    # Color the prompt in red on error
27    if test $last_status -ne 0
28        set status_color (set_color $fish_color_error)
29        set prompt_status $status_color "[" $last_status "]" $normal
30    end
31
32    echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
33    echo -n -s $status_color $suffix ' ' $normal
34end