stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.84k stars 110 forks source link

Guidance Request for integrating Netman with Oil.nvim #313

Closed miversen33 closed 7 months ago

miversen33 commented 7 months ago

Did you check existing requests?

Describe the feature

I would normally put this in a discussion board but it looks like those aren't active here, so you get a feature request instead :)

I see this fella just hanging out there and I remember talking about integrating netman with oil a while ago.

As discussed in that post, I have finally updated the main branch of netman to support async communication.

I began diving into oil as a consumer of netman a while ago but got a bit stuck on some of the inner workings of the ssh adapter. Instead of beating my head against a wall for a while, I figured I would reach out and see if I could get a bit of guidance on this as it seemed to be a topic that we both agreed on a while back.

That said, I fully appreciate if you do not have the time or interest in providing said guidance. Please do not feel obligated to do so :)

Some topics for discussion here are

1) Does netman live as its own adapter in oil or does it take over ssh (and add docker)? 1a) If netman does live as its own adapter, is it something that belongs in core oil.nvim at all?
2) How does netman feed a "console" to oil? It seems that oil has the ability to open terminals for its adapters.
3) ???

I seem to recall a comment in your code indicating that you weren't ready to open a stable API yet for oil and thus I acknowledge that this request might be a bit early for oil. If you would prefer waiting, I am absolutely fine with that as well :)

I (and all the rest of the neovim community) appreciate you :)

stevearc commented 7 months ago

First some comments on the structure and how it could fit with oil:

The place where it provides the most obvious benefit would be accessing files in a docker container, since oil can't do that yet. We could build an adapter for that, but I'm not quite sure how the file moving/copying could work. The point of netman is that it doesn't want to be a single adapter, it wants to be all of them.

You're of course welcome to try out making an adapter with netman. The API is more solidified now, though I'm still not actively encouraging the creation of a lot of third-party adapters. The shape is defined here https://github.com/stevearc/oil.nvim/blob/bf753c3e3f8736939ad5597f92329dfe7b1df4f5/lua/oil/init.lua#L16-L29

  1. Does netman live as its own adapter in oil or does it take over ssh (and add docker)? 1a) If netman does live as its own adapter, is it something that belongs in core oil.nvim at all?

I think this would probably live in its own repo, where it will be easier to iterate on.

How does netman feed a "console" to oil? It seems that oil has the ability to open terminals for its adapters.

The logic right now lives in the action, but we could push that down into the adapters instead https://github.com/stevearc/oil.nvim/blob/bf753c3e3f8736939ad5597f92329dfe7b1df4f5/lua/oil/actions.lua#L141-L172

Some more free-form thoughts: I don't think it makes much sense to try to integrate netman into oil with the current state of things. If I was building oil today, I would absolutely try to build on top of netman first to get the nice support for multiple sources for free. But since we've been developing these two projects in parallel, I've basically already implemented everything I would be using netman for. The adapter system is my version of what netman provides, just tailored very specifically for oil. For that reason, it will be really hard to remove it and retrofit oil to use netman instead. We might be able to find a way to use netman in addition, but I'm also not convinced that that approach will be very valuable.

I love the project and I think it can be very useful, but I see the most value in applying it to file managers that don't yet have support for multiple sources. nvim-tree, neo-tree, honestly adding it to dirvish could be really interesting. I love dirvish as a much more minimal replacement for netrw, but it is notably missing ssh support.

miversen33 commented 7 months ago

I can appreciate that :) I think for now then, I will consider the integration as a super low priority thing (and if it does happen, it will be maintained by netman) as it doesn't currently provide enough value to either of us to spend time on now. Getting a breakdown of the API needed will be super useful in the future should this be revisited though! Thanks :)