diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..a41ef61 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,80 @@ +# -- General + +set-option -sa terminal-overrides ",xterm*:Tc" +set -g mouse on + +set -g default-terminal "xterm-256color" +setw -g xterm-keys on +set -sg repeat-time 600 + +set -q -g status-utf8 on +setw -q -g utf8 on + +set-option -g default-shell /usr/bin/fish + +# -- Set windows and panes at 1, not 0 + +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +# -- Use Alt-arrow keys without prefix to switch panes + +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# -- Shift-arrow to switch windows + +bind -n S-Left previous-window +bind -n S-Right next-window + +# -- Color theme + +set -g @catppuccin_flavour 'mocha' + +# -- Activity + +set -g monitor-activity on +set -g visual-activity off + +# -- Plugins + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'catppuccin/tmux' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'tmux-plugins/tmux-pain-control' + +run '~/.tmux/plugins/tpm/tpm' + +# -- Set vi-mode + +set-window-option -g mode-keys vi + +# -- Copy / Paste + +# copy to X11 clipboard +if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' +if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' +# copy to macOS clipboard +if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' +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 Windows clipboard +if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' +if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' + +# -- Key bindings + +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 +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel +bind '"' split-window -v -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" +bind b list-buffers +bind p paste-buffer +bind P choose-buffer + diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100644 index ba8c477..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,83 +0,0 @@ -# -- general ------------------------------------------------------------------ - -set -g default-terminal "xterm-256color" -set-option -ga terminal-overrides ",xterm-256color:Tc" -setw -g xterm-keys on -set -sg repeat-time 600 - -set -q -g status-utf8 on -setw -q -g utf8 on - -set -g mouse on - -set-option -g default-shell /usr/bin/fish -# -- display ------------------------------------------------------------------ - -set -g base-index 1 -setw -g pane-base-index 1 - -setw -g automatic-rename on -set -g renumber-windows on - -set -g set-titles on - -set -g display-panes-time 800 -set -g display-time 1000 - -set -w -g wrap-search off - -# -- activity ----------------------------------------------------------------- - -set -g monitor-activity on -set -g visual-activity off - -# -- copy/paste --------------------------------------------------------------- - -bind 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 H send -X start-of-line 2> /dev/null || true' -run -b 'tmux bind -t vi-copy L end-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 X11 clipboard -if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' -if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' -# copy to macOS clipboard -if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' -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 Windows clipboard -if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' -if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' - -# -- buffers ------------------------------------------------------------------ - -bind b list-buffers -bind p paste-buffer -bind P choose-buffer - -# -- tmux plugin manager ------------------------------------------------------ - -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'tmux-plugins/tmux-copycat' -set -g @plugin 'tmux-plugins/tmux-pain-control' -set -g @plugin 'tmux-plugins/tmux-open' -set -g @plugin 'tmux-plugins/tmux-battery' -#set -g @plugin 'egel/tmux-gruvbox' -#set -g @tmux-gruvbox 'dark' -set -g @plugin 'catppuccin/tmux' -set -g @plugin 'tmux-plugins/tmux-yank' - -set -g @catppuccin_flavour 'mocha' - -run ~/.tmux/plugins/tpm/tpm -