From c3916abfd93565f37d4d83a340a927a46bd47c0d Mon Sep 17 00:00:00 2001 From: Mark Schmitz Date: Sat, 11 Jul 2026 19:27:17 +0200 Subject: [PATCH] upd hstr config in bashrc --- linux/.bashrc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/linux/.bashrc b/linux/.bashrc index 2fe33fd..b58bf98 100755 --- a/linux/.bashrc +++ b/linux/.bashrc @@ -31,17 +31,12 @@ export HISTCONTROL=ignoreboth:erasedups # no duplicate entries export HISTFILESIZE=2500000 export HISTSIZE=250000 -# see: https://github.com/dvorka/hstr/issues/277 -export PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'history -a; history -n' - -# type -P forces a PATH search, skipping builtins and so on -if type -P hstr >/dev/null; then - # hstr exists - # if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc) - if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi - # if this is interactive shell, then bind 'kill last command' to Ctrl-x k - if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi -fi +# ensure synchronization between bash memory and history file +export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" +if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi +# if this is interactive shell, then bind 'kill last command' to Ctrl-x k +if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi +export HSTR_TIOCSTI=y # If not running interactively, don't do anything case $- in