69 lines
1.6 KiB
Fish
69 lines
1.6 KiB
Fish
#!/usr/bin/fish
|
|
|
|
# Fish git prompt
|
|
set __fish_git_prompt_showdirtystate 'yes'
|
|
set __fish_git_prompt_showstashstate 'yes'
|
|
set __fish_git_prompt_showuntrackedfiles 'yes'
|
|
set __fish_git_prompt_showupstream 'yes'
|
|
set __fish_git_prompt_color_branch yellow
|
|
set __fish_git_prompt_color_upstream_ahead green
|
|
set __fish_git_prompt_color_upstream_behind red
|
|
|
|
# Status Chars
|
|
set __fish_git_prompt_char_dirtystate '+'
|
|
set __fish_git_prompt_char_stagedstate '•'
|
|
set __fish_git_prompt_char_untrackedfiles '…'
|
|
set __fish_git_prompt_char_stashstate '⚑'
|
|
set __fish_git_prompt_char_upstream_ahead '⇡'
|
|
set __fish_git_prompt_char_upstream_behind '⇣'
|
|
|
|
set __prompt_bg 35373b
|
|
|
|
|
|
function fish_prompt
|
|
echo
|
|
|
|
if [ (id -u) -eq "0" ]
|
|
set_color -o red -b $__prompt_bg
|
|
else
|
|
set_color -o green -b $__prompt_bg
|
|
end
|
|
|
|
echo -n $PWD | sed -e "s,^$HOME,~,"
|
|
set_color normal -b $__prompt_bg
|
|
|
|
printf '%s\e[K\n' (__fish_git_prompt | sed -r 's/(\x1B\[0?)m/\139m/')
|
|
|
|
if [ (id -u) -eq "0" ]
|
|
set_color red
|
|
echo -n "# "
|
|
else
|
|
if [ "$USER" = "sijmen" ]
|
|
set_color green
|
|
else
|
|
set_color blue
|
|
end
|
|
echo -n "\$ "
|
|
end
|
|
|
|
set_color black
|
|
echo -n ""
|
|
set_color normal
|
|
echo -n " "
|
|
|
|
z --add "$PWD"
|
|
end
|
|
|
|
|
|
function fish_right_prompt
|
|
if [ $CMD_DURATION -lt 3000 ]
|
|
return
|
|
end
|
|
|
|
echo -n " "
|
|
set_color black -b $__prompt_bg
|
|
echo -n ""
|
|
set_color blue
|
|
printf " %dm %02ds" (expr $CMD_DURATION / 60000) (expr $CMD_DURATION / 1000 \% 60)
|
|
set_color normal
|
|
end
|