about summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-04-26 11:42:59 -0500
committerStarfall <us@starfall.systems>2022-04-26 11:42:59 -0500
commitbdc85838769994d6f6e4285ccbfcab8d6dbf90b2 (patch)
tree4a36df92009f15f8d9747d8e99ed68c9d9128689 /.config
parente3ed0f1d893b8e4f31f55b2cebaa19e3d90a5887 (diff)
zsh: make `h` alias more powerful
* do not require quotes
* run `fc -l` like builtin `history` when no args are provided
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/history.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/.config/zsh/history.zsh b/.config/zsh/history.zsh
index eb04ef9..edfc9e1 100644
--- a/.config/zsh/history.zsh
+++ b/.config/zsh/history.zsh
@@ -10,4 +10,10 @@ setopt hist_ignore_all_dups # deduplicate entire history file
 setopt hist_verify          # confirm before executing
 setopt share_history        # import all of history in new sessions
 
-alias h='fc -l 0 | grep' # search all of history
+# search all of history, or display just the last 16 like the builtin `history`
+# yes we should probably just use fzf which we have installed just for this
+function h () {
+	[ $# -eq 0 ] &&\
+		fc -l ||\
+		fc -l 0 | grep "$*"
+}