Improve gnvim launcher
We recently grew a gnvim command for launching Neovim.app from the terminal. Here's what it does and what it should ideally do. There is lots of room for improvement here. Please post if you disagree with any of this proposed functionality, or have other suggestions.
| Invocation | Neovim.app state | Desired Effect | Implemented? |
|---|---|---|---|
gnvim |
Not running | Open Neovim | Yes |
| Running | Switch to Neovim | Yes | |
With file names e.g. gnvim somefile |
Not running | Open Neovim and edit given file | Yes |
| Running | Switch to Neovim and edit given file | No | |
With complex arguments e.g. gnvim +358 somefile -u NONE |
Not running | Open Neovim and pass args to it | Yes |
| Running | Switch to Neovim, open new window and pass args to the new Neovim instance | No |
Flags
| Flag | Behaviour |
|---|---|
-f |
Wait until exit (to allow gnvim to be used as $EDITOR) |
| something | Always start a new Vim instance (not implemented) |
Other thoughts
- Should we distinguish between passing filenames and passing “complex arguments” to
gnvim?- If we do, we get to open specified files in the existing Vim instance if Neovim.app is already running, only starting a new Vim instance if we receive “complex” (i.e. not filenames) args
- If we don't, logic is much simpler & more consistent.
Currently if i run
$ gnvim .
and then
$ gnvim ~/.gvimrc
Then 2nd command is ignored. I would expect it to open another window with the contents (same as macvim).
I would expect any additional
$ gnvim commands to open a new blank window (if no args are passed)
oh man, -f is a critical feature for me. it's not clear to me that upstream Neovim supports that sort of functionality, though; do you know how to get the behavior i want?
It seems we wouldn't need upstream to know about -f; it'd just be a case of waiting until the Neovim instance terminates before letting the script exit.
ok, i have an initial implementation in #202. and then i promise i'm done hacking on Neovim.app for one day :)
I'd happy to see some progress here.
For instance, I'd expect to be able to open gnvim with $ gnvim -u NONE for debugging purposes.
Also a help flag to document already accepted flags would be a great first step: $ gnvim --help.