Browse Source

* use xterm for tmux light config

+ shell history for different tty terminals (restoring bash history for different tmux windows)
master
dimti 2 months ago
parent
commit
58900e01a6
  1. 1
      .bashrc
  2. 35
      .shell-history
  3. 15
      .tmux.light.conf

1
.bashrc

@ -20,6 +20,7 @@ test -r /etc/bashrc && . /etc/bashrc
test -r ~/.shell-env && . ~/.shell-env
test -r ~/.shell-aliases && . ~/.shell-aliases
test -r ~/.shell-common && . ~/.shell-common
test -r ~/.shell-history && . ~/.shell-history
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace

35
.shell-history

@ -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

15
.tmux.light.conf

@ -15,8 +15,7 @@ set -g @man-size '40%'
set -g @man-orientation 'h'
set -g @man-shell-interactive 'off'
set -g default-terminal "screen-256color"
set -ag terminal-overrides ",alacritty:RGB"
set -g default-terminal "xterm-256color"
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
@ -27,14 +26,10 @@ bind -n M-Down select-pane -D
## Mouse On by default
set -g mouse on
# PageUp/PageDown works for scrolling
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -T copy-mode-vi PPage send-keys -X page-up
bind-key -T copy-mode-vi NPage send-keys -X page-down
# Same for the mouse scroll button
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
## Scoll for vim
bind -n WheelUpPane if "echo #{pane_current_command} | grep vim" "select-pane -t =; send-keys -N 4 Up" "select-pane -t =; copy-mode -e; send-keys -M"
bind -n WheelDownPane if "echo #{pane_current_command} | grep vim" "select-pane -t =; send-keys -N 4 Down" "select-pane -t =; send-keys -M"
# And additional scrolling things for tmux copy-mode
bind-key -T copy-mode-vi WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-vi WheelDownPane send-keys -X halfpage-down

Loading…
Cancel
Save