* use xterm for tmux light config
+ shell history for different tty terminals (restoring bash history for different tmux windows)
This commit is contained in:
35
.shell-history
Normal file
35
.shell-history
Normal file
@ -0,0 +1,35 @@
|
||||
# save history for multiple terminals
|
||||
# create a folder to store the history
|
||||
if [ ! -d "${HOME}/.bash_history_log" ]; then
|
||||
mkdir "${HOME}/.bash_history_log"
|
||||
fi
|
||||
|
||||
# Add the tty to the history file
|
||||
# Each terminal's history will be stored in
|
||||
# its own file
|
||||
HISTSUFFIX=`tty | sed 's/\///g;s/^dev//g'`
|
||||
HISTFILE="$HOME/.bash_history_log/bash_history_$HISTSUFFIX"
|
||||
|
||||
# Time stamp for the history
|
||||
HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
HISTCONTROL=ignoredups:ignorespace
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=5000
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# Add to the history everytime the prompt is shown
|
||||
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007";history -a'
|
||||
|
||||
# Search history
|
||||
function searchhistory() {
|
||||
grep -ri "${1}" ~/.bash_history_log/*
|
||||
}
|
||||
alias shistory=searchhistory
|
||||
|
||||
# Thanks for that: https://dev.to/mrrcollins/saving-bash-history-across-terminals-b80
|
Reference in New Issue
Block a user