From d7c44fae633bdc276c110e37f4cc082e6207a524 Mon Sep 17 00:00:00 2001 From: Eduard Tolosa Date: Thu, 5 Jun 2025 00:06:29 -0500 Subject: [PATCH] (feat): show the last command on top per-directory --- functions/__based.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/__based.fish b/functions/__based.fish index bf55b17..ff315ed 100644 --- a/functions/__based.fish +++ b/functions/__based.fish @@ -44,10 +44,12 @@ function __based else set -f results (sqlite3 -batch $db " SELECT DISTINCT cmd FROM ( - -- Get the most recent command across all paths + -- Get the most recent command across the current path to emulate the normal history behavior + -- This ensures that the most recent command is always at the top SELECT cmd, max_ts, counter, priority FROM ( SELECT cmd, MAX(ts) as max_ts, MAX(counter) as counter, 0 as priority FROM log + WHERE path = '$path' GROUP BY cmd ORDER BY max_ts DESC LIMIT 1