diff --git a/.tmux.conf b/.tmux.conf index e0c68935..68f7e885 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -24,7 +24,7 @@ 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 +bind -N 'Alternate prefix' C-a send-prefix -2 set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) setw -q -g utf8 on @@ -33,14 +33,14 @@ set -g history-limit 5000 # boost history # edit configuration %if #{>=:#{version},3.0} -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 -N 'Edit tmux.conf.local' 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"' %else set-environment -g EDITOR "$EDITOR" -bind e new-window -n "#{TMUX_CONF_LOCAL}" 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 -N 'Edit tmux.conf.local' e new-window -n "#{TMUX_CONF_LOCAL}" 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"' %endif # reload configuration -bind r run "sh -c '\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} source \"\$TMUX_CONF\"'" \; display "#{TMUX_CONF} sourced" +bind -N 'Reload tmux configs' r run "sh -c '\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} source \"\$TMUX_CONF\"'" \; display "#{TMUX_CONF} sourced" # -- display ------------------------------------------------------------------- @@ -59,7 +59,7 @@ 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 +bind -n -N 'Clear screen and history' C-l send-keys C-l \; run 'sleep 0.2' \; clear-history # activity set -g monitor-activity on @@ -69,83 +69,82 @@ set -g visual-activity off # -- navigation ---------------------------------------------------------------- # create session -bind C-c new-session +bind -N 'New Session' C-c new-session # find session -bind C-f command-prompt -p find-session 'switch-client -t %%' +bind -N 'Find Session' C-f command-prompt -p find-session 'switch-client -t %%' # session navigation -bind BTab switch-client -l # move to last session +bind -N 'Switch to last session' BTab switch-client -l # move to last session # split current window horizontally -bind - split-window -v +bind -N 'Split Horizantally' - split-window -v # split current window vertically -bind _ split-window -h +bind -N 'Split Vertically' _ 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 +bind -N 'Select the pane to the left of the active pane' -r h select-pane -L # move left +bind -N 'Select the pane below the active pane' -r j select-pane -D # move down +bind -N 'Select the pane above the active pane' -r k select-pane -U # move up +bind -N 'Select the pane to the Right of the active pane' -r l select-pane -R # move right +bind -N 'Swap the active pane with the pane below' > swap-pane -D # swap current pane with the next one +bind -N 'Swap the active pane with the pane above' < 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 -N 'Maximize current pane' + 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 +bind -N 'Resize the pane left by 2' -r H resize-pane -L 2 +bind -N 'Resize the pane down by 2' -r J resize-pane -D 2 +bind -N 'Resize the pane up by 2' -r K resize-pane -U 2 +bind -N 'Resize the pane right by 2' -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 -r C-S-H swap-window -t -1 \; select-window -t -1 # swap current window with the previous one -bind -r C-S-L swap-window -t +1 \; select-window -t +1 # swap current window with the next one -bind Tab last-window # move to last active window +bind -N 'select previous window' -r C-h previous-window # select previous window +bind -N 'select next window' -r C-l next-window # select next window +bind -N 'swap current window with the previous one' -r C-S-H swap-window -t -1 \; select-window -t -1 # swap current window with the previous one +bind -N 'swap current window with the next one' -r C-S-L swap-window -t +1 \; select-window -t +1 # swap current window with the next one +bind -N 'move to last active window' Tab last-window # move to last active window # toggle mouse -bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" +bind -N 'Toggle Mouse Mode' m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" # -- facebook pathpicker ------------------------------------------------------- -bind F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'" +bind -N 'Facebook Pathpicker' F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'" # -- copy mode ----------------------------------------------------------------- -bind Enter copy-mode # enter copy mode +bind -N 'Enter Copy Mode' 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 +bind -N '(vi copy) Begin selection' -T copy-mode-vi v send -X begin-selection +bind -N '(vi copy) Rectangle toggle' -T copy-mode-vi C-v send -X rectangle-toggle +bind -N '(vi copy) Copy selection and cancel' -T copy-mode-vi y send -X copy-selection-and-cancel +bind -N '(vi copy) Cancel' -T copy-mode-vi Escape send -X cancel +bind -N '(vi copy) Start of line' -T copy-mode-vi H send -X start-of-line +bind -N '(vi copy) End of line' -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"' +if -b 'command -v xsel > /dev/null 2>&1' 'bind -N "Copy to X11 clipboard (xsel)" 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 -N "Copy to X11 clipboard (xclip)" 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 '[ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | wl-copy"' +if -b '[ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1' 'bind -N "Copy to Wayland clipboard (wl-copy)" 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 pbcopy > /dev/null 2>&1' 'bind -N "Copy to macOS clipboard (pbcopy)" y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | 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"' +if -b 'command -v clip.exe > /dev/null 2>&1' 'bind -N "Copy to Windows clipboard (clip.exe)" y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | clip.exe"' +if -b '[ -c /dev/clipboard ]' 'bind -N "Copy to Windows clipboard (/dev/clipboard)" 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 - +bind -N 'list paste buffers' b list-buffers # list paste buffers +bind -N 'paste from the top paste buffer' p paste-buffer -p # paste from the top paste buffer +bind -N 'choose which buffer to paste from' P choose-buffer # choose which buffer to paste from # -- 8< ------------------------------------------------------------------------ @@ -1104,9 +1103,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # # tmux_conf_urlscan_options=${tmux_conf_urlscan_options:---compact --dedupe} # if command -v urlscan > /dev/null 2>&1; then -# tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlscan '#{pane_id}' $tmux_conf_urlscan_options" +# tmux bind -N '' U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlscan '#{pane_id}' $tmux_conf_urlscan_options" # elif command -v urlview > /dev/null 2>&1; then -# tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlview '#{pane_id}'" +# tmux bind -N '' U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlview '#{pane_id}'" # fi # } # diff --git a/.tmux.conf.local b/.tmux.conf.local index e17b324f..650b290a 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -399,10 +399,10 @@ tmux_conf_urlscan_options="--compact --dedupe" # unbind C-a # unbind C-b # set -g prefix C-a -# bind C-a send-prefix +# bind -N 'Alternate prefix' C-a send-prefix # if you don't want Oh my tmux! to alter a binding or a setting, use #!important -# bind c new-window -c '#{pane_current_path}' #!important +# bind -N '' c new-window -c '#{pane_current_path}' #!important # move status line to top #set -g status-position top