From c72b34eb424aa24a49f3ca8a5ae48e13db3378c7 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 5 Oct 2023 10:04:38 +0200 Subject: [PATCH] zsh: make CTRL-R backwards compatible to v0.21.0 I am still using Debian 11 on some machines, which has fzf 0.21.0. This version doesn't accept `--schema=history` yet (introduced in 0.33.0), so I replaced it with `--tiebreak=index` and `--reverse`. --- config/zsh/line-editor-fzf.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/zsh/line-editor-fzf.zsh b/config/zsh/line-editor-fzf.zsh index dfb473c..83f4e5b 100644 --- a/config/zsh/line-editor-fzf.zsh +++ b/config/zsh/line-editor-fzf.zsh @@ -98,7 +98,7 @@ fzf-history-widget() { local selected num setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null selected=( $(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' | - FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) + FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} -n2..,.. --tiebreak=index --reverse --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) local ret=$? if [ -n "$selected" ]; then num=$selected[1]