From bdc85838769994d6f6e4285ccbfcab8d6dbf90b2 Mon Sep 17 00:00:00 2001 From: Starfall Date: Tue, 26 Apr 2022 11:42:59 -0500 Subject: zsh: make `h` alias more powerful * do not require quotes * run `fc -l` like builtin `history` when no args are provided --- .config/zsh/history.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 "$*" +} -- cgit