Skip to content

Instantly share code, notes, and snippets.

@nikopol
Last active July 15, 2020 12:50
Show Gist options
  • Save nikopol/4a33eb01fc0add910b71 to your computer and use it in GitHub Desktop.
Save nikopol/4a33eb01fc0add910b71 to your computer and use it in GitHub Desktop.
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
@nikopol
Copy link
Author

nikopol commented Apr 12, 2017

in ~/.config/fish/functions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment