3 ms·
> One use case for the new remote functionality is the ability to open files from the embedded terminal emulator in the primary Neovim instance, rather than cre
by scottlamb 5y ago
> One use case for the new remote functionality is the ability to open files from the embedded terminal emulator in the primary Neovim instance, rather than creating an embedded Neovim instance running inside Neovim itself.
Hmm, if I type "git commit" within the terminal, is there some value of $EDITOR that would make it launch a buffer to edit the commit message, then finish when I close the buffer? (and if so, are there distinguishable success vs failure ways to close the buffer?) That's my biggest editor-within-an-editor moment.
- ComputerGuru 5y agoI'm not sure if I understand you, but with EDITOR=nvim it'll do just that. To "commit" w/ the message you have in editor, ZZ. To abort, use :cq
- scottlamb 5y agoThat's a separate nvim instance within the terminal of the outer nvim instance. If I'm understanding this feature correctly, the idea is that instead of that, you make the outer nvim instance do stuff. Then pasting back and forth between buffers works better, etc. It wasn't clear to me from this short blurb though if that includes blocking for the buffer to be handled and then signalling success or failure to the caller. (or for that matter if I'll remember the mechanism for it if there is one. I operate on muscle memory and might just stick with the tiny editor within the bigger one. But I'm curious anyway.)
- ComputerGuru 5y agoOh, I see. I got derailed by the usage of terminal to refer to three different things :)
- tekknolagi 5y agoIt would be nice if it overrode EDITOR with some command that opened a new pane in your existing Nvim session. That seems doable. Alternatively, Tim Pope's fugitive is pretty great and you can write :Git commit and it does just that.
- scottlamb 5y agoIt could even overlay the terminal pane for the duration of the command with the buffer pane. So it'd look a lot like opening the second editor instance, except incorporated with the first editor's buffer list, registers, etc.
- groves 5y agoFor that to work, you'll need the 'wait' versions of the remote flags. Those are still being worked on in a PR, but I'm hoping to finish them up by the next release: https://github.com/neovim/neovim/pull/17856 https://github.com/neovim/neovim/pull/17856 That said, this sort of remote opening has been possible in Neovim since the client-server stuff was added in the early days. This is only adding the remote editing flags and implementation to Neovim itself to make it easier. Neovim-remote(https://github.com/mhinz/neovim-remote#typical-use-cases https://github.com/mhinz/neovim-remote#typical-use-cases) is an outside-of-Neovim way to do it with the Python client. It has an $EDITOR setting listed there. Or if you don't want to use Python, you can use invim(https://github.com/groves/invim#to-use-as-your-git-commit-message-editor https://github.com/groves/invim#to-use-as-your-git-commit-me...). It's just a shell script. Or you can wait for the next release!