From b58072207162b78cb2c3f6646d5d315e02f4bbf6 Mon Sep 17 00:00:00 2001 From: scbj Date: Wed, 15 Oct 2025 09:24:34 +0200 Subject: [PATCH] (scripts) fixed `fzf-bash-history` script --- scripts/fzf-bash-history.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/fzf-bash-history.sh b/scripts/fzf-bash-history.sh index acff17a..02a6def 100644 --- a/scripts/fzf-bash-history.sh +++ b/scripts/fzf-bash-history.sh @@ -2,11 +2,7 @@ function __search-history { current_line="${READLINE_LINE}" - if [[ -n $current_line ]]; then - command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right -q ${current_line})) - else - command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right)) - fi + command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right -q "${current_line}")) # print command to terminal for editting if [[ ${command[0]} = "tab" || ${command[0]} = "right" ]]; then @@ -17,11 +13,10 @@ function __search-history { # strip white space command="${command[@]}" READLINE_LINE="${command}" - READLINE_POINT=$(( 0 + ${#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 -