cc060d34f4
Throws error in later versions of tmux
125 lines
4 KiB
Plaintext
125 lines
4 KiB
Plaintext
# 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)
|
|
set -s escape-time 0
|
|
set -sg repeat-time 600
|
|
set -g history-limit 10000
|
|
# 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.
|
|
set -s focus-events on
|
|
# Enable mouse + mouse wheel
|
|
set -g mouse on
|
|
|
|
########################################
|
|
# 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
|
|
|
|
bind v split-window -h
|
|
bind s split-window -v
|
|
|
|
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"
|
|
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
|
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
|
|
bind r source-file ~/.dotfiles/config/tmux/config \; display-message " Config reloaded..".
|
|
bind ^r refresh-client
|
|
|
|
|
|
########################################
|
|
# Copy mode #
|
|
########################################
|
|
|
|
bind Enter copy-mode # enter copy mode
|
|
bind b list-buffers # list paster buffers
|
|
bind B choose-buffer # choose which buffer to paste from
|
|
bind p paste-buffer # paste from the top paste buffer
|
|
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
|
|
|
|
|
|
########################################
|
|
# Local config #
|
|
########################################
|
|
set -g @open-editor 'C-e'
|
|
set -g @open-S 'https://www.duckduckgo.com/'
|
|
|
|
source $TMUX_HOME/plugins
|
|
if '[ -f $TMUX_HOME/theme ]' 'source $TMUX_HOME/theme'
|
|
if '[ -f ~/.tmux.conf ]' 'source ~/.tmux.conf'
|