Skip to content

Add tmux integration with session save/restore, reconnection, and autosave hardening - #26

Open
nikvdp wants to merge 2 commits into
masterfrom
tmux-startup-autosave-hardening
Open

nikvdp wants to merge 2 commits into
masterfrom
tmux-startup-autosave-hardening

Conversation

@nikvdp

@nikvdp nikvdp commented Jun 27, 2026

Copy link
Copy Markdown
Owner

This PR ships a major tmux integration rewrite for Neomux, plus several hardening fixes discovered while preparing it for review.

What changed

  • Moved all tmux logic into a dedicated autoload/neomux/tmux.vim module.
  • Added terminal naming (:NeomuxRename, default name generation, uniqueness suffixes, tmux sync).
  • Implemented session save/restore with a stable dictionary-based layout tree and two-pass restore using winrestcmd().
  • Added tmux session reconnection (:NeomuxTmuxReconnect) with live NVIM socket discovery and stale-socket cleanup on startup.
  • Replaced autosave polling with event-driven, debounced saves to avoid focus stealing.
  • Added user autocmd hooks (NeomuxSessionSaved, NeomuxSessionRestored, NeomuxSessionAutosaved) for custom integrations.
  • Restored hidden neomux terminals during session restore and added a buffer picker for neomux terminals.
  • Made nmux smart: splits inside an existing neomux session, starts a new session outside.
  • Fixed PATH propagation to neomux shells and a zsh alias conflict when sourcing funcs.sh.
  • Added nxr alias for refreshing stale shell environments.
  • Added NeomuxGetConnectCommand() to get the tmux attach command for external connection.
  • Hardened tmux command construction against shell injection and dead-socket races.
  • Updated README.md and doc/neomux.txt to document the new architecture, autosave, restore/reconnect, and socket cleanup behavior.

Validation

  • Verified plugin loads cleanly with nvim --clean --headless +"source plugin/neomux.vim" +"qa!".
  • Smoke-tested :Neomux terminal creation, session save/restore, and reconnect flows locally.

Follow-up notes

  • The diff is large because the tmux module is new; review may be easier commit-by-commit.
  • Some commits near the top are doc/whitespace/cleanup changes made before opening the PR.

nikvdp added 2 commits June 27, 2026 16:18
This refactor moves the tmux subsystem out of the main plugin file while preserving the existing command and function surface.

- Added autoload/neomux/tmux.vim for tmux session, naming, restore, autosave, picker, and connect helpers
- Replaced core tmux calls with neomux#tmux# entry points loaded only when tmux behavior is used
- Kept documented Neomux* compatibility wrappers in plugin/neomux.vim

This makes the main plugin file focused on core startup and terminal behavior without changing user-facing tmux commands.
This docs update removes stale wording that framed Neomux as a wrapper around Python neovim-remote.

- Described nvr-go as the default reimplementation of the nvr command surface Neomux uses
- Updated manual installation guidance to prefer downloading nvr-go into plugin/bin/nvr
- Kept Python neovim-remote documented as a compatible external nvr executable

The README now matches the current nvr-go-based communication path without changing runtime behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant