tmux: add new key bindings to manage windows/panes

This commit is contained in:
Fernando Schauenburg 2022-02-19 01:08:46 +01:00
parent 56e0574d1e
commit 453b0e6b93

View file

@ -1,41 +1,63 @@
set -g prefix C-space
# #
# Key bindings # Key bindings
# #
set -g prefix C-space
bind C-space send-prefix bind C-space send-prefix
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display "RELOADED"
# Open new windows/panes with the path in current pane # Window/pane management (new windows/panes use the path in current pane)
bind c new-window -c '#{pane_current_path}' bind c new-window -c '#{pane_current_path}'
bind | split-window -h -c '#{pane_current_path}' bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}' bind - split-window -v -c '#{pane_current_path}'
bind x kill-pane bind x kill-pane
bind X kill-window bind X kill-window
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
bind . next-window
bind , previous-window
bind n command-prompt 'rename-window %%' bind n command-prompt 'rename-window %%'
bind N command-prompt 'rename-session %%' bind N command-prompt 'rename-session %%'
# Move around
bind . next-window
bind , previous-window
bind h select-pane -L bind h select-pane -L
bind j select-pane -D bind j select-pane -D
bind k select-pane -U bind k select-pane -U
bind l select-pane -R bind l select-pane -R
# Resize panes
bind -r C-h resize-pane -L 5 bind -r C-h resize-pane -L 5
bind -r C-j resize-pane -D 5 bind -r C-j resize-pane -D 5
bind -r C-k resize-pane -U 5 bind -r C-k resize-pane -U 5
bind -r C-l resize-pane -R 5 bind -r C-l resize-pane -R 5
unbind-key -T copy-mode-vi MouseDragEnd1Pane # Stay in copy mode on drag end # Arrangement of panes
bind b break-pane \; select-pane -m \; last-window
bind J join-pane -v
bind L join-pane -h
# Choosing layouts
bind -r C-o rotate-window
bind -r C-i rotate-window -D
bind -r space next-layout
bind C-m set main-pane-width 50% \; select-layout main-vertical
bind C-e select-layout even-horizontal
bind C-t select-layout tiled
# Stay in copy mode on drag end
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# #
# General # General
# #
set -gs escape-time 50 # avoid delays with ESC in vim set -gs escape-time 50 # avoid delays with ESC in vim
set -gs repeat-time 1000 # allow 1 second for multiple commands
set -g base-index 1 # start window numbering from 1 set -g base-index 1 # start window numbering from 1
set -g history-limit 20000 # remember longer history set -g history-limit 20000 # remember longer history
setw -g automatic-rename on # automatically rename windows setw -g automatic-rename on # automatically rename windows
setw -g mouse on # enable mouse support setw -g mouse on # enable mouse support
setw -g pane-base-index 1 # start pane numbering from 1 setw -g pane-base-index 1 # start pane numbering from 1
# Set $TERM and force 256 colors. # Set $TERM and force 256 colors.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal # https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
set -g default-terminal 'screen-256color' set -g default-terminal 'screen-256color'
@ -64,24 +86,16 @@ set -g status-right-length 48
set -g status-justify centre set -g status-justify centre
# Color definitions # Color definitions
# SOLARIZED TMUX # SOLARIZED TMUX SOLARIZED TMUX
# --------- -------- # --------- -------- --------- --------
# Base03 colour8 # Base03 colour8 Yellow colour3
# Base02 colour0 # Base02 colour0 Orange colour9
# Base01 colour10 # Base01 colour10 Red colour1
# Base00 colour11 # Base00 colour11 Magenta colour5
# Base0 colour12 # Base0 colour12 Violet colour13
# Base1 colour14 # Base1 colour14 Blue colour4
# Base2 colour7 # Base2 colour7 Cyan colour6
# Base3 colour15 # Base3 colour15 Green colour2
# Yellow colour3
# Orange colour9
# Red colour1
# Magenta colour5
# Violet colour13
# Blue colour4
# Cyan colour6
# Green colour2
set -g status-left "\ set -g status-left "\
#{?client_prefix,#[fg=colour1],#[fg=colour10]}\ #{?client_prefix,#[fg=colour1],#[fg=colour10]}\