oh-my-fish/themes/jacaetevha/fish_prompt.fish

42 lines
953 B
Fish
Raw Normal View History

# name: Jacaetevha
2013-06-06 12:18:31 +08:00
function tbytes -d 'calculates the total size of the files in the current directory'
set -l tBytes (ls -al | grep "^-" | awk 'BEGIN {i=0} { i += $5 } END { print i }')
if test $tBytes -lt 1048576
set -g total (echo -e "scale=3 \n$tBytes/1048 \nquit" | bc)
set -g units " Kb"
else
set -g total (echo -e "scale=3 \n$tBytes/1048576 \nquit" | bc)
set -g units " Mb"
end
echo -n "$total$units"
end
2013-06-06 04:34:49 +08:00
2013-06-06 12:18:31 +08:00
function fish_prompt
2013-06-06 00:50:11 +08:00
set_color yellow
printf '%s' (whoami)
set_color normal
printf ' at '
2013-06-06 00:42:51 +08:00
2013-06-06 00:50:11 +08:00
set_color magenta
printf '%s' (hostname|cut -d . -f 1)
set_color normal
printf ' in '
2013-06-06 00:42:51 +08:00
2013-06-06 00:50:11 +08:00
set_color $fish_color_cwd
printf '%s ' (prompt_pwd)
set_color blue
2013-06-06 04:34:49 +08:00
printf '%s' (tbytes)
2013-06-06 00:50:11 +08:00
set_color normal
printf '%s' (__fish_git_prompt)
2013-06-06 00:42:51 +08:00
2013-06-06 00:50:11 +08:00
# Line 2
echo
if test $VIRTUAL_ENV
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end
printf '↪ '
set_color normal
2013-06-06 00:42:51 +08:00
end