From 5ca464c2ac1ac715668e65277f89b4fc76625ce6 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 4 Jul 2026 13:50:00 -0400 Subject: [PATCH] tmux: Initial config --- .config/dot/CLAUDE.md | 10 ++++- .config/fish/functions/tmx.fish | 3 ++ .config/tmux/tmux.conf | 65 +++++++++++++++++++++++++++++++++ .github/README.md | 5 +++ .github/keybindings.md | 34 +++++++++++++++++ 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 .config/fish/functions/tmx.fish create mode 100644 .config/tmux/tmux.conf create mode 100644 .github/keybindings.md diff --git a/.config/dot/CLAUDE.md b/.config/dot/CLAUDE.md index 929a0a0..0890474 100644 --- a/.config/dot/CLAUDE.md +++ b/.config/dot/CLAUDE.md @@ -87,7 +87,7 @@ of `dot` itself. `_dot__usage` should print its text as a single multi-line `echo "..."` string (fish preserves literal newlines inside double quotes) rather than one `echo` per line. -4. Add a row to `~/.gitea/README.md`'s command table for it — one row per +4. Add a row to `~/.github/README.md`'s command table for it — one row per distinct use case, with paths written relative to `$HOME` (`~/.config/dot/...`), not relative to the README's own location. 5. Add a case to `~/.config/dot/tests/dot.fish` covering it, including its @@ -118,3 +118,11 @@ Tests live at `~/.config/dot/tests/dot.fish`, run with - `@test "description" ` mirrors fish's `test` builtin (`-eq`, `-ne`, `=`, `-e`, `-f`, `-d`, `-n`, `-z`); `-a`/`-o` combinators aren't supported. + +## Keybindings + +Whenever a keybind is added, changed, or removed in *any* config on this +machine (tmux, KDE, neovim, fish, whatever), add or update its row in +[`~/.github/keybindings.md`](../../.github/keybindings.md) in the same +change. That file is the single reference for every keybind across tools — +it drifts the moment a bind changes somewhere without a matching edit there. diff --git a/.config/fish/functions/tmx.fish b/.config/fish/functions/tmx.fish new file mode 100644 index 0000000..8225760 --- /dev/null +++ b/.config/fish/functions/tmx.fish @@ -0,0 +1,3 @@ +function tmx --description 'Attach to a tmux session, creating it if needed' + tmux new-session -A -s $argv[1] +end diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..35fc763 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,65 @@ +# Prefix: Ctrl-Space. Chosen over Ctrl-b (awkward reach) and Ctrl-a (collides +# with readline's beginning-of-line, which fights editing text in shells and +# in Claude Code's prompt). Verified clear of IME/KDE/Claude Code bindings. +unbind C-b +set -g prefix C-Space +bind C-Space send-prefix + +set -g mouse on +# OSC52 lets copy-mode selections land in the system clipboard via the +# terminal itself (Alacritty supports it) -- no wl-copy/xclip needed, and it +# still works over SSH later since the escape sequence travels with the data. +set -g set-clipboard on + +set -g mode-keys vi +set -g status-keys vi +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send -X copy-selection-and-cancel +bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel + +# tmux's -h/-v split flags name the *arrangement*, not the divider line, which +# is backwards from how the divider looks -- so pick keys by what they draw: +# \ draws a side-by-side split (vertical line), - draws a stacked split +# (horizontal line). Unshifted versions of |/- since splitting is frequent. +unbind % +unbind '"' +bind \\ split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on + +bind r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded" + +# True color passthrough. ",*" (rather than naming Alacritty's xterm-256color +# specifically) so this keeps working if the terminal emulator changes later. +set -g default-terminal "tmux-256color" +set -ag terminal-overrides ",*:RGB" + +# Default 500ms delay on Esc exists to disambiguate meta-key sequences; it +# reads as noticeable lag exiting insert mode in neovim, so drop it. +set -sg escape-time 10 + +set -g history-limit 10000 + +# Minimal status bar (session + window list only), styled to match the Nord +# theme already used in alacritty.toml. +set -g status-position bottom +set -g status-style "bg=#2E3440,fg=#D8DEE9" +set -g status-left " #S " +set -g status-left-length 20 +set -g status-right "" +setw -g window-status-current-style "bg=#88C0D0,fg=#2E3440,bold" +setw -g window-status-current-format " #I:#W " +setw -g window-status-format " #I:#W " +setw -g window-status-style "fg=#4C566A" + +set -g pane-border-style "fg=#3B4252" +set -g pane-active-border-style "fg=#88C0D0" diff --git a/.github/README.md b/.github/README.md index e1360fd..0ca2348 100644 --- a/.github/README.md +++ b/.github/README.md @@ -24,3 +24,8 @@ fish -c 'dot init' See [CLAUDE.md](../.config/dot/CLAUDE.md) for the `dot` tool's internal architecture, bootstrap logic, subcommand dispatch, and test suite. + +## Keybindings + +See [keybindings.md](keybindings.md) for custom and useful default +keybindings across configured tools (currently: tmux). diff --git a/.github/keybindings.md b/.github/keybindings.md new file mode 100644 index 0000000..a555859 --- /dev/null +++ b/.github/keybindings.md @@ -0,0 +1,34 @@ +# Keybindings + +Quick reference for custom and useful default keybindings, so they don't have +to be re-discovered or looked up per tool. + +Comma-separated keys are pressed in sequence, not together. + +| Key | Context | Action | +| ----------------------------------------------------- | ------- | -------------------------------------------------- | +| `Ctrl` + `Space`, `\` | tmux | Split side-by-side, opens in current directory | +| `Ctrl` + `Space`, `-` | tmux | Split stacked, opens in current directory | +| `Ctrl` + `Space`, `h` / `j` / `k` / `l` | tmux | Move focus left / down / up / right | +| `Ctrl` + `Space`, `z` | tmux | Zoom/unzoom pane to fullscreen | +| `Ctrl` + `Space`, `o` | tmux | Cycle focus to next pane | +| `Ctrl` + `Space`, `x` | tmux | Kill current pane (asks to confirm) | +| `Ctrl` + `Space`, `Ctrl` + `Up`/`Down`/`Left`/`Right` | tmux | Resize pane | +| `Ctrl` + `Space`, `c` | tmux | New window, opens in current directory | +| `Ctrl` + `Space`, `0`-`9` | tmux | Jump to window by number | +| `Ctrl` + `Space`, `n` / `p` | tmux | Next / previous window | +| `Ctrl` + `Space`, `w` | tmux | Interactive window list | +| `Ctrl` + `Space`, `,` | tmux | Rename current window | +| `Ctrl` + `Space`, `&` | tmux | Kill current window (asks to confirm) | +| `Ctrl` + `Space`, `[` | tmux | Enter copy mode | +| `Ctrl` + `Space`, `]` | tmux | Paste most recent copy | +| `h` / `j` / `k` / `l` | tmux | Move cursor | +| `v` | tmux | Begin selection | +| `y` | tmux | Copy selection to system clipboard, exit copy mode | +| `/` / `?` | tmux | Search forward / backward | +| `q` | tmux | Exit copy mode | +| `Ctrl` + `Space`, `d` | tmux | Detach from session | +| `Ctrl` + `Space`, `$` | tmux | Rename session | +| `Ctrl` + `Space`, `s` | tmux | Interactive session list | +| `Ctrl` + `Space`, `(` / `)` | tmux | Switch to previous / next session | +| `Ctrl` + `Space`, `r` | tmux | Reload `tmux.conf` |