tmux: Use short command variants
Use short variants of commands and get rid of redundant `-T prefix` flag to `bind`.
This commit is contained in:
@@ -6,8 +6,7 @@ set -g mode-keys vi
|
|||||||
# Disable xterm escape sequences for setting clipboard
|
# Disable xterm escape sequences for setting clipboard
|
||||||
set -s set-clipboard off
|
set -s set-clipboard off
|
||||||
# Copy selection into primary selection (without aborting)
|
# Copy selection into primary selection (without aborting)
|
||||||
bind-key -T copy-mode-vi MouseDragEnd1Pane \
|
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear "xclip -se p"
|
||||||
send-keys -X copy-pipe-no-clear "xclip -se p"
|
|
||||||
|
|
||||||
# https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux
|
# https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux
|
||||||
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
||||||
@@ -18,52 +17,52 @@ set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
|||||||
# `copy-mode`)
|
# `copy-mode`)
|
||||||
bind -n WheelUpPane \
|
bind -n WheelUpPane \
|
||||||
if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { send -M } { copy-mode -u }
|
if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { send -M } { copy-mode -u }
|
||||||
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -XN5 scroll-up
|
bind -T copy-mode-vi WheelUpPane selectp \; send -XN5 scroll-up
|
||||||
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -XN5 scroll-down
|
bind -T copy-mode-vi WheelDownPane selectp \; send -XN5 scroll-down
|
||||||
|
|
||||||
# Set C-a as new prefix
|
# Set C-a as new prefix
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set-option -g prefix C-a
|
set -g prefix C-a
|
||||||
bind-key C-a send-prefix
|
bind C-a send-prefix
|
||||||
|
|
||||||
# Split panes with > and <
|
# Split panes with > and <
|
||||||
unbind %
|
unbind %
|
||||||
bind-key < split-window -v -c "#{pane_current_path}"
|
bind < split-window -v -c "#{pane_current_path}"
|
||||||
unbind '"'
|
unbind '"'
|
||||||
bind-key > split-window -h -c "#{pane_current_path}"
|
bind > split-window -h -c "#{pane_current_path}"
|
||||||
|
|
||||||
# Create new window in current path
|
# Create new window in current path
|
||||||
bind-key -T prefix c new-window -c "#{pane_current_path}"
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
|
||||||
# Resource config
|
# Resource config
|
||||||
bind-key -T prefix R source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; \
|
bind R source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; \
|
||||||
display-message "Sourced $XDG_CONFIG_HOME/tmux/tmux.conf"
|
display-message "Sourced $XDG_CONFIG_HOME/tmux/tmux.conf"
|
||||||
|
|
||||||
# Fullscreen pane (toggle)
|
# Fullscreen pane (toggle)
|
||||||
bind-key -T prefix F resize-pane -Z
|
bind F resizep -Z
|
||||||
|
|
||||||
# Automatically renumber windows when closing one
|
# Automatically renumber windows when closing one
|
||||||
set -g renumber-windows on
|
set -g renumber-windows on
|
||||||
|
|
||||||
# Enter copy-mode and scroll one page up directly with PageUp without the need
|
# Enter copy-mode and scroll one page up directly with PageUp without the need
|
||||||
# of the prefix. (Exists already per default with prefix)
|
# of the prefix. (Exists already per default with prefix)
|
||||||
bind-key -n PPage copy-mode -u
|
bind -n PPage copy-mode -u
|
||||||
|
|
||||||
# Repeatable window-navigation bindings
|
# Repeatable window-navigation bindings
|
||||||
bind-key -r -T prefix n next-window
|
bind -r n next
|
||||||
bind-key -r -T prefix C-n next-window
|
bind -r C-n next
|
||||||
bind-key -r -T prefix p previous-window
|
bind -r p prev
|
||||||
bind-key -r -T prefix C-p previous-window
|
bind -r C-p prev
|
||||||
|
|
||||||
# Vim-bindings
|
# Vim-bindings
|
||||||
|
|
||||||
# Enter copy-mode with Escape
|
# Enter copy-mode with Escape
|
||||||
bind-key -T prefix Escape copy-mode
|
bind Escape copy-mode
|
||||||
# Start selection (e.g. visual mode) with `v`
|
# Start selection (e.g. visual mode) with `v`
|
||||||
unbind -T copy-mode-vi v
|
unbind -T copy-mode-vi v
|
||||||
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
bind -T copy-mode-vi v send -X begin-selection
|
||||||
# Yank into system clipboard
|
# Yank into system clipboard
|
||||||
bind-key -T copy-mode-vi y send-keys -X copy-pipe "xclip -selection clipboard"
|
bind -T copy-mode-vi y send -X copy-pipe "xclip -selection clipboard"
|
||||||
|
|
||||||
# Clear selection or cancel copy-mode when nothing is selected
|
# Clear selection or cancel copy-mode when nothing is selected
|
||||||
bind -T copy-mode-vi Escape \
|
bind -T copy-mode-vi Escape \
|
||||||
@@ -72,30 +71,30 @@ bind -T copy-mode-vi Escape \
|
|||||||
# Navigate panes with <prefix>-[hjkl]
|
# Navigate panes with <prefix>-[hjkl]
|
||||||
# NOTE: C-[hjkl] (w/o prefix) moves through vim splits and tmux panes
|
# NOTE: C-[hjkl] (w/o prefix) moves through vim splits and tmux panes
|
||||||
# See vim-tmux-navigator
|
# See vim-tmux-navigator
|
||||||
unbind -T prefix l
|
unbind l
|
||||||
bind -T prefix h select-pane -L
|
bind h selectp -L
|
||||||
bind -T prefix j select-pane -D
|
bind j selectp -D
|
||||||
bind -T prefix k select-pane -U
|
bind k selectp -U
|
||||||
bind -T prefix l select-pane -R
|
bind l selectp -R
|
||||||
# Resize panes with Alt-Shift-[hjkl]
|
# Resize panes with Alt-Shift-[hjkl]
|
||||||
bind -n M-H resize-pane -L
|
bind -n M-H resizep -L
|
||||||
bind -n M-J resize-pane -D
|
bind -n M-J resizep -D
|
||||||
bind -n M-K resize-pane -U
|
bind -n M-K resizep -U
|
||||||
bind -n M-L resize-pane -R
|
bind -n M-L resizep -R
|
||||||
|
|
||||||
# Allow C-h to still be passed (when programs expect it as backspace, e.g. UEFI
|
# Allow C-h to still be passed (when programs expect it as backspace, e.g. UEFI
|
||||||
# shell)
|
# shell)
|
||||||
bind -r -T selfinsert C-h send-keys C-h
|
bind -r -T selfinsert C-h send C-h
|
||||||
bind C-v switch-client -T selfinsert
|
bind C-v switchc -T selfinsert
|
||||||
|
|
||||||
# Resize panes with Alt-Shift-<arrow>
|
# Resize panes with Alt-Shift-<arrow>
|
||||||
bind -n M-S-Left resize-pane -L
|
bind -n M-S-Left resizep -L
|
||||||
bind -n M-S-Up resize-pane -D
|
bind -n M-S-Up resizep -D
|
||||||
bind -n M-S-Down resize-pane -U
|
bind -n M-S-Down resizep -U
|
||||||
bind -n M-S-Right resize-pane -R
|
bind -n M-S-Right resizep -R
|
||||||
|
|
||||||
# Change installation location of plugins
|
# Change installation location of plugins
|
||||||
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$XDG_CONFIG_HOME/tmux/plugins/"
|
setenv -g TMUX_PLUGIN_MANAGER_PATH "$XDG_CONFIG_HOME/tmux/plugins/"
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
set -g @plugin 'tmux-plugins/tmux-continuum'
|
||||||
@@ -119,10 +118,10 @@ set -g @continuum-restore 'on'
|
|||||||
set -g @resurrect-strategy-vim 'session'
|
set -g @resurrect-strategy-vim 'session'
|
||||||
set -g @resurrect-strategy-nvim 'session'
|
set -g @resurrect-strategy-nvim 'session'
|
||||||
# Save sessions before detaching
|
# Save sessions before detaching
|
||||||
unbind -T prefix d
|
unbind d
|
||||||
bind-key -T prefix d {
|
bind d {
|
||||||
run-shell "$XDG_CONFIG_HOME/tmux/plugins/tmux-resurrect/scripts/save.sh";
|
run "$XDG_CONFIG_HOME/tmux/plugins/tmux-resurrect/scripts/save.sh";
|
||||||
detach-client
|
detach
|
||||||
}
|
}
|
||||||
|
|
||||||
## Theming. Inspired by:
|
## Theming. Inspired by:
|
||||||
|
|||||||
Reference in New Issue
Block a user