Last active
July 15, 2020 12:50
-
-
Save nikopol/4a33eb01fc0add910b71 to your computer and use it in GitHub Desktop.
This file contains 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_right_prompt | |
set -l delay | |
set -l now (date +%s) | |
if set -q __fish_last_prompt | |
set -g dur (math $now - $__fish_last_prompt) | |
if test $dur -lt 120 | |
set delay (printf '%ds' $dur) | |
else if test $dur -lt 3600 | |
set delay (printf '%d:%02d' (math "floor($dur / 60)") (math "$dur % 60")) | |
else | |
set delay (printf '%d:%02d:%02d' (math "floor($dur / 3600)") (math "floor(($dur % 3600) / 60)") (math "$dur % 60")) | |
end | |
end | |
set -g __fish_last_prompt $now | |
printf '%s%s %s %s%s' (set_color blue) $delay $status (date +%H:%M) (set_color normal) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in ~/.config/fish/functions/