Files
dotfiles/common/.config/tmux/tmux.conf
Pratik Tripathy 5fa524dd1d - TMUX: Switched back to ctrl+b as leader
- VIM: Configurations better commented
- NVIM: NVChad, LazyNvim, Old-Config removed
- NVIM: Restarted and reconfigured from kickstart.nvim [WIP]
- Dotfiles on $HOME removed from 160+ to 25. Most of them moved to $XDG_* directories
- Shell: Added back p10k config
- Shell: Autoremove brew left over applications
- Kitty: Added bashrc & profiles for ssh kitten
- Kitty: Custom tab-titles
2024-01-29 22:51:23 +05:30

141 lines
4.8 KiB
Bash

# Keybinding Summary
#========================================================
# Rename Session -> <ctrl-a> $
# Rename Tab -> <ctrl-a> ,
# Next/prev tab -> <ctrl-a> n/p
# H-split/V-split -> <ctrl-a> s/v
# Resize Pane -> <ctrl-a> leave alt -> h,j,k,l (repeat press)
# Switch Pane -> <ctrl-h,j,k,l>
# Enter copy mode -> <ctrl-a>[
# Exit copy mode -> <enter>
# Reload tmux.conf -> <ctrl-a> r
# More at: https://tmuxcheatsheet.com
# TODO: Figure out how to save multiple sessions and resurrect them later
#========================================================
# KEY BINDINGS
#========================================================
# Change Tmux leader key to -> <ctrl-a>
unbind C-b
set -g prefix C-a
bind-key C-a send-prefix
# Kill current session with q
bind q confirm-before kill-session
# Intuitive split bindings to | & -
unbind %
bind s split-window -h
unbind '"'
bind v split-window -v
# Open panes in the current directory
bind - split-window -v -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
# Use <leader> repeated(h,j,k,l)s to resize current pane
bind -r h resize-pane -L
bind -r l resize-pane -R
bind -r k resize-pane -U
bind -r j resize-pane -D
# Use Vim Navigations to copy text from the NON-vim panes
# Enable Tmux copy mode with <leader>[ -> Then use Vim navigations
bind-key -T copy-mode-vi "v" send -X begin-selection
bind-key -T copy-mode-vi "y" send -X copy-selection
unbind -T copy-mode-vi MouseDragEnd1Pane # Enable mouse selection as well
# From Tmux-sensible Plugin
bind C-p previous-window
bind C-n next-window
bind C-a send-prefix
bind a last-window
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display-message "Tmux config reloaded."
# Change resurrect keys to <ctrl-s>(Save) & <ctrl-r>(Resurrect)
set -g @resurrect-save "C-s"
set -g @resurrect-restore "C-r"
#========================================================
# OPTIONS
#========================================================
set -g set-clipboard on # Use system clipboard
setw -g mode-keys vi
set-window-option -g mode-keys vi
# From tmux-sensible plugin
set -g display-time 1000 # Display message for 1s
set -g history-limit 50000 # Increase scrollback buffer
set -g mouse on # Mouse mode
set -s escape-time 0 # Address Vim switching delay
set -g status-interval 5 # Refresh status every 5s (default 15s)
set -g focus-events on # Enable focus event
setw -g aggressive-resize on # For grouped sessions
# Resurrection Options
set -g @resurrect-capture-pane-contents "on"
set -g @resurrect-strategy-nvim "session"
set -g @resurrect-dir "$XDG_CONFIG_HOME/tmux/resurrect"
# Don't exit tmux when closing a session
set -g detach-on-destroy off
#========================================================
# APPEARANCE
#========================================================
# Start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
set-window-option -g pane-base-index 1
# Improve colors
set -g default-terminal "${TERM}"
set-option -g default-terminal "xterm-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
# Status at top
set -g status-position top
#========================================================
# PLUGINS
#========================================================
run "$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm" # Init Tmux Plugin Manager
set -g @plugin "christoomey/vim-tmux-navigator" # sync pane nav with Vim window nav
set -g @plugin "tmux-plugins/tmux-resurrect" # Persist sessions
set -g @plugin "tmux-plugins/tmux-continuum" # Auto save sessions every 15mins
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin "tmux-plugins/tmux-copycat"
set -g @plugin "catppuccin/tmux"
#========================================================
# PLUGINS Configurations
#========================================================
# Color schemes
set -g @catppuccin_flavour "mocha"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_status_enable "yes"
set -g @catppuccin_window_status_icon_enable "yes"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
set -g @catppuccin_status_modules_right "session directory"
set -g @plugin "tmux-plugins/tpm"