Closed frarees closed 1 year ago
No it's not possible. Vim doesn't have a mechanism to "attach" to a running process, so stdio requires managing the process from a single vim session.
The only real solution is to keep vim running for longer sessions. If you really don't like keeping a "main" vim running, you might want to look into vim's client/server system, where you'd open an initial, long running vim as the server, and launch subsequent vim windows as clients, which still share the same buffers and processes as the server vim.
Whether this will work with OmniSharp-vim and stdio jobs, I don't know: I've never tried it.
Scratch that: after reading up a bit in :h client-server
I don't think it will be useful here
Would it be possible (or does it even make sense) to pipe the streams into e.g., a socket and use that as a communication channel? So that you don't have to mess with the process. Similar to how neovim works.
Similar to how neovim works
I have no idea what this means.
I really don't know if what you're proposing is possible. Is it worth the work to try it out? Why not just leave your vim session running?
I have no idea what this means.
https://neovim.io/doc/user/remote.html
So vim's client-server
. But yeah scratch that.
Why not just leave your vim session running?
I'm exploring the possibility to improve vim integration with Unity.
So, for example, if you were to have two Unity projects open, upon double-clicking a file to edit, that would open you a specific vim server with all the files for that project in a GUI (thinking MacVim, VimR, gVim, etc). So one GUI window per project.
Also, upon adding/deleting files from within Unity, I could trigger a /reloadsolution
, etc. In such scenario, it would make sense that Unity is handling OmniSharp completely, hence why I'm exploring the possibility to manually start the OmniSharp instance outside of omnisharp-vim.
So, for example, if you were to have two Unity projects open, upon double-clicking a file to edit, that would open you a specific vim server with all the files for that project in a GUI (thinking MacVim, VimR, gVim, etc). So one GUI window per project.
Perhaps vim's client-server is still a good option here. If you open the first gvim to be a server for project one, with e.g. gvim --servername project1
, and then configure Unity to open files with vim --servername %p --remote %f
(I have no idea how to configure Unity so I'm just throwing in some %p
and %f
for possible "projectname" and "filename" patterns)
Yeah I can try that.
Is there a clean way to know if an instance is already running? Or should I just ask if the named pipe exists?
if exists(/tmp/unity_project_1.pipe)
nvim --listen /tmp/unity_project_1.pipe
else
nvim --server /tmp/unity_project_1.pipe
I don't know sorry.
I'll close this. Thanks!
Thanks. Feel free to report back if you come up with a good solution!
Use case:
I'm working with Unity and currently it takes ~20-30 seconds to fully load my solution. I tend to open and close vim often, meaning the omnisharp server gets stopped / started a bunch of times, hence slowing my iteration times down.
I'd like to be able to start a server and keep it open for as long as I have my Unity project open, and want vim to be able to communicate with it.
With the HTTP server it's easy since you'd have to set the port you want to listen to, but I'm not sure if this is possible with the stdio server? If so, how?