mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
136 lines
4.4 KiB
Bash
136 lines
4.4 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> left,right,up,down (repeat press)
|
|
# Switch Pane -> <ctrl-a> h,j,k,l
|
|
# Enter copy mode -> <ctrl-a> [
|
|
# Exit copy mode -> <enter>
|
|
# Reload tmux.conf -> <ctrl-a> r
|
|
|
|
# More at: https://tmuxcheatsheet.com
|
|
|
|
#========================================================
|
|
# 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
|
|
|
|
unbind %
|
|
bind s split-window -h
|
|
unbind '"'
|
|
bind v split-window -v
|
|
|
|
# Intuitive split bindings to | & -
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
bind | split-window -h -c "#{pane_current_path}"
|
|
|
|
# <leader> h,j,k,l to move between panes
|
|
bind -r h select-pane -L
|
|
bind -r j select-pane -D
|
|
bind -r k select-pane -U
|
|
bind -r l select-pane -R
|
|
|
|
# Use <leader> repeated(h,j,k,l)s to resize pane
|
|
bind -r Left resize-pane -L
|
|
bind -r Right resize-pane -R
|
|
bind -r Up resize-pane -U
|
|
bind -r Down resize-pane -D
|
|
|
|
# Use Vim Navigations to copy text from the NON-vim panes
|
|
# Enable Tmux copy mode with <leader>[ -> Then use Vim navigations
|
|
setw -g mode-keys vi
|
|
# Use `v` to trigger selection
|
|
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
|
# Use `y` to yank current selection
|
|
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
|
|
# Enable mouse selection as well
|
|
unbind -T copy-mode-vi MouseDragEnd1Pane
|
|
|
|
# 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
|
|
|
|
# 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"
|
|
|
|
# Colors
|
|
gray_light="#D8DEE9"
|
|
gray_medium="#ABB2BF"
|
|
gray_dark="#3B4252"
|
|
green_soft="#A3BE8C"
|
|
blue_muted="#81A1c1"
|
|
cyan_soft="#88C0D0"
|
|
|
|
# Status-Bar Style
|
|
set -g status-position top
|
|
set -g status-left-length 100
|
|
set -g status-style "fg=${gray_light},bg=default"
|
|
set -g status-left "#[fg=${green_soft},bold] #S #[fg=${gray_light},nobold] |"
|
|
set -g window-status-current-format "#[fg=${cyan_soft},bold] #[underscore]#I:#W"
|
|
set -g message-style "fg=${gray_light},bg=default"
|
|
set -g mode-style "fg=${gray_dark},bg=${blue_muted}"
|
|
set -g pane-border-style "fg=${gray_dark}"
|
|
set -g pane-active-border-style "fg=${gray_medium}"
|
|
|
|
#========================================================
|
|
# PLUGINS
|
|
#========================================================
|
|
run "$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm" # Init Tmux Plugin Manager
|
|
|
|
set -g @plugin "tmux-plugins/tmux-resurrect" # Persist sessions
|
|
set -g @plugin "tmux-plugins/tmux-continuum" # Auto save sessions every 15mins
|
|
|
|
#========================================================
|
|
# PLUGINS Configurations
|
|
#========================================================
|
|
|
|
set -g @plugin "tmux-plugins/tpm"
|