From 55ece7ec03f2c3bae054272185f3882e3e163187 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 18 Mar 2021 16:48:38 -0400 Subject: .config/tmux: Improve configuration --- .config/tmux/tmux.conf | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index a9440d9..08fb89b 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -6,6 +6,9 @@ set -g prefix C-a bind C-a send-prefix unbind C-b +# reload configuration +bind r source-file ~/.config/tmux/tmux.conf \; run "printf ' # Reload tmux configuration\n' | tmux load-buffer - && tmux paste-buffer" + # settings set -g mouse on set -g status off @@ -13,41 +16,44 @@ set -g base-index 1 set -g mode-keys vi set -sg escape-time 1 set -g visual-activity on +setw -g pane-base-index 1 set -g history-limit 10000 setw -g monitor-activity on -setw -g pane-base-index 1 # border colours set -g pane-border-style fg=colour0 set -g pane-active-border-style fg=colour0 # y and p as in vim -bind Escape copy-mode unbind p -bind p paste-buffer -bind-key -T copy-mode-vi 'v' send -X begin-selection -bind-key -T copy-mode-vi 'y' send -X copy-selection -bind-key -T copy-mode-vi 'Space' send -X halfpage-down -bind-key -T copy-mode-vi 'Bspace' send -X halfpage-up +bind -n M-p paste-buffer +bind -n M-e copy-mode +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle \; send -X begin-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel \; run "tmux save-buffer - | xsel -i" -# easy-to-remember split pane commands +# middle mouse paste +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i" +bind -T root MouseDown2Pane run -b "xsel -o | tmux load-buffer - && tmux paste-buffer -s ' '" + +# split pane commands bind | split-window -h bind - split-window -v -unbind '"' -unbind % - -# moving between panes with vim movement keys -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R - -# moving between windows with vim movement keys -bind -r C-h select-window -t :- -bind -r C-l select-window -t :+ - -# resize panes with vim movement keys -bind -r H resize-pane -L 5 -bind -r J resize-pane -D 5 -bind -r K resize-pane -U 5 -bind -r L resize-pane -R 5 + +# alt vim keys without prefix key to switch panes +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R + +# alt arrow keys without prefix key to switch panes +bind -n M-Down select-pane -D +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U + +# alt vim keys without prefix to resize panes +bind -n M-H resize-pane -L 5 +bind -n M-J resize-pane -D 5 +bind -n M-K resize-pane -U 5 +bind -n M-L resize-pane -R 5 -- cgit v1.2.3