-
Notifications
You must be signed in to change notification settings - Fork 0
feat(tmux): LazyVim-cohesive remote-first tmux config #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
beb09b3
chore: gitignore local planning docs
jarodtaylor 10d7a58
feat(tmux): LazyVim-cohesive remote-first tmux config
jarodtaylor 9f54306
feat(nvim): tmux-navigator + obsession; free C-Space for the tmux prefix
jarodtaylor adf47cf
fix(tmux): POSIX-portable vim_pattern; correct plugin comments
jarodtaylor e39b2f9
Merge remote-tracking branch 'origin/main' into feat/tmux-lazyvim-remote
jarodtaylor aa9aafd
style(nvim): disable blink <C-space> with false, not empty table
jarodtaylor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- The tmux prefix is C-Space, and tmux intercepts the prefix key before the | ||
| -- focused app (Neovim) ever sees it. blink.cmp's default <C-Space> binding | ||
| -- (toggle completion) would therefore be a dead key inside tmux. Free it so it | ||
| -- isn't a phantom binding; LazyVim's blink shows the completion menu | ||
| -- automatically as you type, so no manual trigger is needed. If you ever want a | ||
| -- manual trigger reachable inside tmux, bind one to a non-prefix key here. | ||
| return { | ||
| "saghen/blink.cmp", | ||
| opts = { | ||
| keymap = { | ||
| ["<C-space>"] = false, | ||
| }, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| return { | ||
| -- Seamless C-h/j/k/l navigation across Neovim splits AND tmux panes. | ||
| -- The tmux half lives in ~/.config/tmux/tmux.conf (inline bind-key lines). | ||
| -- Safe to lazy-load: the tmux side does the "is this pane running vim?" check, | ||
| -- so Neovim only needs to register these commands/keys. | ||
| { | ||
| "christoomey/vim-tmux-navigator", | ||
| cmd = { | ||
| "TmuxNavigateLeft", | ||
| "TmuxNavigateDown", | ||
| "TmuxNavigateUp", | ||
| "TmuxNavigateRight", | ||
| "TmuxNavigatePrevious", | ||
| "TmuxNavigatorProcessList", | ||
| }, | ||
| keys = { | ||
| { "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" }, | ||
| { "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" }, | ||
| { "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" }, | ||
| { "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" }, | ||
| { "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" }, | ||
| }, | ||
| }, | ||
|
|
||
| -- Keeps a live Session.vim in the cwd so tmux-resurrect's | ||
| -- @resurrect-strategy-nvim 'session' can restore your Neovim session | ||
| -- (open buffers/layout) after a reboot. No configuration needed. | ||
| { "tpope/vim-obsession" }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # ~/.config/tmux/tmux.conf — LazyVim-cohesive, remote-first tmux | ||
| # | ||
| # Mental model: tmux is a durable, per-host workspace. Sessions live on the | ||
| # host (M5 / Mac Mini / VPS); your terminals (Ghostty, Termius) are viewports. | ||
| # Detach and the work keeps running; reattach from any device and it's there. | ||
| # | ||
| # Prefix is C-Space (Ctrl+Space) — the terminal-layer sibling of Neovim's | ||
| # Space leader. Forgot a binding? Press it, then Space, for the menu (tmux-menus, | ||
| # wired up below). hjkl moves panes; C-hjkl crosses into Neovim splits. | ||
|
|
||
| # ── Prefix ─────────────────────────────────────────────────────────────────── | ||
| unbind C-b # drop the default prefix | ||
| set -g prefix C-Space # leader = Ctrl+Space | ||
| bind C-Space send-prefix # press it twice to reach a nested (e.g. SSH) tmux | ||
|
|
||
| # ── Correctness / terminal fidelity ────────────────────────────────────────── | ||
| # tmux-256color advertises italics; truecolor + undercurl are NOT in the base | ||
| # terminfo on any platform, so we add them as capability overrides below. | ||
| set -g default-terminal "tmux-256color" | ||
| set -as terminal-features ",xterm-256color:RGB" # truecolor for Neovim | ||
| set -as terminal-features ",xterm-256color:clipboard" # OSC52 capability | ||
| # undercurl + colored underlines (LSP diagnostics in Neovim) | ||
| set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' | ||
| set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' | ||
|
|
||
| set -s set-clipboard on # accept OSC52 from inner apps (Neovim 0.10+ yank) | ||
| set -g allow-passthrough on # let Neovim's DCS-wrapped OSC52 reach the terminal | ||
| set -g escape-time 0 # kill the ESC lag that plagues Neovim in insert mode | ||
| set -g focus-events on # forward focus to Neovim (autoread, etc.) | ||
|
|
||
| # ── Ergonomics ─────────────────────────────────────────────────────────────── | ||
| set -g mouse on | ||
| set -g base-index 1 # windows start at 1 (0 is a long thumb reach) | ||
| setw -g pane-base-index 1 # panes too | ||
| set -g renumber-windows on # close a window → no gaps in the numbering | ||
|
|
||
| # ── Copy mode (vim idioms) ─────────────────────────────────────────────────── | ||
| # v to start a selection, y to yank — yank rides OSC52 to your LOCAL clipboard, | ||
| # even over SSH. (Pasting INTO tmux uses the terminal's own paste; that's a tmux | ||
| # limitation, not a bug.) | ||
| setw -g mode-keys vi | ||
| bind -T copy-mode-vi v send-keys -X begin-selection | ||
| bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel | ||
|
|
||
| # ── Seamless nav: vim-tmux-navigator (tmux side, written inline) ───────────── | ||
| # C-h/j/k/l moves between tmux panes AND Neovim splits with the same keys and no | ||
| # prefix. The is_vim check asks "is the focused pane running Neovim?" — if so the | ||
| # keys pass through to Neovim; otherwise tmux moves the pane. (Neovim side is the | ||
| # christoomey/vim-tmux-navigator plugin spec.) | ||
| # [^[:space:]] (POSIX non-whitespace), not \S — \S is a GNU/PCRE extension that | ||
| # breaks under macOS/BSD grep -E, where `ps -o comm=` returns nvim's full path. | ||
| vim_pattern='([^[:space:]]+/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?' | ||
| is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | ||
| | grep -iqE '^[^TXZ ]+ +${vim_pattern}$'" | ||
|
jarodtaylor marked this conversation as resolved.
|
||
| bind -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' | ||
| bind -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' | ||
| 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' | ||
| bind -n 'C-\' if-shell "$is_vim" 'send-keys C-\\' 'select-pane -l' # last pane | ||
|
jarodtaylor marked this conversation as resolved.
|
||
|
|
||
| # ── Mnemonic bindings (small on purpose — the menu surfaces the rest) ──────── | ||
| # Splits open in the CURRENT pane's directory, so a new pane lands where you are. | ||
| bind | split-window -h -c "#{pane_current_path}" # | looks like a vertical wall | ||
| bind - split-window -v -c "#{pane_current_path}" # - looks like a horizontal one | ||
| bind c new-window -c "#{pane_current_path}" | ||
| bind r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded" | ||
| # zoom a pane to fullscreen is prefix-z (built in); repeat to unzoom. | ||
|
|
||
| # ═══ Plugins ═════════════════════════════════════════════════════════════════ | ||
| # Vendored to ~/.config/tmux/plugins/ by .chezmoiexternal.toml. The LOAD ORDER | ||
| # below is load-bearing: continuum extends status-right with its autosave hook, | ||
| # and catppuccin SETS status-right — so catppuccin must load before continuum or | ||
| # the autosave is silently lost. Order: menus → catppuccin → resurrect → continuum. | ||
|
|
||
| # tmux-menus — press <prefix> Space for a popup menu of tmux actions and their | ||
| # keys (the discoverability layer). Pure tmux script; nothing to build. | ||
| set -g @menus_trigger 'Space' | ||
| run-shell ~/.config/tmux/plugins/tmux-menus/menus.tmux | ||
|
|
||
| # catppuccin (mocha) — theme + status line. Built-in modules only; cpu/ram/battery | ||
| # would need companion plugins (deferred). Sourced before resurrect/continuum. | ||
| set -g @catppuccin_flavor "mocha" | ||
| set -g @catppuccin_window_status_style "rounded" | ||
| run ~/.config/tmux/plugins/catppuccin/tmux/catppuccin.tmux | ||
| set -g status-right-length 100 | ||
| set -g status-left-length 100 | ||
| set -g status-left "" | ||
| set -g status-right "#{E:@catppuccin_status_application}" | ||
| set -agF status-right "#{E:@catppuccin_status_session}" | ||
| set -agF status-right "#{E:@catppuccin_status_date_time}" | ||
|
|
||
| # tmux-resurrect — save/restore sessions. Restore Neovim sessions too (needs | ||
| # tpope/vim-obsession on the Neovim side, installed via lazy.nvim). | ||
| set -g @resurrect-strategy-nvim 'session' | ||
| run-shell ~/.config/tmux/plugins/tmux-resurrect/resurrect.tmux | ||
|
|
||
| # tmux-continuum — auto-save every 15 min + restore on tmux start. MUST be the | ||
| # last plugin sourced (see the load-order note above). | ||
| set -g @continuum-restore 'on' | ||
| set -g @continuum-save-interval '15' | ||
| run-shell ~/.config/tmux/plugins/tmux-continuum/continuum.tmux | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.