From 74df61ed1d716a77a1512a3fad11036d6667eeaa Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 26 Apr 2023 23:45:28 +0300 Subject: [PATCH] Feat: tmux config + plugin manager --- .gitmodules | 3 ++ add-submodules.sh | 2 + config/tmux/plugins/tpm | 1 + config/tmux/tmux.conf | 92 +++++++++++++++++++++++++++++------------ 4 files changed, 72 insertions(+), 26 deletions(-) create mode 160000 config/tmux/plugins/tpm diff --git a/.gitmodules b/.gitmodules index bbdab50..e97303f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,6 @@ url = https://github.com/cheat/cheatsheets.git ignore = dirty +[submodule "tmux/tpm"] + path = config/tmux/plugins/tpm + url = https://github.com/tmux-plugins/tpm.git diff --git a/add-submodules.sh b/add-submodules.sh index 9f78a79..c7620ab 100755 --- a/add-submodules.sh +++ b/add-submodules.sh @@ -3,3 +3,5 @@ git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew git submodule add --name dotbot-include -f https://gitlab.com/gnfzdz/dotbot-include.git dotbot-include git submodule add --name cheat-community -f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community +git submodule add --name tmux/tpm -f https://github.com/tmux-plugins/tpm.git config/tmux/plugins/tpm + diff --git a/config/tmux/plugins/tpm b/config/tmux/plugins/tpm new file mode 160000 index 0000000..99469c4 --- /dev/null +++ b/config/tmux/plugins/tpm @@ -0,0 +1 @@ +Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946 diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index d3cbb4c..5e99290 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -2,44 +2,81 @@ # # Contains configuration from the follwing sources: # - https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html -# - +# - https://github.com/dreamsofcode-io/tmux/blob/main/tmux.conf -# unbind default prefix and set it to ctrl-a -unbind C-b -set -g prefix C-a -bind C-a send-prefix +set-option -sa terminal-overrides ",xterm*:Tc" -# make delay shorter +# Mouse support +set -g mouse on + +# Make delay shorter set -sg escape-time 0 +# Set to Control + Space +unbind C-b +set -g prefix C-Space +bind C-Space send-prefix - -#### key bindings #### - -# reload config file -bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux.conf reloaded!" - -# quickly open a new window -bind N new-window - -# synchronize all panes in a window -bind y setw synchronize-panes - -# pane movement shortcuts (same as vim) +# Vim style pane selection bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R -# enable mouse support for switching panes/windows -#set -g mouse-utf8 on -#set -g mouse on +# Start 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 key 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 + +# Shift Alt vim keys to switch windows +bind -n M-H previous-window +bind -n M-L next-window + +# Reload tmux config with + r +bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux cfg reloaded!" + +# Open a new window with + N +bind N new-window + +# Plugins related configurations + +## https://github.com/catppuccin/tmux +set -g @catppuccin_flavour 'mocha' # latte/frappe/macchiato/mocha +set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'seebi/tmux-colors-solarized' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' + +# set vi-mode +set-window-option -g mode-keys vi +# keybindings +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}" + +# synchronize all panes in a window +bind y setw synchronize-panes #### copy mode : vim #### - -# set vi mode for copy mode -setw -g mode-keys vi - # copy mode using 'Esc' unbind [ bind Escape copy-mode @@ -51,3 +88,6 @@ bind Escape copy-mode unbind p bind p paste-buffer +# Finally run the tmux plugin manager +run '~/.config/tmux/plugins/tpm/tpm' +