From 39dcb58a9bc88c50892ca1bf6229886fa0d254ec Mon Sep 17 00:00:00 2001
From: Daniel Lundin <dln@arity.se>
Date: Sun, 6 Oct 2024 23:00:01 +0200
Subject: [PATCH] fish: show command duration after longer command

---
 home/common/fish.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/home/common/fish.nix b/home/common/fish.nix
index e91cb4d..239fe59 100644
--- a/home/common/fish.nix
+++ b/home/common/fish.nix
@@ -107,6 +107,12 @@
 
       fish_right_prompt.body = ''
         fish_jj_prompt || fish_vcs_prompt
+        if test $CMD_DURATION -gt 3000
+          # Show duration of the last command in seconds
+          set duration (echo "$CMD_DURATION 1000" | awk '{printf "%.1fs", $1 / $2}')
+          echo " ⏳$duration"
+        end
+
       '';
 
       transient_prompt_func.body = ''