(scripts) fixed conditions to replace C-r with fzf

This commit is contained in:
scbj
2025-11-28 11:35:34 +01:00
parent 75400b59d7
commit b911c1b910

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
[[ "$-" != "*i*" ]] || return
function __search-history { function __search-history {
current_line="${READLINE_LINE}" current_line="${READLINE_LINE}"
command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right -q "${current_line}")) command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right -q "${current_line}"))
@@ -25,7 +23,7 @@ function __search-history {
READLINE_POINT=$((0 + ${#command})) READLINE_POINT=$((0 + ${#command}))
} }
if command -v fzf 2>&1 >/dev/null; then if [[ "$-" == *i* ]] && which fzf &>/dev/null; then
bind -r "\C-r" bind -r "\C-r"
bind -x '"\C-r": __search-history' bind -x '"\C-r": __search-history'
fi fi