# NOTE: First of all install TPM # git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm unbind-key C-b set-option -g prefix C-a bind-key C-a 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. set -g pane-base-index 1 # Vi-mode set -g mode-keys vi # Enable activity alerts. set -g visual-activity off # Renumber windows when a window is closed set -g renumber-windows on # https://github.com/tmux/tmux/issues/353#issuecomment-265154018 set -g focus-events off set-option -g default-terminal "screen-256color" set-option -ga terminal-overrides ',*-256color*:Tc' # => Theme set -g status-style fg=white,bg=black set -g window-status-current-style fg=black,bg=white,bold set -g window-status-style fg=colour244,bg=default set -g window-status-current-style fg=colour166,bg=default set -g message-style fg=colour166,bg=colour235 set -g window-status-format " ━━━━━━ " set -g window-status-current-format " ━━━━━━ " set -g status-left '' set -g status-right '' set -g status-justify centre # Planck bind-key "'" split-window -h bind-key "p" split-window -v # 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 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-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 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' '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 C-l send-keys 'C-l' # => Bindings # Kill pane without confirmation bind-key x kill-pane # Painless copying with tmux-yank unbind [ bind Escape copy-mode setw -g mode-keys vi unbind-key -T copy-mode-vi v bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode. bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode. bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" # Yank selection in copy mode. bind-key -T copy-mode-vi 'K' send -X halfpage-up bind-key -T copy-mode-vi 'J' send -X halfpage-down bind N new-session # => Plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' # Depends on 'urlview' set -g @plugin 'tmux-plugins/tmux-urlview' set -g @plugin 'tmux-plugins/tmux-yank' # Default keysbindings for panes set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'christoomey/vim-tmux-navigator' # If run as "tmux attach", create a session if one does not already exist new-session -A -s default # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'