ohmyzsh/.tmux.conf
2022-05-14 21:17:55 -04:00

225 lines
7.2 KiB
Bash

##########################
### from internets
##########################
# From https://github.com/eduncan911/dotfiles/blob/master/.tmux.conf
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
# macOS fix for clipboard, vim/nvim, tmux and iterm2 (yikes)
if-shell "uname | grep -q Darwin" "set -g default-shell $SHELL"
if-shell "uname | grep -q Darwin" "set -g default-command \"reattach-to-user-namespace -l ${SHELL}\""
# From https://superuser.com/a/552493/393361
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# From https://superuser.com/questions/813661/how-to-configure-tmux-iterm-to-display-session-name-as-title-in-terminal-tab
set-option -g set-titles on
# from https://github.com/tmux-plugins/tmux-continuum/issues/30
# set -g set-titles-string '#h ❐ #S ● #I #W'
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
# disable status bar - PSK - it's handy actually to tell if you're in tmux
# or not.
# set -g status off
# nifty way to hide pane and bring it back
bind-key ! break-pane -d -n _hidden_pane
bind-key @ join-pane -s $.1
##########################
### from https://github.com/thoughtbot/dotfiles/blob/master/tmux.conf
##########################
set -g default-terminal 'screen-256color'
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-style bg='#262626',fg='#a1cfd1'
# set status bg to grey from https://protechnotes.com/comprehensive-tmux-tutorial-for-beginners-with-a-cheat-sheet/
set -g status-bg colour236
# remove administrative debris (session name, hostname, time) in status bar
#set -g status-left ''
#set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
##########################
# From https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/zsh-navigation-tools
##########################
bind h run-shell -b "~/.oh-my-zsh/plugins/zsh-navigation-tools/znt-tmux.zsh"
##########################
### From https://pragprog.com/titles/bhtmux2/tmux-2/
##########################
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
set -g prefix C-s
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -s escape-time 1
# Ensure that we can send Ctrl-S to other apps
bind C-s send-prefix
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
##########################
# From https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
##########################
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# moving between panes with Prefix h,j,k,l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# trying to stop tmux (tmux) being overwritten/corrupted
# commented out cos gives 'no current session'.
# set allow-rename off
# https://tmuxcheatsheet.com/tmux-plugins-tools/?full_name=tmux-plugins%2Ftmux-prefix-highlight
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow'
# Center the window list in the status line
set -g status-justify centre
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
set-option -g mouse on
setw -g automatic-rename on # rename window to reflect current program
# renumber windows when a window is closed
set -g renumber-windows on
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# ——————— Continuum ———————
# https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm'
# From https://github.com/tmux-plugins/tmux-continuum/issues/30
set -g @continuum-save-interval '1'
set -g @continuum-boot-options 'iterm,fullscreen'
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
# https://github.com/tmux-plugins/tmux-resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# From https://github.com/tmux-plugins/tmux-continuum/blob/master/docs/automatic_start.md
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-open'
# ——————— Continuum ———————
# statusbar
set -g status-position bottom
set -g status-justify left
# Status line right side - 31-Oct 13:37
#set -g status-right "#[fg=cyan]%d %b %R"
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
#setw -g window-status-style 'fg=colour9 bg=colour18'
#setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# Status line left side to show Session:window:pane
set -g status-left-length 40
set -g status-left "#{prefix_highlight} #[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# Update the status line every sixty seconds
set -g status-interval 5
# messages
#set -g message-style 'fg=colour232 bg=colour16 bold'
# https://github.com/jonmosco/kube-tmux.git
# set -g status-right-length 80 # long enough for our long cluster names
# set -g status-right "#(/bin/bash $HOME/.tmux/kube-tmux/kube.tmux 250 red cyan)"
##########################
# PLUGINS
# From https://github.com/tmux-plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'jimeh/tmux-themepack'
set -g @themepack 'powerline/block/blue'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
##########################