From 8a1df07ce46247516765115edc25718dd2dafe6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Fleuret?= Date: Mon, 26 Jan 2026 17:20:45 +0100 Subject: [PATCH] Added --hist-readline that works without tty injection --- bash-selector.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bash-selector.sh b/bash-selector.sh index 63d3081..9416da5 100755 --- a/bash-selector.sh +++ b/bash-selector.sh @@ -43,6 +43,12 @@ function selector-history () { selector --bash -j -y -u -c 7,4,0,3 -q <(history) } +function selector-history-readline () { + selector --bash -j -y -u -c 7,4,0,3 -q <(history) -o /tmp/selector-cmd + READLINE_LINE=$(echo /tmp/selector-cmd) + READLINE_POINT="${#READLINE_LINE}" +} + ###################################################################### # Selector-based directory history ###################################################################### @@ -119,6 +125,11 @@ if [[ "$1" ]]; then bind '"\C-[r":"\C-a\C-k selector-history\C-m"' ;; + --hist-readline) + # M-r puts the selected history line in place of the current one + bind '"\C-[r":"\C-a\C-k selector-history-readline\C-m"' + ;; + --cd) # M-c provides a dynamic list of directories to cd into bind '"\C-[c":"\C-a\C-k selector-cd-search\C-m"' -- 2.39.5