If the given instance is not found, we fork nvr.
The parent process gets replaced by a new nvim instance.
The child waits for one second and then tries attaching to the newly started
nvim instance.
Advantage: All options passed to nvr are now correctly handled even by new nvim
instances that were started by nvr.
References https://github.com/mhinz/neovim-remote/issues/44
Small tradeoff: You get no error anymore when you provide no arguments to
--remote and friends.
Internally this results in an empty list instead of None. This is important,
because otherwise you'd get an error with `--remote -- foo`, because `--` and
`foo` would be parsed into the remaining arguments and --remote had no argument.
In return it's now possible to provide files beginning with a dash to any
--remote option. Leading -- before those files is not needed.
Equivalent:
--remote --file
--remote -- --file
Fixes https://github.com/mhinz/neovim-remote/issues/43
Before this commit all --remote* options took 1 or more files as arguments. Now
--remote-wait and --remote-wait-silent take 0 or more arguments.
This is useful if nvr is started by another program. E.g. setting git's
core.editor to "nvr" wasn't working when "git commit" was used from within
:terminal.
Now it does: set core.editor to "nvr --remote-wait-silent" instead.
When called from a shell, it starts a new Neovim instance. When called from
within :terminal, the current Neovim instance will be used.
This should work for all similar use cases.
References #39.
It's a list of channel IDs for each connected nvr.
Imagine `nvr --remote-wait file` used twice from different shells.
You could disconnect them with exit code 1 like this:
command! Cq
\ if exists('b:nvr')
\| for chanid in b:nvr
\| silent! call rpcnotify(chanid, 'Exit', 1)
\| endfor
\| endif
References #27.