fork/fish-shell

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

saku0512prompts: strip control characters from VCS state and PWDcbc3cd21f

master
1.1 KiB23 linesraw
1# name: Informative
2# http://michal.karzynski.pl/blog/2009/11/19/my-informative-shell-prompt/
3
4function fish_prompt --description 'Informative prompt'
5    #Save the return status of the previous command
6    set -l last_pipestatus $pipestatus
7    set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
8
9    if functions -q fish_is_root_user; and fish_is_root_user
10        printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root
11                                                         and set_color $fish_color_cwd_root
12                                                         or set_color $fish_color_cwd) \
13            (prompt_pwd) (set_color --reset)
14    else
15        set -l status_color (set_color $fish_color_status)
16        set -l statusb_color (set_color --bold $fish_color_status)
17        set -l pipestatus_string (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
18
19        printf '[%s] %s%s@%s %s%s %s%s%s \n> ' (date "+%H:%M:%S") (set_color brblue) \
20            $USER (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) $pipestatus_string \
21            (set_color --reset)
22    end
23end