|
|
|
|
|
by tupolef
842 days ago
|
|
- For your 1st issue, you can setup bash to append commands rather than overwrite them. Here the part of my .bashrc about history: # append rather than overwrite
shopt -s histappend
# attempts to save all lines of a multiple-line command in the same history entry
shopt -s cmdhist
# with cmdhist, saved with embedded newlines rather than semicolon separators
shopt -s lithist
HISTCONTROL=ignoreboth
HISTSIZE=10000
HISTFILESIZE=20000
HISTTIMEFORMAT="%y/%m/%d %T "
HISTIGNORE="history:ls:l:pwd:exit:"
if [[ ${BASH_VERSION:0:1} -gt 5 || ${BASH_VERSION:0:1} -ge 5 && ${BASH_VERSION:2:1} -ge 1 ]]; then
PROMPT_COMMAND=("history -a" "history -c" "history -r")
else
PROMPT_COMMAND="history -a; history -c; history -r"
fi
- And about the 2nd issue, you should use fzf or skim (probably faster) to replace the ctrl-r binding. fzf includes such a script that you just need to call from .bashrc. # Enable key bindings for fzf
if command -v fzf 1> /dev/null && [[ -f "/usr/share/doc/fzf/examples/key-bindings.bash" ]]; then
source /usr/share/doc/fzf/examples/key-bindings.bash
fi
|
|
I've been using atuin happily for a few years now and it blows bash history out of the water.