chore(config): tmux: combine configs, fix paths

This commit is contained in:
2025-02-14 00:03:38 +02:00
parent d59204f25f
commit 4e4a2eaab1
5 changed files with 140 additions and 153 deletions

View File

@@ -1,37 +0,0 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Bindings │
# ╰──────────────────────────────────────────────────────────╯
# bind flags
# -r = repeatable, only needs prefix once
# -n = doesn't need prefix
# -t = binds to a certain key-table (root, copy-mode, prefix, etc.)
# Set <prefix> to Control + Space, keeping the default of C-b intact.
# C-Space send-prefix line doubles the prefix when in nested tmux session.
set -g prefix C-Space
bind C-Space send-prefix
# 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
# Easier switching between window
bind C-n next-window
bind C-p previous-window
bind C-a last-window
# Reload tmux config with <prefix> + r
unbind r
bind r "source-file ~/.dotfiles/config/tmux/tmux.conf; display 'tmux cfg reloaded!'"
# copy mode using 'Esc'
unbind [
bind Escape copy-mode
# paste using 'p'
unbind p
bind p paste-buffer
# vim: ft=tmux ts=2 sw=2 et

View File

@@ -1,50 +0,0 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins │
# ╰──────────────────────────────────────────────────────────╯
# ── Plugins related configurations ────────────────────────────────────
# Plugin that lets you suspend local tmux session,
# so that you can work with nested remote tmux session painlessly.
# https://github.com/MunifTanjim/tmux-suspend
set -g @suspend_key 'F12'
## A plugin to name your tmux windows smartly.
## https://github.com/ofirgall/tmux-window-name
### Maximum name length of a window
set -g @tmux_window_name_max_name_len "20"
### Replace $HOME with ~ in window names
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_ignored_programs "['sqlite3', 'antidote', 'direnv', 'md5']" # Default is []
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_name_substitute_sets "[('.+ipython2', 'ipython2'), ('.+ipython3', 'ipython3'), ('.+\.local', '.local'), ('.+asdf', 'asdf')]"
set -g @tmux_window_name_use_tilde "True"
# https://github.com/erikw/tmux-dark-notify
set -g @dark-notify-theme-path-light "$TMUX_CONF_DIR/theme-light.conf"
set -g @dark-notify-theme-path-dark "$TMUX_CONF_DIR/theme-dark.conf"
## https://github.com/MunifTanjim/tmux-mode-indicator
set -g @mode_indicator_copy_mode_style 'bg=default,fg=yellow'
set -g @mode_indicator_empty_mode_style 'bg=default,fg=#7aa2f7'
set -g @mode_indicator_prefix_mode_style 'bg=default,fg=#7aa2f7'
set -g @mode_indicator_sync_mode_style 'bg=default,fg=red'
# https://github.com/wfxr/tmux-fzf-url
set -g @fzf-url-bind 'u'
set -g @fzf-url-history-limit '2000'
# ── Sourcing the plugins ──────────────────────────────────────────────
run-shell "$TMUX_PLUGINS/tmux-sensible/sensible.tmux"
run-shell "$TMUX_PLUGINS/tmux-window-name/tmux_window_name.tmux"
run-shell "$TMUX_PLUGINS/tmux-mode-indicator/mode_indicator.tmux"
run-shell "$TMUX_PLUGINS/tmux-suspend/suspend.tmux"
run-shell "$TMUX_PLUGINS/tmux-continuum/continuum.tmux"
run-shell "$TMUX_PLUGINS/tmux-sessionist/sessionist.tmux"
run-shell "$TMUX_PLUGINS/tmux-yank/yank.tmux"
run-shell "$TMUX_PLUGINS/tmux-current-pane-hostname/current_pane_hostname.tmux"
run-shell "$TMUX_PLUGINS/tmux-dark-notify/main.tmux"
run-shell "$TMUX_PLUGINS/tmux-fzf-url/fzf-url.tmux"
# vim: ft=tmux ts=2 sw=2 et

View File

@@ -1,40 +0,0 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Settings │
# ╰──────────────────────────────────────────────────────────╯
# set [flags] [command] [value]
# Flags can be combined, e.g. -as
# -a : Append the value to the existing setting.
# -s : Apply the setting to the current session.
# -g : Apply the setting globally to all sessions.
# -o : Set the option only if it is not already set.
# -u : Unset the specified option.
set -g default-terminal "tmux-256color" # Set default terminal to 256 colors
set -g detach-on-destroy off # don't detach tmux when killing a session
set -g display-time 0 # Hide clock
set -g focus-events on # Focus events enabled for terminals that support them
set -g mouse on # Mouse support
set -g set-titles on # Allow tmux to set the terminal title
set -g status on # Setting status on
set -g status-keys vi # vi keys to move between panes
# Activity Monitoring (for when something happens in another pain)
set -g monitor-activity on
set -g visual-activity off
set -g visual-bell off
# A bell in another window should cause a bell in the current window
set -g bell-action any
# Keep Tmux alive when the initial command is finished
set -g remain-on-exit off
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# Activate with `DEBUG=1 tmux -vv`
if-shell '[ "$DEBUG" = "1" ]' 'set -g debug-file ~/.cache/tmux-debug.log'
# vim: ft=tmux ts=2 sw=2 et

View File

@@ -1,16 +0,0 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Theme │
# ╰──────────────────────────────────────────────────────────╯
set -g pane-active-border-style "fg=#7aa2f7"
set -g pane-border-style "fg=#3b4261"
set -g status-justify "left"
set -g status-left ''
set -g status-left-length "0"
set -g status-position "bottom"
set -g status-right "#S@#{hostname_short} #{tmux_mode_indicator}"
set -g status-right-length "30"
set -g window-status-current-format ' #I:#W#{?window_zoomed_flag, ◈ ,} '
set -g window-status-format ' #I:#W '
# vim: ft=tmux ts=2 sw=2 et

View File

@@ -4,22 +4,152 @@
# - https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# - https://github.com/dreamsofcode-io/tmux/blob/main/tmux.conf
# Load the configuration settings
source-file "$TMUX_CONF_DIR/config-settings.conf"
# ╭──────────────────────────────────────────────────────────╮
# │ Settings │
# ╰──────────────────────────────────────────────────────────╯
# set [flags] [command] [value]
# Flags can be combined, e.g. -as
# -a : Append the value to the existing setting.
# -s : Apply the setting to the current session.
# -g : Apply the setting globally to all sessions.
# -o : Set the option only if it is not already set.
# -u : Unset the specified option.
# Load the theme settings
source-file "$TMUX_CONF_DIR/config-themes.conf"
set -g default-terminal "tmux-256color" # Set default terminal to 256 colors
set -g detach-on-destroy off # don't detach tmux when killing a session
set -g display-time 0 # Hide clock
set -g focus-events on # Focus events enabled for terminals that support them
set -g mouse on # Mouse support
set -g set-titles on # Allow tmux to set the terminal title
set -g status on # Setting status on
set -g status-keys vi # vi keys to move between panes
# Load the keybindings
source-file "$TMUX_CONF_DIR/config-keybinds.conf"
# Activity Monitoring (for when something happens in another pain)
set -g monitor-activity on
set -g visual-activity off
set -g visual-bell off
# A bell in another window should cause a bell in the current window
set -g bell-action any
# Keep Tmux alive when the initial command is finished
set -g remain-on-exit off
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# Activate with `DEBUG=1 tmux -vv`
if-shell '[ "$DEBUG" = "1" ]' 'set -g debug-file ~/.cache/tmux-debug.log'
# ╭──────────────────────────────────────────────────────────╮
# │ Theme │
# ╰──────────────────────────────────────────────────────────╯
set -g pane-active-border-style "fg=#7aa2f7"
set -g pane-border-style "fg=#3b4261"
set -g status-justify "left"
set -g status-left ''
set -g status-left-length "0"
set -g status-position "bottom"
set -g status-right "#S@#{hostname_short} #{tmux_mode_indicator}"
set -g status-right-length "30"
set -g window-status-current-format ' #I:#W#{?window_zoomed_flag, ◈ ,} '
set -g window-status-format ' #I:#W '
# ╭──────────────────────────────────────────────────────────╮
# │ Bindings │
# ╰──────────────────────────────────────────────────────────╯
# bind flags
# -r = repeatable, only needs prefix once
# -n = doesn't need prefix
# -t = binds to a certain key-table (root, copy-mode, prefix, etc.)
# Set <prefix> to Control + Space, keeping the default of C-b intact.
# C-Space send-prefix line doubles the prefix when in nested tmux session.
set -g prefix C-Space
bind C-Space send-prefix
# 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
# Easier switching between window
bind C-n next-window
bind C-p previous-window
bind C-a last-window
# Reload tmux config with <prefix> + r
unbind r
bind r "source-file ~/.dotfiles/config/tmux/tmux.conf; display 'tmux cfg reloaded!'"
# copy mode using 'Esc'
unbind [
bind Escape copy-mode
# paste using 'p'
unbind p
bind p paste-buffer
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins │
# ╰──────────────────────────────────────────────────────────╯
# ── Plugins related configurations ────────────────────────────────────
# Plugin that lets you suspend local tmux session,
# so that you can work with nested remote tmux session painlessly.
# https://github.com/MunifTanjim/tmux-suspend
set -g @suspend_key 'F12'
## A plugin to name your tmux windows smartly.
## https://github.com/ofirgall/tmux-window-name
### Maximum name length of a window
set -g @tmux_window_name_max_name_len "20"
### Replace $HOME with ~ in window names
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_ignored_programs "['sqlite3', 'antidote', 'direnv', 'md5']" # Default is []
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_name_substitute_sets "[('.+ipython2', 'ipython2'), ('.+ipython3', 'ipython3'), ('.+\.local', '.local'), ('.+asdf', 'asdf')]"
set -g @tmux_window_name_use_tilde "True"
# https://github.com/erikw/tmux-dark-notify
set -g @dark-notify-theme-path-light "$HOME/.dotfiles/config/tmux/theme-light.conf"
set -g @dark-notify-theme-path-dark "$HOME/.dotfiles/config/tmux/theme-dark.conf"
## https://github.com/MunifTanjim/tmux-mode-indicator
set -g @mode_indicator_copy_mode_style 'bg=default,fg=yellow'
set -g @mode_indicator_empty_mode_style 'bg=default,fg=#7aa2f7'
set -g @mode_indicator_prefix_mode_style 'bg=default,fg=#7aa2f7'
set -g @mode_indicator_sync_mode_style 'bg=default,fg=red'
# https://github.com/wfxr/tmux-fzf-url
set -g @fzf-url-bind 'u'
set -g @fzf-url-history-limit '2000'
# ── Sourcing the plugins ──────────────────────────────────────────────
run-shell "$HOME/.config/tmux/plugins/tmux-sensible/sensible.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-window-name/tmux_window_name.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-mode-indicator/mode_indicator.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-suspend/suspend.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-continuum/continuum.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-sessionist/sessionist.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-yank/yank.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-current-pane-hostname/current_pane_hostname.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-dark-notify/main.tmux"
run-shell "$HOME/.config/tmux/plugins/tmux-fzf-url/fzf-url.tmux"
# Load the plugins and plugin settings
source-file "$TMUX_CONF_DIR/config-plugins.conf"
# Load theme based on tmux-dark-notify state.
# This script helps states where dark-notify is not available,
# and we want to have light or dark state constantly available.
run-shell "$TMUX_CONF_DIR/theme-activate.sh"
run-shell "$HOME/.config/tmux/theme-activate.sh"
# If we started tmux with a session name, rename it.
run-shell "$TMUX_CONF_DIR/rename-session.sh"
run-shell "$HOME/.config/tmux/rename-session.sh"