fish: Make prompt look prettier

This commit is contained in:
Sijmen 2018-11-25 21:50:36 +01:00
parent 27a1bb58c2
commit 96fc54c91e

View file

@ -1,12 +1,5 @@
#!/usr/bin/fish
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set red (set_color red)
set gray (set_color -o black)
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
@ -17,31 +10,55 @@ 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_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 __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
echo
set last_status $status
set_color -o $fish_color_cwd
set_color -o $fish_color_cwd -b $__prompt_bg
echo -n $PWD | sed -e "s,^$HOME,~,"
set_color normal
set_color normal -b $__prompt_bg
printf '%s' (__fish_git_prompt)
set_color normal
printf '%s\e[K\n' (__fish_git_prompt | sed -r 's/(\x1B\[0?)m/\139m/')
if [ "$USER" = "root" ]
set_color red
echo -n "# "
else
if [ "$USER" = "sijmen" ]
set_color blue
else
set_color yellow
end
echo -n "\$ "
end
set_color black
echo -n ""
set_color normal
echo -n " "
echo
z --add "$PWD"
echo -n "\$ "
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