2018-06-09 22:17:36 +00:00
|
|
|
#!/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
|
2018-06-09 22:42:20 +00:00
|
|
|
set __fish_git_prompt_char_dirtystate '+'
|
2018-11-25 20:50:36 +00:00
|
|
|
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 '⇣'
|
2018-06-09 22:17:36 +00:00
|
|
|
|
2018-11-25 20:50:36 +00:00
|
|
|
set __prompt_bg 35373b
|
2018-06-09 22:17:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
function fish_prompt
|
2018-11-25 20:50:36 +00:00
|
|
|
echo
|
2018-06-09 22:17:36 +00:00
|
|
|
|
2018-11-25 20:50:36 +00:00
|
|
|
set_color -o $fish_color_cwd -b $__prompt_bg
|
2018-06-09 22:42:20 +00:00
|
|
|
echo -n $PWD | sed -e "s,^$HOME,~,"
|
2018-11-25 20:50:36 +00:00
|
|
|
set_color normal -b $__prompt_bg
|
|
|
|
|
|
|
|
printf '%s\e[K\n' (__fish_git_prompt | sed -r 's/(\x1B\[0?)m/\139m/')
|
|
|
|
|
2018-11-25 20:52:21 +00:00
|
|
|
if [ (id -u) -eq "0" ]
|
2018-11-25 20:50:36 +00:00
|
|
|
set_color red
|
|
|
|
echo -n "# "
|
|
|
|
else
|
|
|
|
if [ "$USER" = "sijmen" ]
|
|
|
|
set_color blue
|
|
|
|
else
|
|
|
|
set_color yellow
|
|
|
|
end
|
|
|
|
echo -n "\$ "
|
|
|
|
end
|
2018-06-09 22:17:36 +00:00
|
|
|
|
2018-11-25 20:50:36 +00:00
|
|
|
set_color black
|
|
|
|
echo -n ""
|
|
|
|
set_color normal
|
|
|
|
echo -n " "
|
2018-06-09 22:17:36 +00:00
|
|
|
|
2018-08-28 21:54:25 +00:00
|
|
|
z --add "$PWD"
|
2018-11-25 20:50:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function fish_right_prompt
|
|
|
|
if [ $CMD_DURATION -lt 3000 ]
|
|
|
|
return
|
|
|
|
end
|
2018-06-09 22:42:20 +00:00
|
|
|
|
2018-11-25 20:50:36 +00:00
|
|
|
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
|
2018-06-09 22:17:36 +00:00
|
|
|
end
|