commit 5acc3ab85502d3e7d96206dbfb2a14fdee2eed99
parent 49b5d033f05e528b30d920eb9c9868e3291d4442
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Tue, 16 Mar 2021 03:38:11 -0700
Update shell history functions
- Remove redundent r function which is already defined by ksh(1)
- Add the hm function to re-execute a command selected using dmenu(1)
- Use egrep(1) directly on the HISTFILE in hs, improving efficiency
and removing the distasteful indentation
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/local/shell/.config/shell/hist b/local/shell/.config/shell/hist
@@ -1,7 +1,5 @@
# history shell functions
-unalias r 2>/dev/null
-
-k() fc -s
-r() fc -s "$@"
-hs() { fc -nl 0 | egrep "$@" ;}
+hm() { eval "$(hs "$@" | dmenu)" ;}
+hs() egrep "${@:-.}" "$HISTFILE"
+k() r