dotfiles/conf/tmux.conf

126 lines
4.0 KiB
Plaintext
Raw Normal View History

2021-06-27 20:20:03 +00:00
# File : .tmux.conf
2021-06-25 09:18:49 +00:00
# Author : Jeff LANCE <email@jefflance.me>
# Date : 25.06.2021
2021-06-27 20:20:03 +00:00
# Last Modified Date: 27.06.2021
2021-06-25 09:18:49 +00:00
# Last Modified By : Jeff LANCE <email@jefflance.me>
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
# -- general -------------------------------------------------------------------
2020-04-15 11:15:10 +00:00
set -g default-terminal "alacritty"
2020-10-24 15:39:43 +00:00
setw -g xterm-keys on
2022-01-26 20:16:49 +00:00
set -s escape-time 0 # address vim mode switching delay (http://superuser.com/a/252717/65504)
2021-04-10 16:17:14 +00:00
set -g repeat-time 600 # increase repeat timeout
2021-03-07 10:23:42 +00:00
set -g focus-events on
2018-06-27 14:05:11 +00:00
2021-04-10 16:17:14 +00:00
set -g prefix2 C-b # GNU-Screen compatible prefix
bind C-b send-prefix -2
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
2018-06-27 14:05:11 +00:00
2022-01-26 20:16:49 +00:00
set -g history-limit 50000 # boost history
set -g status-keys emacs # emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
setw -g aggressive-resize on # super useful when using "grouped sessions" and multi-monitor setup
2018-06-27 14:05:11 +00:00
2022-04-23 14:34:32 +00:00
2020-10-24 15:39:43 +00:00
# edit configuration
2021-07-02 13:26:27 +00:00
bind e new-window -n "~/.tmux.conf" "EDITOR=\${EDITOR//mvim/vim} && EDITOR=\${EDITOR//gvim/vim} && \${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\""
2020-04-15 11:15:10 +00:00
2020-10-24 15:39:43 +00:00
# reload configuration
2021-07-02 13:26:27 +00:00
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf reloaded'
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
# -- display -------------------------------------------------------------------
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g display-panes-time 800 # slightly longer pane indicators display time
2022-01-26 20:16:49 +00:00
set -g display-time 4000 # slightly longer status messages display time
2020-10-24 15:39:43 +00:00
2022-01-26 20:16:49 +00:00
set -g status-interval 5 # redraw status line every 10 seconds
2020-10-24 15:39:43 +00:00
# clear both screen and history
2021-07-02 13:26:27 +00:00
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history\; display 'screen and history cleared'
2020-10-24 15:39:43 +00:00
# activity
set -g monitor-activity on
set -g visual-activity off
# -- navigation ----------------------------------------------------------------
# create session
bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# split current window horizontally
2020-04-15 11:15:10 +00:00
bind - split-window -v
2020-10-24 15:39:43 +00:00
# split current window vertically
2021-01-27 09:44:10 +00:00
bind | split-window -h
2020-10-24 15:39:43 +00:00
# pane navigation
2021-05-27 19:30:21 +00:00
unbind h
unbind j
unbind k
unbind l
2021-06-25 09:18:49 +00:00
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
2021-05-27 19:30:21 +00:00
# bind -r h select-pane -L # move left
# bind -r j select-pane -D # move down
# bind -r k select-pane -U # move up
# bind -r l select-pane -R # move right
2021-10-04 19:04:08 +00:00
bind -n C-S-PageDown swap-pane -D # swap current pane with the next one
bind -n C-S-PageUp swap-pane -U # swap current pane with the previous one
2020-10-24 15:39:43 +00:00
# pane resizing
2021-06-27 20:20:03 +00:00
# bind -r H resize-pane -L 2
# bind -r J resize-pane -D 2
# bind -r K resize-pane -U 2
# bind -r L resize-pane -R 2
2020-10-24 15:39:43 +00:00
# window navigation
unbind n
unbind p
2021-06-27 20:20:03 +00:00
bind -n C-PageUp previous-window # select previous window
bind -n C-PageDown next-window # select next window
bind Tab last-window # move to last active window
2020-10-24 15:39:43 +00:00
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
# -- copy mode -----------------------------------------------------------------
2018-06-27 14:05:11 +00:00
2021-10-04 19:04:08 +00:00
bind-key Space copy-mode
bind -n S-Pageup copy-mode -u
bind -n S-Pagedown send-keys PageDown
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi c-v send -X rectangle-toggle
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
# -- buffers -------------------------------------------------------------------
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
# -- user defined overrides ----------------------------------------------------
2018-06-27 14:05:11 +00:00
2020-10-24 15:39:43 +00:00
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
2018-06-27 14:05:11 +00:00