chore(config): tmux config tweaks, new settings

This commit is contained in:
2025-01-07 21:29:25 +02:00
parent 7bc7230990
commit c37793f649
2 changed files with 41 additions and 17 deletions

View File

@@ -13,16 +13,11 @@
# -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.
# unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
@@ -37,12 +32,29 @@ bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# Reload tmux config with <prefix> + r
unbind r
bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux cfg reloaded!"
# Switch to next client with <prefix>( and previous with <prefix>)
# Repeatable, only needs prefix once
bind -r '(' switch-client -p\; refresh-client -S
bind -r ')' switch-client -n\; refresh-client -S
# Switch between previous and next windows with repeatable
# <prefix> + n and <prefix> + p
bind -r n next-window
bind -r p previous-window
# Switch between two most recently used windows
bind Space last-window
# Move the current window to the next window or previous window position
bind -r N run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) + 1)"
bind -r P run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) - 1)"
bind-key > swap-window -t +1 \; next
bind-key < swap-window -t -1 \; prev
# Open a new window with <prefix> + N
bind N new-window
@@ -52,13 +64,14 @@ bind M-c attach-session -c "#{pane_current_path}"
# Open a new window in the current directory
bind C new-window -c "#{pane_current_path}"
# 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
# Copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Splits
bind '"' split-window -v -c "#{pane_current_path}"
bind '!' split-window -h -c "#{pane_current_path}"
bind '^' switch-client -t'{marked}'
# .local/bin/t triggers
bind -r T new-window ~/.local/bin/t
@@ -80,17 +93,23 @@ bind p paste-buffer
# │ Settings │
# ╰──────────────────────────────────────────────────────────╯
# set -g default-terminal "tmux-256color"
# set -ag terminal-overrides ",xterm-256color:RGB"
# Undercurl
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colors - needs tmux-3.0
# set -g default-terminal "tmux-256color"
# set -ag terminal-overrides ",xterm-256color:RGB"
# Enable hyperlinks
set -as terminal-overrides ',*:Hls=\E]8;id=%p1%s;%p2%s\E\\:Hlr=\E]8;;\E\\''
# Setting status on
set -g status "on"
# Allow tmux to set the terminal title
set -g set-titles on
# Hide clock
set -g display-time 0
@@ -99,6 +118,9 @@ 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
# Expose window title
set-option -g set-titles on
@@ -129,6 +151,12 @@ set -g detach-on-destroy off
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# Focus events enabled for terminals that support them
set -g focus-events on
# Useful when using sharing a session with different size terminals
setw -g aggressive-resize on
# ╭──────────────────────────────────────────────────────────╮
# │ Theme │
# ╰──────────────────────────────────────────────────────────╯

View File

@@ -3,8 +3,6 @@
Leader: `<ctrl><space>`
```txt
Space Select next layout
# List all paste buffers
$ Rename current session
% Split window horizontally
& Kill current window
@@ -27,7 +25,6 @@ Leader: `<ctrl><space>`
; Move to the previously active pane
= Choose a paste buffer from a list
? List key bindings
D Choose and detach a client from a list
E Spread panes out evenly
L Switch to the last client
M Clear the marked pane
@@ -37,7 +34,6 @@ Leader: `<ctrl><space>`
f Search for a pane
i Display window information
m Toggle the marked pane
n Select the next window
o Select the next pane
q Display pane numbers
s Choose a session from a list