Files
dotfiles/tmux/.tmux.conf
2025-06-13 17:09:29 -04:00

118 lines
3.7 KiB
Bash

# To setup, run git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm,
# Then Run C-s -> UPPERCASE I
# C-s instead of C-b
unbind C-b
set-option -g prefix C-s
bind-key C-s send-prefix
# split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# set vi-mode
set-window-option -g mode-keys vi
# escape-time
set -g escape-time 10
# enable focus-events
set-option -g focus-events on
# keybindings for better selections
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cance
# 24 bit colors
# set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "screen-256color"
set-option -a terminal-features 'screen-256color:RGB'
# enable mouse mode (tmux 2.1 and above)
set -g mouse on
# reload config file (change file location to the tmux.conf you want to use)
unbind r
bind r source-file ~/.dotfiles/tmux/.tmux.conf \; display "Reloaded!"
# quick reload
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# stuff
# '@pane-is-vim' is a pane-local option that is set by the plugin on load,
# and unset when Neovim exits or suspends; note that this means you'll probably
# not want to lazy-load smart-splits.nvim, as the variable won't be set until
# the plugin is loaded
# Smart pane switching with awareness of Neovim splits.
bind-key -r h if -F "#{@pane-is-vim}" 'send-keys C-h' 'select-pane -L'
bind-key -r j if -F "#{@pane-is-vim}" 'send-keys C-j' 'select-pane -D'
bind-key -r k if -F "#{@pane-is-vim}" 'send-keys C-k' 'select-pane -U'
bind-key -r l if -F "#{@pane-is-vim}" 'send-keys C-l' 'select-pane -R'
# Smart pane resizing with awareness of Neovim splits.
bind-key -n M-h if -F "#{@pane-is-vim}" 'send-keys M-h' 'resize-pane -L 1'
bind-key -n M-j if -F "#{@pane-is-vim}" 'send-keys M-j' 'resize-pane -D 1'
bind-key -n M-k if -F "#{@pane-is-vim}" 'send-keys M-k' 'resize-pane -U 1'
bind-key -n M-l if -F "#{@pane-is-vim}" 'send-keys M-l' 'resize-pane -R 1'
bind -r m resize-pane -Z
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 -F \"#{@pane-is-vim}\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if -F \"#{@pane-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 C-l send-keys 'C-l'
# other stuff
# messages
set -g message-style 'fg=colour2 bg=colour0 bold'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'dracula/tmux'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @dracula-refresh-rate 1
set -g @dracula-show-powerline true
set -g @dracula-plugins "git battery time date"
set -g @dracula-show-location false
set -g @dracula-show-flags true
set -g @dracula-show-left-icon session
#show -g default-command for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g status-position top
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'