(no title)
0fflineuser | 11 months ago
Also the history is reloaded after each command so if I type multiple commands in a tmux pane x, and then go to another tmux pane y I just have to type something (just press the enter key) in pane y and I have the full history of what happened in pane x.
Here is how to do it, just add the following to your .bashrc for the eternal history :
```
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
export HISTFILE=~/.bash_eternal_history
export HISTCONTROL=ignoreboth
shopt -s histappend
shopt -s checkwinsize
filtered_history_save() {
local last_command=$(history 1 | awk '{print $4}')
# Don't store some commands in the history.
if [[ ! "$last_command" =~ (mpv|pass|yt-dlp|wtwitch) ]]; then
history -a
fi
history -c
history -r
}
export PROMPT_COMMAND="filtered_history_save; $PROMPT_COMMAND"
# Sources :
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
# http://superuser.com/questions/20900/bash-history-loss
```And for the custom fzf ctrl-r :
```
# Source fzf (should already be here if fzf is installed)
if [ -f /usr/share/fzf/completion.bash ]; then
. /usr/share/fzf/completion.bash
fi
if [ -f /usr/share/fzf/key-bindings.bash ]; then
. /usr/share/fzf/key-bindings.bash
fi
# Customize ctrl-r
export FZF_CTRL_R_OPTS="
--preview 'echo {2..} | bat --color=always -pl sh'
--preview-window right:wrap
--bind 'ctrl-/:toggle-preview'
--bind 'ctrl-t:track+clear-query'
--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
--color header:italic
--header 'Press CTRL-Y to copy command into clipboard'"
```
No comments yet.