fork/fish-shell

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

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

master
2.1 KiB64 linesraw
1# name: Informative Vcs
2# author: Mariusz Smykula <mariuszs at gmail.com>
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
8    if not set -q __fish_git_prompt_show_informative_status
9        set -g __fish_git_prompt_show_informative_status 1
10    end
11    if not set -q __fish_git_prompt_hide_untrackedfiles
12        set -g __fish_git_prompt_hide_untrackedfiles 1
13    end
14    if not set -q __fish_git_prompt_color_branch
15        set -g __fish_git_prompt_color_branch magenta --bold
16    end
17    if not set -q __fish_git_prompt_showupstream
18        set -g __fish_git_prompt_showupstream informative
19    end
20    if not set -q __fish_git_prompt_color_dirtystate
21        set -g __fish_git_prompt_color_dirtystate blue
22    end
23    if not set -q __fish_git_prompt_color_stagedstate
24        set -g __fish_git_prompt_color_stagedstate yellow
25    end
26    if not set -q __fish_git_prompt_color_invalidstate
27        set -g __fish_git_prompt_color_invalidstate red
28    end
29    if not set -q __fish_git_prompt_color_untrackedfiles
30        set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
31    end
32    if not set -q __fish_git_prompt_color_cleanstate
33        set -g __fish_git_prompt_color_cleanstate green --bold
34    end
35
36    set -l color_cwd
37    set -l suffix
38    if functions -q fish_is_root_user; and fish_is_root_user
39        if set -q fish_color_cwd_root
40            set color_cwd $fish_color_cwd_root
41        else
42            set color_cwd $fish_color_cwd
43        end
44        set suffix '#'
45    else
46        set color_cwd $fish_color_cwd
47        set suffix '$'
48    end
49
50    # PWD
51    set_color $color_cwd
52    echo -n (prompt_pwd)
53    set_color --reset
54
55    printf '%s ' (fish_vcs_prompt)
56
57    set -l status_color (set_color $fish_color_status)
58    set -l statusb_color (set_color --bold $fish_color_status)
59    set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
60    echo -n $prompt_status
61    set_color --reset
62
63    echo -n "$suffix "
64end