Neovim-remote

Latest version: v2.5.1

Safety actively analyzes 619291 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.7.0

_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:


vim
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'

1.4.0

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](https://github.com/neovim/neovim/commit/d2e8c76dc22460ddfde80477dd93aab3d5866506). 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

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.