Connect to Neovim
nvim-remote.sh, next to this file, drives Neovim instances started with
nvim --listen SOCKET. Run it with no argument for the full usage.
nvim-remote.sh list— instances whose cwd is this session's cwd or below, as TSV: socket, cwd, focused buffer.- No line: tell the user to start Neovim with
nvim --listen SOCKET, then stop. - Two or more: ask which one (
AskUserQuestion, labelled with the focused buffer), thenexport NVIM_SOCK=<socket>for the commands below. Every command refuses to guess while more than one instance is listening.
- No line: tell the user to start Neovim with
nvim-remote.sh state— cwd, focused buffer, cursor,mode(),&modified, the visual selection, and the buffer list. The selection islivewhile the user is in visual mode andlastonce they have left it.nvim-remote.sh text [FILE]— buffer text. Read it from here rather than from disk while&modifiedis 1.nvim-remote.sh reload FILE—:checktime, so the instance picks up a file you just edited. Run it after every edit to a file the instance has open. It refuses when the buffer carries unsaved changes; ask the user to save or discard rather than forcing it.nvim-remote.sh expr EXPRandnvim-remote.sh send KEYS— anything the commands above do not cover. Confirm with the user before sending keys that change a buffer.