How to enhance the ability of tmux
Install tmux
sudo apt install tmux
Plugin Manager
https://github.com/tmux-plugins/tpm
Window save and restore even after a reboot
https://github.com/tmux-plugins/tmux-continuum
Combine them together
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
#~/.tmux.conf
#set-option -g default-shell "/bin/bash"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Enable mouse support
setw -g mouse on
#set -g @plugin 'tmux-plugins/tmux-yank'
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# Enable vim support when ctrl+b+[
# This is for terminal copy and paste
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Get current working directory for outside program: use $TMUX_WORKING_DIR to get the active dir path of tmux
#set-hook -g pane-focus-in 'if [ -z ${TMUX+x} ]; then eval "export $(tmux show-environment TMUX_WORKING_DIR)"; else tmux setenv TMUX_WORKING_DIR $(pwd); fi'
# Auto save and reload tmux windows
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '1'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
tmux source ~/.tmux.conf
add the following to your ~/.bashrc
:
#if [ -z ${TMUX+x} ]; then eval "export $(tmux show-environment TMUX_WORKING_DIR)" && cd $TMUX_WORKING_DIR; else tmux setenv TMUX_WORKING_DIR $(pwd); fi
clear
Mac Version
#~/.tmux.conf
#set-option -g default-shell "/bin/bash"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Auto save and reload tmux windows
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '1'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
then inside of tmux, you do: tmux source ~/.tmux.conf
then press: prefix(ctrl b) + I