From eb82349ac542750e34336498b57bcad0a97b9902 Mon Sep 17 00:00:00 2001 From: scbj Date: Tue, 11 Nov 2025 15:12:23 +0100 Subject: [PATCH] (scripts) added reasonable behaviour for `escape` to fzf script --- scripts/fzf-bash-history.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/fzf-bash-history.sh b/scripts/fzf-bash-history.sh index 02a6def..e795e16 100644 --- a/scripts/fzf-bash-history.sh +++ b/scripts/fzf-bash-history.sh @@ -4,6 +4,13 @@ function __search-history { current_line="${READLINE_LINE}" command=($(fc -lnr 1 | fzf --scheme=history --tmux --expect=tab,right -q "${current_line}")) + # restore readline on `escape` + if [[ -z "${command}" ]]; then + READLINE_LINE="${current_line}" + READLINE_POINT=$((0 + ${#current_line})) + return 0 + fi + # print command to terminal for editting if [[ ${command[0]} = "tab" || ${command[0]} = "right" ]]; then edit="true"