feat(app): tmux is added as the new terminal multiplexer

This commit is contained in:
Sergio Laín 2024-07-29 17:46:05 +02:00
parent 4154794475
commit ba7b455936
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150
7 changed files with 118 additions and 1 deletions

3
.config/tmux/.github/README.md vendored Normal file
View file

@ -0,0 +1,3 @@
<div align="center">
<a href=""><img src="./title.png"></a>
</div>

BIN
.config/tmux/.github/title.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -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

View file

@ -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

View file

@ -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'

11
.config/tmux/tmux.conf Normal file
View file

@ -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

2
.github/README.md vendored
View file

@ -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/) |