diff --git a/.config/tmux/.github/README.md b/.config/tmux/.github/README.md new file mode 100644 index 00000000..affa9d51 --- /dev/null +++ b/.config/tmux/.github/README.md @@ -0,0 +1,3 @@ +
diff --git a/.config/tmux/.github/title.png b/.config/tmux/.github/title.png new file mode 100644 index 00000000..7d83e1ea Binary files /dev/null and b/.config/tmux/.github/title.png differ diff --git a/.config/tmux/conf/binds.conf b/.config/tmux/conf/binds.conf new file mode 100644 index 00000000..916a2a5b --- /dev/null +++ b/.config/tmux/conf/binds.conf @@ -0,0 +1,51 @@ +# Set new prefix (Alt+Space) +unbind C-b +set -g prefix M-Space +bind Space send-prefix + +# Config reload +bind-key R source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded" + +# Vim mode +setw -g mode-keys vi +set -g status-keys vi + +# Split windows +bind | split-window -hc "#{pane_current_path}" +bind-key "\\" split-window -fh -c "#{pane_current_path}" +bind - split-window -vc "#{pane_current_path}" + +# Maintain the same path when creating a new window +bind c new-window -c "#{pane_current_path}" + +# Move to the next and prev window +bind ] next-window +bind [ previous-window + +# Swap windows +bind -r "<" swap-window -d -t -1 +bind -r ">" swap-window -d -t +1 + +# Smart pane switching with awareness of Neovim splits. +bind-key -n C-h if -F "#{@pane-is-vim}" 'send-keys C-h' 'select-pane -L' +bind-key -n C-j if -F "#{@pane-is-vim}" 'send-keys C-j' 'select-pane -D' +bind-key -n C-k if -F "#{@pane-is-vim}" 'send-keys C-k' 'select-pane -U' +bind-key -n C-l if -F "#{@pane-is-vim}" 'send-keys C-l' 'select-pane -R' + +# Smart pane resizing with awareness of Neovim splits. +bind-key -n C-left if -F "#{@pane-is-vim}" 'send-keys C-left' 'resize-pane -L 3' +bind-key -n C-down if -F "#{@pane-is-vim}" 'send-keys C-down' 'resize-pane -D 3' +bind-key -n C-up if -F "#{@pane-is-vim}" 'send-keys C-up' 'resize-pane -U 3' +bind-key -n C-right if -F "#{@pane-is-vim}" 'send-keys C-right' 'resize-pane -R 3' + +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if -F \"#{@pane-is-vim}\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if -F \"#{@pane-is-vim}\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l diff --git a/.config/tmux/conf/options.conf b/.config/tmux/conf/options.conf new file mode 100644 index 00000000..234941fd --- /dev/null +++ b/.config/tmux/conf/options.conf @@ -0,0 +1,22 @@ +# Enable mouse +set -g mouse on + +# Theming and layout +set-option -g default-terminal screen-256color +set -g status-position top + +# Windows and panes +set -g base-index 1 +setw -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows 1 + +# Shell +set-option -g default-shell $SHELL +set-option -g default-command $SHELL + +# Environment +set-environment -g TMUX_DATA_DIR "${HOME}/.local/share/tmux" + +# Ohers +set -g history-limit 100000 diff --git a/.config/tmux/conf/plugins.conf b/.config/tmux/conf/plugins.conf new file mode 100644 index 00000000..7456103f --- /dev/null +++ b/.config/tmux/conf/plugins.conf @@ -0,0 +1,30 @@ +# Plugins Declaration +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'catppuccin/tmux' +set -g @plugin 'omerxx/tmux-sessionx' + +# Plugins Options +# Catppuccin +set -g @catppuccin_directory_text "#{pane_current_path}" +set -g @catppuccin_window_current_text "#{window_name}" +set -g @catppuccin_window_default_text "#{window_name}" +set -g @catppuccin_flavour 'macchiato' + +set -g @catppuccin_window_left_separator "█" +set -g @catppuccin_window_right_separator "█" +set -g @catppuccin_window_number_position "right" +set -g @catppuccin_window_middle_separator " █" +set -g @catppuccin_window_default_fill "number" + +set -g @catppuccin_status_modules_right "directory user host" +set -g @catppuccin_status_modules_left "session" +set -g @catppuccin_status_left_separator "█" +set -g @catppuccin_status_right_separator "" +set -g @catppuccin_status_fill "all" +set -g @catppuccin_status_connect_separator "yes" + +# Sessionx +set -g @sessionx-bind 'space' +set -g @sessionx-filter-current 'false' diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 00000000..f978d52e --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,11 @@ +# Import +source-file ~/.config/tmux/conf/plugins.conf +source-file ~/.config/tmux/conf/binds.conf +source-file ~/.config/tmux/conf/options.conf + +run '~/.tmux/plugins/tpm/tpm' + +# Padding for the status bar (Need to put it here to work correctly) +set -Fg 'status-format[1]' '#{status-format[0]}' +set -g 'status-format[1]' '' +set -g status 2 diff --git a/.github/README.md b/.github/README.md index cce3901b..f1c415b4 100644 --- a/.github/README.md +++ b/.github/README.md @@ -131,7 +131,7 @@ Here is all the information about my setup: | --------------------------- | ------------------------------------------------------------------------------------------------ | | **Shell** | 💖 [fish](https://fishshell.com/) [:gear:](../.config/fish/) | | **Terminal Emulator** | 💖 [kitty](https://sw.kovidgoyal.net/kitty/) [:gear:](../.config/kitty/) | -| **Terminal Multiplexer** | [zellij](https://github.com/zellij-org/zellij) [:gear:](../.config/zellij/) | +| **Terminal Multiplexer** | [tmux](https://github.com/tmux/tmux) [:gear:](../.config/tmux/) | | **Shell Prompt** | [starship](https://starship.rs/) [:gear:](../.config/starship/) | | **Text Editor** | 💖 [neovim](https://neovim.io/) [:gear:](../.config/nvim/) | | **Shell History** | [atuin](https://github.com/atuinsh/atuin) [:gear:](../.config/atuin/) |