Skip to content

Releases: mhinz/neovim-remote

neovim-remote v1.7.0

23 Jun 16:51
Compare
Choose a tag to compare

Upgrade: pip3 install -U neovim-remote

Noteworthy change

If no remote process is found, nvr used to start a new nvim process with a few of the arguments that were given to nvr. Sometimes this worked, sometimes it didn't. (You couldn't just use all of the arguments given to nvr with a new nvim process due to nvr-specific options.)

Basically nvr used to work differently for remote processes and new local processes.

Now, when no remote process is found, nvr forks itself.

The parent process gets replaced by a new nvim process, without any arguments. Its servername is set to whatever was given to nvr as --servername or $NVIM_LISTEN_ADDRESS. If none was given, it defaults to /tmp/nvimsocket. If the socket already exists, it will create a new socket using the format of /tmp/nvimsocket_XXXXXX.

The child process tries up to 10 times and an interval of 0.2s to attach to the new nvim process. Usually it needs much less than 10 times, but it's a safe fallback. When it attaches successfully, nvr simply does what it normally does, as if the newly created nvim process existed right from the beginning.

This is nice, because there's absolutely no distinction between "already existing" and "newly created" nvim processes anymore.

Documentation

I added a typical use case to the README and a short example of it to the output of nvr -h:

Imagine Neovim is set as your default editor: EDITOR=nvim.

Now run git commit. In a regular shell, a new nvim process starts. In a terminal buffer (:terminal), a new nvim process starts as well. Now you have one nvim nested within another. You don't want that. Put this in your vimrc:

if has('nvim')
  let $VISUAL = 'nvr -cc split --remote-wait'
endif

That way, you get a new window for entering the commit message instead of a nested nvim process.

Alternatively, you can make git always use nvr. In a regular shell, nvr will create a new nvim process. In a terminal buffer, nvr will open a new buffer.

$ git config --global core.editor 'nvr --remote-wait-silent'

neovim-remote v1.4.0

06 Dec 23:49
Compare
Choose a tag to compare

Upgrade: pip3 install -U neovim-remote

A few bugs were fixed and the documentation was polished a lot. The main changes were..

Read from stdin

The following does exactly what you expect it to do:

$ cat file | nvr -o -
$ echo "foo\nbar" | nvr --remote-wait -

Quit using the same exit code as nvim

nvr --remote-wait file and then :cquit in nvim will make nvr quit with exit code 1.

This only works if your nvim is recent enough. Otherwise nvr will always quit with 0.

Expose b:nvr

Imagine nvr --remote-wait file. The buffer that represents "file" in nvim now has a local variable b:nvr. It's a list of channels for each connected nvr process.

If we wanted to create a command that disconnects all nvr processes with exit code 1:

command! Cquit
    \  if exists('b:nvr')
    \|   for chanid in b:nvr
    \|     silent! call rpcnotify(chanid, 'Exit', 1)
    \|   endfor
    \| endif