From: François Fleuret Date: Mon, 26 Jan 2026 16:20:45 +0000 (+0100) Subject: Added --hist-readline that works without tty injection X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a1df07ce46247516765115edc25718dd2dafe6d;p=selector.git Added --hist-readline that works without tty injection --- 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"'