dotfiles/.tmux.conf

91 lines
2.9 KiB
Bash

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf \; display 'Reloaded tmux config!'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
# Don't rename windows automatically
set-option -g allow-rename off
######################
### DESIGN CHANGES ###
######################
set -g default-terminal "screen-256color"
set -g @plugin 'tinted-theming/base16-tmux'
set -g @plugin 'thewtex/tmux-mem-cpu-load'
set -g @colors-base16 'dracula'
set -g status-interval 10
# 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 mode-style 'bold'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'dim'
set -g status-left ' #S | '
set -g status-right '#(curl -s wttr.in/Trondheim\?format\="%%l:+%%c%%t") #[bg=color237] %a %b %d #[fg=color7]%H:%M #[fg=color82,bg=color236,bold] #H '
set -g status-right-length 80
set -g status-left-length 20
setw -g window-status-current-style 'bold'
setw -g window-status-current-format '#[fg=color3]#I:#W#F '
setw -g window-status-format '#I:#W#F '
setw -g window-status-bell-style 'bold'
# messages
set -g message-style 'bold'
#######################
### /DESIGN CHANGES ###
#######################
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# If plugin installation does not work, run $TPM/bin/install_plugins
run '~/.tmux/plugins/tpm/tpm'