179 lines
4.9 KiB
Plaintext
179 lines
4.9 KiB
Plaintext
# General Settings ==================================================
|
||
# Ctrl-space as prefix
|
||
unbind-key C-b
|
||
unbind-key C-Space
|
||
set-option -g prefix C-Space
|
||
bind-key C-Space send-prefix
|
||
|
||
set -s copy-command 'wl-copy'
|
||
set -g mouse on
|
||
|
||
# vi keybinds in copy mode
|
||
set-window-option -g mode-keys vi
|
||
set -g mode-keys vi
|
||
set-option -s set-clipboard off
|
||
|
||
# Start window index at 1, for chromium-like tab switching
|
||
set -g base-index 1
|
||
|
||
# 100k line scrollback
|
||
set-option -g history-limit 100000
|
||
|
||
# Avoid ESC delay
|
||
set -s escape-time 0
|
||
|
||
# Full colors
|
||
set -g default-terminal "xterm-256color" # 'xterm' not 'tmux' for vim's sake
|
||
set -ag terminal-overrides ",*256*:RGB"
|
||
|
||
# Window and Panes ==================================================
|
||
# Fast Alt-bound keybinds
|
||
# Adjacent windows
|
||
bind-key -n M-l next
|
||
bind-key -n M-h prev
|
||
|
||
# Move between panes. Mix of vim up/down and vimium's tabs left/right
|
||
bind-key -n M-k select-pane -t '{top-right}'
|
||
bind-key -n M-j select-pane -t '{bottom-left}'
|
||
|
||
# Move windows
|
||
bind-key -n M-[ swap-window -t -1 \; prev
|
||
bind-key -n M-] swap-window -t +1 \; next
|
||
|
||
# Goto window, like chromium tabs
|
||
bind-key -n M-1 select-window -t 1
|
||
bind-key -n M-2 select-window -t 2
|
||
bind-key -n M-3 select-window -t 3
|
||
bind-key -n M-4 select-window -t 4
|
||
bind-key -n M-5 select-window -t 5
|
||
bind-key -n M-6 select-window -t 6
|
||
bind-key -n M-7 select-window -t 7
|
||
bind-key -n M-8 select-window -t '{end}'
|
||
|
||
# Slower prefix-bound keybinds
|
||
# Move between panes
|
||
bind h select-pane -L
|
||
bind j select-pane -D
|
||
bind k select-pane -U
|
||
bind l select-pane -R
|
||
|
||
# Resize panes
|
||
bind -r C-h resize-pane -L
|
||
bind -r C-j resize-pane -D
|
||
bind -r C-k resize-pane -U
|
||
bind -r C-l resize-pane -R
|
||
|
||
# Swap panes
|
||
bind-key L swap-pane -s '{right-of}'
|
||
bind-key K swap-pane -s '{up-of}'
|
||
bind-key J swap-pane -s '{down-of}'
|
||
bind-key H swap-pane -s '{left-of}'
|
||
|
||
# Split panes like vim
|
||
bind v split-window -h -c '#{pane_current_path}'
|
||
bind s split-window -v -c '#{pane_current_path}'
|
||
bind t new-window -c "#{pane_current_path}"
|
||
|
||
# Move current pane between windows
|
||
bind-key g command-prompt -p "grab pane from:" "join-pane -s '%%'"
|
||
bind-key m command-prompt -p "move pane to:" "join-pane -t '%%'"
|
||
|
||
# Pop out current pane into a new window
|
||
bind-key p break-pane -t :
|
||
|
||
# Toggle pane synchronization
|
||
bind-key C-s setw synchronize-panes
|
||
|
||
# Show the time
|
||
bind T clock-mode
|
||
|
||
# Switch sessions with ( )
|
||
bind-key -n M-0 switch-client -n
|
||
bind-key -n M-9 switch-client -p
|
||
|
||
unbind-key w
|
||
bind-key w choose-session
|
||
|
||
# Tmux Keybinds =====================================================
|
||
# Reload tmux quickly
|
||
unbind R
|
||
bind R source-file ~/.config/tmux/tmux.conf \; display 'Reloaded tmux config'
|
||
|
||
# Faster command prompt
|
||
bind ';' command-prompt -I ""
|
||
|
||
# F12 toggles the outer tmux session's key interception. Keys get passed
|
||
# through to the inner session
|
||
bind -T root F12 \
|
||
set prefix None \;\
|
||
set key-table off \;\
|
||
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
|
||
set status-position top \;\
|
||
refresh-client -S
|
||
|
||
bind -T off F12 \
|
||
set -u prefix C-Space \;\
|
||
set -u key-table \;\
|
||
set status-position bottom \;\
|
||
refresh-client -S
|
||
|
||
# Copy mode keybinds
|
||
# Move to line ends
|
||
bind-key -T copy-mode-vi 'L' send-keys '$'
|
||
bind-key -T copy-mode-vi 'H' send-keys '^'
|
||
|
||
# Navigate to previous command prompt
|
||
bind-key b copy-mode\;\
|
||
send-keys -X start-of-line\;\
|
||
send-keys -X search-backward " "
|
||
|
||
# Copy mode selection
|
||
bind P paste-buffer
|
||
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 C-k send-keys -X cancel
|
||
|
||
# Copy via mouse selection or y key
|
||
bind-key -T copy-mode-vi y send-keys -X copy-pipe 'wl-copy'
|
||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'wl-copy'
|
||
|
||
# Statusline ========================================================
|
||
set-option -g status-position bottom
|
||
set -g status-left-length 32
|
||
|
||
set -g status-bg "black"
|
||
set -g status-fg "grey"
|
||
|
||
set-option -g status-left "#[fg=yellow, bg=black bold] #H "
|
||
|
||
set-window-option -g window-status-current-format "\
|
||
#[fg=black, bg=green] #I* \
|
||
#[fg=black, bg=green bold] #W \
|
||
#[fg=green, bg=black]"
|
||
|
||
set-window-option -g window-status-format "\
|
||
#[fg=black, bg=grey]\
|
||
#[fg=black, bg=grey] #I #W \
|
||
#[fg=grey, bg=black]"
|
||
|
||
set-option -g status-right "\
|
||
#[fg=yellow, bg=black] #S #(whoami) \
|
||
#[fg=black, bg=yellow] #(uname -s) "
|
||
|
||
set-window-option -g window-status-separator ''
|
||
|
||
# Plugins ===========================================================
|
||
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
|
||
|
||
set -g @scroll-speed-num-lines-per-scroll "1"
|
||
set -g @emulate-scroll-for-no-mouse-alternate-buffer "on" # Scroll manpages
|
||
set -g @plugin 'mattdavis90/base16-tmux'
|
||
|
||
set -g @colors-base16 'gruvbox-light-soft'
|
||
|
||
run '~/.config/tmux/plugins/tpm/tpm'
|
||
|
||
# Overwriting options ===============================================
|
||
set -g pane-active-border-style "fg=white"
|
||
set -g pane-border-style "fg=brightblack"
|