usuable fzf-script

This commit is contained in:
scbj
2025-01-27 13:45:57 +01:00
parent 12e38b4188
commit d33f176595

View File

@@ -1,3 +1,18 @@
alias search-history='eval $(fc -lnr 1 | fzf --tmux )'
function __search-history {
current_line="${READLINE_LINE}"
if [[ -n $current_line ]]; then
command=$(fc -lnr 1 | fzf --scheme=history --tmux -q ${current_line})
else
command=$(fc -lnr 1 | fzf --scheme=history --tmux)
fi
command=$(echo $command | xargs)
READLINE_LINE="${command}"
READLINE_POINT=$(( 0 + ${#command} ))
}
if command -v fzf 2>&1 >/dev/null; then
bind -r "\C-r"
bind -x '"\C-r": __search-history'
fi