From 89640a89b362a68431c754e48836cef0a26a0388 Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Wed, 7 Apr 2021 15:10:57 +0200 Subject: [PATCH] initial commit --- dot_tmux.conf | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 dot_tmux.conf diff --git a/dot_tmux.conf b/dot_tmux.conf new file mode 100644 index 0000000..6379f92 --- /dev/null +++ b/dot_tmux.conf @@ -0,0 +1,150 @@ +# Core options (https://github.com/tmux-plugins/tmux-sensible) +# + +# address vim mode switching delay (http://superuser.com/a/252717/65504) +set -s escape-time 0 + +# increase scrollback buffer size +set -g history-limit 50000 + +# tmux messages are displayed for 4 seconds +set -g display-time 4000 + +# refresh 'status-left' and 'status-right' more often +set -g status-interval 5 + +# upgrade $TERM +set -g default-terminal "screen-256color" + +# emacs key bindings in tmux command prompt (prefix + :) are better than +# vi keys, even for vim users +#set -g status-keys emacs + +# focus events enabled for terminals that support them +set -g focus-events on + +# super useful when using "grouped sessions" and multi-monitor setup +setw -g aggressive-resize on + +# =========================================================================== +# Other options + +set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) +setw -q -g utf8 on + +# C-b is not acceptable -- Vim uses it +set-option -g prefix C-a +bind-key C-a last-window +unbind-key C-b + +set -g base-index 1 # start windows numbering at 1 +setw -g pane-base-index 1 # make pane numbering consistent with windows + +setw -g automatic-rename on # rename window to reflect current program +set -g renumber-windows on # renumber windows when a window is closed + +set -g set-titles on # set terminal title +set -g set-titles-string '#h ❐ #S ● #I #W' + +set -g display-panes-time 800 # slightly longer pane indicators display time + +set -g status-interval 10 # redraw status line every 10 seconds +# Allows for faster key repetition +set -s escape-time 0 + +## Status bar all +set -g status-fg colour236 +#set -g status-bg colour102 + +# Left +set -g status-left 'tmux ###S|' + +# Right +set -g status-right '%a %b %d, %Y %H:%M' + +# Notifications +setw -g monitor-activity on +setw -g visual-activity on + +# Auto rename +set-window-option -g automatic-rename off +set-option -g allow-rename off + +# Allows us to use C-a a to send commands to a TMUX session inside +# another TMUX session +bind-key a send-prefix + +# Activity monitoring +setw -g monitor-activity on +set -g visual-activity on + +# Splitting windows into panes with h and v +bind-key h split-window -v -c '#{pane_current_path}' +bind-key v split-window -h -c '#{pane_current_path}' + +# Set up resize-pane keys +bind-key -n C-M-h resize-pane -L 1 +bind-key -n C-M-l resize-pane -R 1 +bind-key -n C-M-j resize-pane -D 1 +bind-key -n C-M-k resize-pane -U 1 + +# Use Alt-arrow keys without prefix key to switch panes +bind-key -n M-Left select-pane -L +bind-key -n M-Right select-pane -R +bind-key -n M-Up select-pane -U +bind-key -n M-Down select-pane -D + +# Shift arrow to switch windows +bind-key -n S-Left previous-window +bind-key -n S-Right next-window + +set-window-option -g mode-keys vi + +# -- copy mode ----------------------------------------------------------------- + +bind Enter copy-mode # enter copy mode + +run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' +run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' +run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true' +run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' +run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' + +# copy to Mac OSX clipboard +if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' + +# copy to X11 clipboard +if -b 'command -v xsel > /dev/null 2>&1' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"' + +# copy to Ms Windows clipboard +if -b '[ -c /dev/clipboard ]' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "tmux save-buffer - > /dev/clipboard"' + +# Move windows on the left (/) or on the right (*) +bind-key / swap-window -t -1 +bind-key * swap-window -t +1 + +# Reload tmux config +unbind r +bind r source-file ~/.tmux.conf \; display-message "config reloaded!" + +# Plugins + +set -g @plugin 'tmux-plugins/tpm' +#set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' + +# Resurrect plugin configuration + +set -g @resurrect-capture-pane-contents 'off' +set -g @resurrect-processes 'ssh' +set -g @resurrect-never-overwrite 'off' + +# run tpm +run -b '~/.tmux/plugins/tpm/tpm' + +# =========================== END OF FILE ===================================