:edit and similar commands used by the --remote* options throw an exception if
the buffer is modified:
E37: No write since last change (add ! to override)
Using :enew! doesn't work, since it reverts all changes. Thus we simply reset
&modified temporarily.
References https://github.com/mhinz/neovim-remote/issues/54
nvr +1 +2 3 +4 5
The above will do the following in the given order:
- open file "5"
- open file "+4"
- open file "3"
- execute :2
- execute :1
That's how Vim does it.
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