Last active
July 9, 2021 14:04
-
-
Save nikopol/eda66eaf18f3b8b92f65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt | |
set sepcol (set_color -o blue) | |
set hstcol (set_color -o yellow) | |
set pthcol (set_color cyan) | |
set gitcol (set_color normal) | |
if test $USER = "root" | |
set usrcol (set_color red) | |
else | |
set usrcol (set_color -o green) | |
end | |
set gitbranch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') | |
set gitprompt | |
if test "$gitbranch" != "" | |
set gitstcount (git status -s --ignore-submodules=dirty --untracked-files=no ^/dev/null | wc -l) | |
if test $gitstcount -gt 0 | |
set gitprompt (printf '%s[%s%s:%d%s]' $sepcol $gitcol $gitbranch $gitstcount $sepcol) | |
else | |
set gitprompt (printf '%s[%s%s%s]' $sepcol $gitcol $gitbranch $sepcol) | |
end | |
end | |
printf '%s%s%s@%s%s%s:%s%s%s%s▶%s ' $usrcol (whoami) $sepcol $hstcol (hostname|cut -d . -f 1) $sepcol $pthcol (prompt_pwd) $gitprompt $sepcol (set_color normal) | |
end |
^/dev/null
becomes 2>/dev/null
for fish >= 3.3.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in ~/.config/fish/functions/