2020-01-12 15:17:35 -08:00
|
|
|
# tmux.conf
|
|
|
|
# By Henrik Lissner <henrik@lissner.net>
|
|
|
|
# https://github.com/hlissner/dotfiles
|
|
|
|
########################################
|
|
|
|
|
|
|
|
set -g default-terminal "xterm-256color"
|
|
|
|
|
|
|
|
new-session # spawn session if attaching when none are running
|
|
|
|
|
|
|
|
setw -g automatic-rename on # rename window after current program
|
|
|
|
set -g renumber-windows on # renumber windows when one is closed
|
|
|
|
# Zero-based indexing is fine in programming languages, but not so much in a
|
|
|
|
# multiplexer when zero is on the other side of the keyboard.
|
|
|
|
set -g base-index 1
|
|
|
|
setw -g pane-base-index 1
|
|
|
|
# display tmux messages longer
|
|
|
|
set -g display-time 1500
|
|
|
|
set -g display-panes-time 800
|
|
|
|
# Address vim-mode switching delay (http://superuser.com/a/252717/65504)
|
2020-02-02 15:53:12 -08:00
|
|
|
set -s escape-time 0
|
|
|
|
set -sg repeat-time 600
|
|
|
|
set -g history-limit 10000
|
2020-01-12 15:17:35 -08:00
|
|
|
# Rather than constraining window size to the maximum size of any client
|
|
|
|
# connected to the *session*, constrain window size to the maximum size of any
|
|
|
|
# client connected to *that window*. Much more reasonable.
|
|
|
|
setw -g aggressive-resize off
|
|
|
|
# For terminals that support them, propagate these events to programs that
|
|
|
|
# understand them.
|
2020-02-02 15:53:12 -08:00
|
|
|
set -s focus-events on
|
|
|
|
# Enable mouse + mouse wheel
|
|
|
|
set -g mouse on
|
2020-01-12 15:17:35 -08:00
|
|
|
|
|
|
|
########################################
|
|
|
|
# Keybinds #
|
|
|
|
########################################
|
|
|
|
|
|
|
|
# Rebind prefix to C-c. Press twice to send literal C-c.
|
|
|
|
unbind C-b
|
|
|
|
set -g prefix C-c
|
|
|
|
bind C-c send-prefix
|
|
|
|
|
|
|
|
# Vi-style keybinds
|
|
|
|
set -g status-keys vi
|
|
|
|
set -g mode-keys vi
|
|
|
|
|
2020-06-04 11:41:31 -07:00
|
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
bind v split-window -h -c "#{pane_current_path}"
|
|
|
|
bind s split-window -v -c "#{pane_current_path}"
|
2020-01-12 15:17:35 -08:00
|
|
|
|
|
|
|
bind h select-pane -L
|
|
|
|
bind j select-pane -D
|
|
|
|
bind k select-pane -U
|
|
|
|
bind l select-pane -R
|
|
|
|
bind H run '$TMUX_HOME/swap-pane.sh left'
|
|
|
|
bind J run '$TMUX_HOME/swap-pane.sh down'
|
|
|
|
bind K run '$TMUX_HOME/swap-pane.sh up'
|
|
|
|
bind L run '$TMUX_HOME/swap-pane.sh right'
|
|
|
|
bind M run '$TMUX_HOME/swap-pane.sh master'
|
|
|
|
|
|
|
|
bind o resize-pane -Z
|
|
|
|
bind S choose-session
|
|
|
|
bind W choose-window
|
|
|
|
bind / choose-session
|
|
|
|
bind . choose-window
|
|
|
|
|
|
|
|
# bind = select-layout tiled
|
|
|
|
bind | select-layout even-horizontal
|
|
|
|
bind _ select-layout even-vertical
|
|
|
|
|
|
|
|
# Disable confirmation
|
|
|
|
bind x kill-pane
|
|
|
|
bind X kill-window
|
|
|
|
bind q kill-session
|
|
|
|
bind Q kill-server
|
|
|
|
|
|
|
|
# Smart pane switching with awareness of vim splits
|
|
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
|
|
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
|
|
|
|
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|
|
|
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|
|
|
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|
|
|
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
2020-04-22 16:54:03 -07:00
|
|
|
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
2020-01-12 15:17:35 -08:00
|
|
|
bind C-w last-pane
|
|
|
|
bind C-n next-window
|
|
|
|
bind C-p previous-window
|
|
|
|
|
|
|
|
# break pane into a window
|
|
|
|
bind = select-layout even-vertical
|
|
|
|
bind + select-layout even-horizontal
|
|
|
|
bind - break-pane
|
|
|
|
bind _ join-pane
|
|
|
|
|
|
|
|
# reload config without killing server
|
2020-10-11 18:30:49 -07:00
|
|
|
bind r source-file $DOTFILES/config/tmux/config \; display-message " Config reloaded..".
|
2020-01-12 15:17:35 -08:00
|
|
|
bind ^r refresh-client
|
|
|
|
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Copy mode #
|
|
|
|
########################################
|
|
|
|
|
|
|
|
bind Enter copy-mode # enter copy mode
|
|
|
|
bind b list-buffers # list paster buffers
|
2020-02-02 14:35:14 -08:00
|
|
|
bind B choose-buffer # choose which buffer to paste from
|
2020-01-31 22:40:16 -08:00
|
|
|
bind p paste-buffer # paste from the top paste buffer
|
2020-02-02 14:35:14 -08:00
|
|
|
bind P run "xclip -selection clipboard -o | tmux load-buffer - ; tmux paste-buffer"
|
|
|
|
|
|
|
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
|
|
|
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
|
|
|
|
bind -T copy-mode-vi Escape send-keys -X cancel
|
|
|
|
bind -T copy-mode-vi C-g send-keys -X cancel
|
|
|
|
bind -T copy-mode-vi H send-keys -X start-of-line
|
|
|
|
bind -T copy-mode-vi L send-keys -X end-of-line
|
2020-01-12 15:17:35 -08:00
|
|
|
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Local config #
|
|
|
|
########################################
|
2020-01-31 22:40:16 -08:00
|
|
|
set -g @open-editor 'C-e'
|
|
|
|
set -g @open-S 'https://www.duckduckgo.com/'
|
|
|
|
|
2020-10-23 17:54:25 -07:00
|
|
|
source $TMUX_HOME/extraInit
|
2020-01-12 15:17:35 -08:00
|
|
|
if '[ -f ~/.tmux.conf ]' 'source ~/.tmux.conf'
|