(scripts) added reasonable behaviour for escape to fzf script

This commit is contained in:
scbj
2025-11-11 15:12:23 +01:00
parent 18c0f5075f
commit eb82349ac5

View File

@@ -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"