Co-op mode for Neovim
Screen-sharing works until the other person actually wants to type. Multiplayer.nvim is my take on video-game-style co-op inside Neovim: both people keep their own config, plugins, and keybindings while editing the same buffer in real time.
Instead of spinning up a hosted collaboration server, the plugin lets either editor host a session directly from the terminal.
:Coop host
:Coop join
:Coop share
When you host, the plugin copies a connection ticket straight into your clipboard (+ register). Your partner runs :Coop join, pastes the ticket, and their Neovim instance connects peer-to-peer, holding shared buffers in memory and syncing saves back to the host.
Lua inside the editor, Rust on the wire
Neovim already ships with the primitives needed to observe a buffer closely, so the plugin splits responsibilities cleanly between Lua and Rust:
- Buffer tracking (
nvim_buf_attach): The same API that powers LSP in Neovim hookson_lineson every shared buffer, sending line diffs overvim.rpcnotifyas you edit. - Presence & jumpable cursors:
CursorMovedandCursorMovedIautocmds publish each collaborator’s position and visual selection. Remote cursors are written as native Neovim marks (nvim_buf_set_mark) and highlight namespaces, so you don’t just see where your teammate is: you can jump straight to them with a normal Vim mark. - Peer-to-peer transport: Lua spawns a compiled Rust
commsbinary viavim.uv.spawn(). Built with Iroh, Tokio, and QUIC (iroh-quinn, custom ALPNMULTIPLAYER.NVIM), it tunnels Neovim’s RPC traffic over low-latency UDP streams without port forwarding or a central server.
The hard parts
Shipping an edit across the network is the easy half. Making two editors stay coherent while both people type at once breaks down into three problems:
- Echo loops: Applying a remote
nvim_buf_set_linestriggerson_lineslocally. Tracking the originatingclient_numberon the last applied edit keeps remote changes from bouncing right back across the wire. - Concurrent edits: Naive line-range patches work cleanly when two people edit different parts of a file, but overlapping inserts, deletes, and undo trees push directly toward CRDTs or Operational Transformation.
- Session lifecycle: Keeping in-memory guest buffers, file saves, disconnects, and Rust sidecar cleanup (
VimLeave/SIGTERM) predictable across messy real-world sessions.
Where it stands
Multiplayer.nvim is under active development, with rough edges and breaking changes documented in the repository. It has been one of my favorite playgrounds for combining Neovim internals, async Rust networking, and distributed-state tradeoffs in one project.