diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index e0cd15b..f73c1ac 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,63 +1,66 @@ -# default shell -set-option -g default-shell /bin/zsh -set-option -g status-position top - -# tmux theme -source-file "${XDG_CONFIG_HOME}/tmux/tmux.theme" - -# Remap prefix from 'C-b' to 'C-a' -unbind C-b -set-option -g prefix C-a -bind-key C-a send-prefix - -# split panes using | and - -unbind '"' -unbind % -bind | split-window -h -c "#{pane_current_path}" # -c openes it in the current directory -bind - split-window -v -c "#{pane_current_path}" - -# History limit increase -set -g history-limit 50000 - -# reload config -bind C-r source-file ${XDG_CONFIG_HOME}/tmux/tmux.conf \; display "Config reloaded!" - -# switch panes using Alt-arrow without prefix - detect when we are in vim and switch panes there instead -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" -bind -n M-Left if-shell "$is_vim" 'send-keys M-Left' 'select-pane -L' -bind -n M-Right if-shell "$is_vim" 'send-keys M-Right' 'select-pane -R' -bind -n M-Up if-shell "$is_vim" 'send-keys M-Up' 'select-pane -U' -bind -n M-Down if-shell "$is_vim" 'send-keys M-Down' 'select-pane -D' - -# vim style switch pane -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R - -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 - -# Enable mouse control (clickable windows, panes, resizable panes) -set -g mouse on - -# Timeout for display messages (in milliseconds) -set -g display-time 1000 - -# Plugins -set -g @plugin 'tmux-plugins/tpm' -#set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'tmux-plugins/tmux-prefix-highlight' - -bind -T copy-mode C-c send -X copy-pipe-no-clear "xclip -sel clip" -bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xclip -sel clip" - -# Fix numbering for easy switching -set -g base-index 1 -setw -g pane-base-index 1 -set -g renumber-windows on - -## init tpm -run ${XDG_CONFIG_HOME}/tmux/plugins/tpm/tpm +# default shell +set-option -g default-shell /bin/zsh +set-option -g status-position top + +# tmux theme +source-file "${XDG_CONFIG_HOME}/tmux/tmux.theme" + +# Remap prefix from 'C-b' to 'C-a' +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# split panes using | and - +unbind '"' +unbind % +bind | split-window -h -c "#{pane_current_path}" # -c openes it in the current directory +bind - split-window -v -c "#{pane_current_path}" + +# History limit increase +set -g history-limit 50000 + +# reload config +bind C-r source-file ${XDG_CONFIG_HOME}/tmux/tmux.conf \; display "Config reloaded!" + +# switch panes using Alt-arrow without prefix - detect when we are in vim and switch panes there instead +is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" +bind -n M-Left if-shell "$is_vim" 'send-keys M-Left' 'select-pane -L' +bind -n M-Right if-shell "$is_vim" 'send-keys M-Right' 'select-pane -R' +bind -n M-Up if-shell "$is_vim" 'send-keys M-Up' 'select-pane -U' +bind -n M-Down if-shell "$is_vim" 'send-keys M-Down' 'select-pane -D' + +# vim style switch pane +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +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 + +# Enable mouse control (clickable windows, panes, resizable panes) +set -g mouse on + +# Address vim mode switching delay (http://superuser.com/a/252717/65504) +set -s escape-time 0 + +# Timeout for display messages (in milliseconds) +set -g display-time 1000 + +# Plugins +set -g @plugin 'tmux-plugins/tpm' +#set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-prefix-highlight' + +bind -T copy-mode C-c send -X copy-pipe-no-clear "xclip -sel clip" +bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xclip -sel clip" + +# Fix numbering for easy switching +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on + +## init tpm +run ${XDG_CONFIG_HOME}/tmux/plugins/tpm/tpm