added fzy history shortcut

This commit is contained in:
Rudis Muiznieks 2025-03-19 11:36:08 -05:00
parent d446bf51c4
commit 5fd15e5b07
Signed by: rudism
GPG key ID: CABF2F86EF7884F9
2 changed files with 13 additions and 2 deletions

View file

@ -8,14 +8,16 @@ set --notify-le
set --le-no-conv-meta
set --le-predict
! [ -d ~/.cache/yash ] && mkdir -p ~/.cache/yash
HISTRMDUP=50
HISTFILE=~/.cache/yash/history
HISTSIZE=100000
HISTSIZE=50000
PS1P="\fi"
FCEDIT=hx
# prompt and z
# yash extension scripts
. ~/skynet/yash/polyglot.sh
. ~/skynet/yash/z.sh
. ~/skynet/yash/fzy-hist.sh
# environment setup
export PURE_GIT_PULL=0

9
yash/fzy-hist.sh Normal file
View file

@ -0,0 +1,9 @@
h() {
input="$*"
SED_ARG='s/^[[:digit:]]*[[:space:]]*//'
if [ -n "$input" ]; then
history | sed '$d' | sort --reverse --numeric-sort | fzy -q"$input" | sed "$SED_ARG" | tr -d '\n' | wl-copy 2>/dev/null
else
history | sed '$d' | sort --reverse --numeric-sort | fzy | sed "$SED_ARG" | tr -d '\n' | wl-copy 2>/dev/null
fi
}