From 9efa7d0ee25b4606b7d65fa9c855e27de8993f31 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 19 Jul 2025 08:38:33 -0400 Subject: [PATCH] bind ctrl-r/alt-r to previous-item in fzf search Bind the keys which may initiate an fzf-based reverse search to also iterating upward through the matched items, once we are in fzf mode. This makes fzf search more closely match the keyboard muscle memory of traditional reverse incremental search (though it may look very different visually). Like #1278 this is intended to address * https://github.com/dbcli/mycli/discussions/1265#discussioncomment-13791547 This also assumes that alt-r from #1278 can initiate an fzf search. --- changelog.md | 1 + mycli/packages/toolkit/fzf.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7d94df7b2..6ea7753b6 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ Upcoming Release (TBD) Features -------- * Make control-r reverse search style configurable. +* Make fzf search key bindings more compatible with traditional isearch. Internal diff --git a/mycli/packages/toolkit/fzf.py b/mycli/packages/toolkit/fzf.py index 68caa9c12..35211460c 100644 --- a/mycli/packages/toolkit/fzf.py +++ b/mycli/packages/toolkit/fzf.py @@ -47,7 +47,7 @@ def search_history(event: KeyPressEvent, incremental: bool = False) -> None: result = fzf.prompt( formatted_history_items, - fzf_options="--scheme=history --tiebreak=index --preview-window=down:wrap --preview=\"printf '%s' {}\"", + fzf_options="--scheme=history --tiebreak=index --bind ctrl-r:up,alt-r:up --preview-window=down:wrap --preview=\"printf '%s' {}\"", ) if result: