dotfiles/tmux/.tmux.conf
Sanchayan Maity 7200bbece7 Switch to using stow for dotfiles management
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
2019-12-31 14:18:38 +05:30

126 lines
4 KiB
Bash

# change the prefix from 'C-b' to 'M-a'
unbind C-b
set-option -g prefix M-a
bind-key M-a send-prefix
# start with window 1 (instead of 0)
set -g base-index 1
# start with pane 1
set -g pane-base-index 1
# split panes using | and -, make sure they open in the same path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# open new windows in the current path
bind c new-window -c "#{pane_current_path}"
# reload config file
bind r source-file ~/.tmux.conf \; display "Reloaded tmux.conf!"
unbind p
bind p previous-window
# shorten command delay
set -sg escape-time 1
# don't rename windows automatically
set-option -g allow-rename off
# mouse control (clickable windows, panes, resizable panes)
set -g mouse on
set -g focus-events on
# Use Alt-arrow keys without prefix key to switch panes
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
# Pane resizing with HJKL
bind H resize-pane -L 10
bind J resize-pane -D 10
bind K resize-pane -U 10
bind L resize-pane -R 10
# Move windows back/forward
bind -n S-left swap-window -t -1
bind -n S-right swap-window -t +1
bind m command-prompt -p "Merge pane to:" "join-pane -t '%%'"
bind M command-prompt -p "Merge pane from:" "join-pane -s '%%'"
bind e setw synchronize-panes on \; display "Synchronize panes ON (E: off)"
bind E setw synchronize-panes off \; display "Synchronize panes OFF (e: on)"
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind 0 select-pane -t 0
bind 1 select-pane -t 1
bind 2 select-pane -t 2
bind 3 select-pane -t 3
bind 4 select-pane -t 4
bind 5 select-pane -t 5
bind 6 select-pane -t 6
bind 7 select-pane -t 7
bind 8 select-pane -t 8
bind 9 select-pane -t 9
# set default terminal mode to 256 colors
# set -g default-terminal "screen-256color"
# set default terminal mode to 256 colors
set-option -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ',tmux-256color:RGB'
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.9" | bc)" = 1 ]' " \
set-option -g status-attr dim; \
set-option -g status-bg colour237; \
set-option -g status-fg colour187; \
set-window-option -g window-status-attr dim; \
set-window-option -g window-status-bg colour237; \
set-window-option -g window-status-fg colour187; \
set-window-option -g window-status-current-attr dim; \
set-window-option -g window-status-current-bg '#000000'; \
set-window-option -g window-status-current-fg colour161; \
set-option -g pane-active-border-bg '#101010'; \
set-option -g pane-active-border-fg '#87d700'; \
set-option -g pane-border-bg '#101010'; \
set-option -g pane-border-fg '#505050'; \
set-option -g mode-bg '#000000'; \
set-option -g mode-fg colour187; \
set-option -g message-bg '#000000'; \
set-option -g message-fg colour187; \
"
if-shell -b '[ "$(echo "$TMUX_VERSION > 2.9" | bc)" = 1 ]' " \
set-option -g status-style fg=colour187,bg=colour237; \
set-window-option -g window-status-style fg=colour187,bg=colour237; \
set-window-option -g window-status-current-style fg=colour161,bg='#000000'; \
set-option -g pane-border-style fg='#505050',bg='#101010'; \
set-option -g pane-active-border-style fg='#87d700',bg='#101010'; \
set-option -g mode-style fg=colour187,bg='#000000'; \
set-option -g message-style fg=colour187,bg='#000000'; \
"
# Plugins
run-shell '~/.tmux/plugins/tmux-resurrect/resurrect.tmux'
run-shell '~/.tmux/plugins/tmux-continuum/continuum.tmux'
run-shell '~/.tmux/plugins/tmux-yank/yank.tmux'
run-shell '~/.tmux/plugins/tmux-copycat/copycat.tmux'
run-shell '~/.tmux/plugins/tmux-open/open.tmux'
set -g @continuum-restore 'on'