Skip to content

Instantly share code, notes, and snippets.

@sagax
Last active January 17, 2019 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagax/40c231b44a251a9660241ce27f9fd89a to your computer and use it in GitHub Desktop.
Save sagax/40c231b44a251a9660241ce27f9fd89a to your computer and use it in GitHub Desktop.
fishrc ps1 with git
set -gx TERM "xterm-256color"
set -gx EDITOR "vim"
set c_off "\e[0m"
set c_bold_on "\e[1m"
set c_light_on "\e[2m"
set c_underscore "\e[4m"
set c_blink_on "\e[5m"
set c_reverse "\e[7m"
set c_concealed_on "\e[8m"
set c_f_blue "\e[34m"
set c_f_red "\e[38;2;255;0;0m"
set c_f_green "\e[38;2;0;255;0m"
set c_f_white "\e[38;2;255;255;255m"
set c_f_gray "\e[38;2;128;128;128m"
set c_f_slate_gray "\e[38;2;112;128;144m"
set c_f_dodger_blue "\e[38;2;30;144;255m"
set c_f_light_steel_blue "\e[38;2;176;196;222m"
set c_f_lime_green "\e[38;2;50;205;50m"
set symbol1 "\xE2\x97\x88"
set symbol2 "\xE2\x9D\xAF"
set symbol3 "\xE2\x9C\xB8"
function fish_prompt
set -g status_l $status
printf "%s%s%s%s%s %s%b%b %b " \
(if test (whoami) = "root"; printf "%b%b%s%b" $c_bold_on $c_f_red (whoami) $c_off; else; printf "%b%b%b%b" $c_bold_on $c_f_blue (whoami) $c_off; end) \
(printf "%b%b%b%b" $c_light_on $c_f_light_steel_blue $symbol1 $c_off) \
(printf "%b%b%b%b" $c_bold_on $c_f_dodger_blue (hostname) $c_off) \
(set check_git_exist (__fish_git_prompt "%s"); if test $status -eq 0; printf "%b%b%b%b" $c_bold_on $c_f_lime_green (__fish_git_prompt " (%s) ") $c_off; else; printf " "; end) \
(printf "%b%b%b%b" $c_bold_on $c_f_slate_gray (date +%X) $c_off) \
(printf "%b%b%b%b" $c_bold_on $c_f_gray (prompt_pwd) $c_off) \
"\n" \
(if test $status_l -eq 0; printf "%b%b%b" $c_f_green $symbol3 $c_off; else; printf "%b%b%b" $c_f_red $symbol3 $c_off; end) \
(if test (whoami) = "root"; printf "%b%b%b%b" $c_bold_on $c_f_red $symbol2 $c_off; else; printf "%b%b%b" $c_f_white $symbol2 $c_off; end)
end
function fish_greeting
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment