180 lines
7.2 KiB
Plaintext
180 lines
7.2 KiB
Plaintext
# : << 'EOF'
|
|
# https://github.com/gpakosz/.tmux
|
|
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
|
# without any warranty.
|
|
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
|
#
|
|
# ------------------------------------------------------------------------------
|
|
# /!\ DO NOT EDIT THIS FILE
|
|
# instead, override your .local customization file copy, see README.md /!\
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# -- general -------------------------------------------------------------------
|
|
|
|
set -g default-terminal "screen-256color"
|
|
|
|
setw -g xterm-keys on
|
|
set -s escape-time 10 # faster command sequences
|
|
set -sg repeat-time 600 # increase repeat timeout
|
|
set -s focus-events on
|
|
|
|
set -g prefix2 C-a # GNU-Screen compatible prefix
|
|
bind C-a send-prefix -2
|
|
|
|
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
|
|
setw -q -g utf8 on
|
|
|
|
set -g history-limit 500000 # boost history
|
|
|
|
# edit configuration
|
|
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c '${EDITOR:-vim} "$TMUX_CONF_LOCAL" && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
|
|
|
|
# reload configuration
|
|
bind r run '"$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
|
|
|
|
|
|
# -- display -------------------------------------------------------------------
|
|
|
|
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
|
|
set -g display-time 1000 # slightly longer status messages display time
|
|
|
|
set -g status-interval 10 # redraw status line every 10 seconds
|
|
|
|
# clear both screen and history
|
|
bind -n C-l send-keys C-l \; run 'sleep 0.2' \; clear-history
|
|
|
|
# activity
|
|
set -g monitor-activity on
|
|
set -g visual-activity off
|
|
|
|
bind e setw synchronize-panes on
|
|
bind E setw synchronize-panes off
|
|
|
|
# -- navigation ----------------------------------------------------------------
|
|
|
|
# create session
|
|
bind C-c new-session
|
|
|
|
# find session
|
|
bind C-f command-prompt -p find-session 'switch-client -t %%'
|
|
|
|
# session navigation
|
|
bind BTab switch-client -l # move to last session
|
|
|
|
# split current window horizontally
|
|
bind - split-window -v
|
|
# split current window vertically
|
|
bind _ split-window -h
|
|
|
|
# pane navigation
|
|
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
|
|
bind > swap-pane -D # swap current pane with the next one
|
|
bind < swap-pane -U # swap current pane with the previous one
|
|
|
|
# maximize current pane
|
|
bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'"
|
|
|
|
# pane resizing
|
|
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
|
|
|
|
# window navigation
|
|
unbind n
|
|
unbind p
|
|
bind -r C-h previous-window # select previous window
|
|
bind -r C-l next-window # select next window
|
|
bind Tab last-window # move to last active window
|
|
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
|
|
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
|
|
|
|
# toggle mouse
|
|
bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse"
|
|
|
|
|
|
# -- urlview -------------------------------------------------------------------
|
|
|
|
bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlview '#{pane_id}'"
|
|
|
|
|
|
# -- facebook pathpicker -------------------------------------------------------
|
|
|
|
bind F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'"
|
|
|
|
|
|
# -- copy mode -----------------------------------------------------------------
|
|
|
|
bind Enter copy-mode # enter copy mode
|
|
|
|
bind -T copy-mode-vi v send -X begin-selection
|
|
bind -T copy-mode-vi C-v send -X rectangle-toggle
|
|
bind -T copy-mode-vi y send -X copy-selection-and-cancel
|
|
bind -T copy-mode-vi Escape send -X cancel
|
|
bind -T copy-mode-vi H send -X start-of-line
|
|
bind -T copy-mode-vi L send -X end-of-line
|
|
|
|
# copy to X11 clipboard
|
|
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xsel -i -b"'
|
|
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
|
|
# copy to Wayland clipboard
|
|
if -b 'command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | wl-copy"'
|
|
# copy to macOS clipboard
|
|
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | pbcopy"'
|
|
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | reattach-to-usernamespace pbcopy"'
|
|
# copy to Windows clipboard
|
|
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | clip.exe"'
|
|
if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - > /dev/clipboard"'
|
|
|
|
|
|
# -- buffers -------------------------------------------------------------------
|
|
|
|
bind b list-buffers # list paste buffers
|
|
bind p paste-buffer -p # paste from the top paste buffer
|
|
bind P choose-buffer # choose which buffer to paste from
|
|
|
|
|
|
# -- 8< ------------------------------------------------------------------------
|
|
|
|
%if #{==:#{TMUX_PROGRAM},}
|
|
run 'TMUX_PROGRAM="$(LSOF=$(PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command -v lsof); $LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || printf tmux)"; "$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_PROGRAM "$TMUX_PROGRAM"'
|
|
%endif
|
|
%if #{==:#{TMUX_SOCKET},}
|
|
run '"$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_SOCKET "#{socket_path}"'
|
|
%endif
|
|
%if #{==:#{TMUX_CONF},}
|
|
run '"$TMUX_PROGRAM" set-environment -g TMUX_CONF $(for conf in "$HOME/.tmux.conf" "$XDG_CONFIG_HOME/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"; do [ -f "$conf" ] && printf "%s" "$conf" && break; done)'
|
|
%endif
|
|
%if #{==:#{TMUX_CONF_LOCAL},}
|
|
run '"$TMUX_PROGRAM" set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
|
|
%endif
|
|
|
|
run '"$TMUX_PROGRAM" source "$TMUX_CONF_LOCAL"'
|
|
run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|
|
|
# List of plugins
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
set -g @plugin 'dracula/tmux'
|
|
|
|
# Other examples:
|
|
# set -g @plugin 'github_username/plugin_name'
|
|
# set -g @plugin 'github_username/plugin_name#branch'
|
|
# set -g @plugin 'git@github.com:user/plugin'
|
|
# set -g @plugin 'git@bitbucket.com:user/plugin'
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
run -b '~/.tmux/plugins/tpm/tpm'
|