Skip to content

neovim-remote v1.7.0

Latest
Compare
Choose a tag to compare
@mhinz mhinz released this 23 Jun 16:51
· 167 commits to master since this release

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'