1
0
Fork 0
mirror of synced 2025-04-09 04:39:34 -04:00

update tmux config

This commit is contained in:
feileo 2024-07-20 23:07:04 +08:00
parent 21b6e80abe
commit 45150ed6c0

View file

@ -11,42 +11,44 @@
# -- general -------------------------------------------------------------------
set -g default-terminal "tmux-256color" # "screen-256color" colors
bind -n End send-key C-e
bind -n Home send-key C-a
setw -g xterm-keys on # vim mode switching delay
set -s escape-time 0 # faster command sequences
set -sg repeat-time 150 # increase repeat timeout
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 200 # increase repeat timeout
set -s focus-events on
set -g prefix C-e
unbind C-b
bind C-e send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g history-limit 3000 # boost history
# edit configuration
# bind e new-window -n '~/x/conf/tmux/tmux.conf.local' "sh -c '${EDITOR:-nvim} ~/x/conf/tmux/tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
# bind e new-window -n "#{TMUX_CONF_LOCAL}" -e EDITOR="$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
bind e new-window -n "#{TMUX_CONF_LOCAL}" -e EDITOR="$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
# reload configuration
# bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind r run '"$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
bind r run '"$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
set -g prefix C-e
unbind C-b
unbind '"'
unbind %
bind -n End send-key C-e
bind -n Home send-key C-a
bind C-e send-prefix -2
# -- 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 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
@ -54,7 +56,7 @@ set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 30 # redraw status line every 30 seconds
# clear both screen and history
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
bind -n C-l send-keys C-l \; run 'sleep 0.2' \; clear-history
# activity
set -g monitor-activity on
@ -69,12 +71,13 @@ bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
unbind '"'
unbind %
# session navigation
bind BTab switch-client -l # move to last session
# split current window horizontally
bind '-' split-window -v -c '#{pane_current_path}'
bind '-' split-window -v # -c '#{pane_current_path}'
# split current window vertically
bind '\' split-window -h -c '#{pane_current_path}'
bind '\' split-window -h # -c '#{pane_current_path}'
# pane navigation
bind -r h select-pane -L # move left
@ -87,7 +90,7 @@ 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"
bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'"
# pane resizing
bind -r ^k resizep -U 8
@ -98,22 +101,18 @@ bind -r ^l resizep -R 8
# window navigation
unbind n
unbind p
bind -r [ previous-window # select previous window
bind -r ] next-window # select next window
bind -r [ previous-window # C-h, select previous window
bind -r ] next-window # C-l, select next window
bind Tab last-window # move to last active window
# 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}'"
bind F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'"
# -- copy mode -----------------------------------------------------------------
@ -140,19 +139,11 @@ if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:
# -- buffers -------------------------------------------------------------------
# bind b list-buffers # list paste buffers
# bind P paste-buffer # paste from the top paste buffer
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
# -- user defined overrides ----------------------------------------------------
if '[ -f ~/x/conf/tmux/tmux.conf.local ]' 'source ~/x/conf/tmux/tmux.conf.local'
# -- user plugs ---------------------------------------------------------------------
# if '[ -f ~/x/conf/tmux/tmux.conf.plugs ]' 'source ~/x/conf/tmux/tmux.conf.plugs'
# -- 8< ------------------------------------------------------------------------
%if #{==:#{TMUX_PROGRAM},}