summaryrefslogtreecommitdiffstats
path: root/.config/fish/functions/fish_prompt.fish
blob: 7d6f3e72e817693de2929dbc17207e0ca76f4b7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function fish_prompt
    set -l __last_command_exit_status $status

    set -l cyan (set_color -o cyan)
    set -l red (set_color -o red)
    set -l green (set_color -o green)
    set -l normal (set_color normal)

    set -l marker_color "$green"
    if test $__last_command_exit_status != 0
        set marker_color "$red"
    end

    set -l marker "$marker_color" "δ"
    if fish_is_root_user
        set marker "$marker_color# "
    end

    if set -q SSH_TTY
        set marker "⸢$(prompt_hostname)⸥ " "$marker_color" "ζ"
    end

    set -l cwd $cyan (string join / (string split -r -m3 / (prompt_pwd))[-3..-1])

    echo -n -s $marker ' ' $cwd $normal ' '
end