juftin / browsr

🗂️ a pleasant file explorer in your terminal supporting all filesystems
http://juftin.com/browsr/
MIT License
225 stars 13 forks source link

[Feature Request] Add ability to edit files i.e. with NVIM #42

Open dwilliam62 opened 4 months ago

dwilliam62 commented 4 months ago

I really like the look and remote capabilities. It may not be possible for remote connections, but for local files the ability to browse and do quick edits would be amazing

juftin commented 4 months ago

This is coming! (eventually). I've had my eye on this feature for a while - that's why I recently refactored browsr to be more modular.

It wouldn't be NVIM - instead it's a textual (the underlying framework behind browsr) widget called TextArea.

It will improve the code viewing experience too as it supports things like text highlighting. It will even support (some) remote filesystems.

I'm specifically waiting on more languages to be supported by syntax highlighting for this (https://github.com/Textualize/textual/pull/4160).

As far as the UX is concerned I was thinking about an E keyboard shortcut that launches you into editing mode in a new window. It'll probably be more similar to nano than vim - since that's what I know and I'd like it to be pretty simple.

dwilliam62 commented 4 months ago

Sounds good. However many people prefer their own editors NVIM/EMACS because they are set up like mine for language parsing I would suggest making that an option.

Regards, Don

On Mon, Mar 4, 2024 at 4:20 PM Justin Flannery @.***> wrote:

This is coming! (eventually). I've had my eye on this feature for a while

  • that's why I recently refactored browsr to be more modular.

It wouldn't be NVIM - instead it's a textual https://github.com/textualize/textual/ (the underlying framework behind browsr) widget called TextArea https://textual.textualize.io/widget_gallery/#textarea.

It will improve the code viewing experience too as it supports things like text highlighting. It will even support (some) remote filesystems.

I'm specifically waiting on more languages to be supported by syntax highlighting for this (Textualize/textual#4160 https://github.com/Textualize/textual/pull/4160).

As far as the UX is concerned I was thinking about an E keyboard shortcut that launches you into editing mode in a new window. It'll probably be more similar to nano than vim - since that's what I know and I'd like it to be pretty simple.

— Reply to this email directly, view it on GitHub https://github.com/juftin/browsr/issues/42#issuecomment-1977475774, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6Z4V6QYN5UXCBIY5M3K7Y3YWTQQVAVCNFSM6AAAAABEF34MGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGQ3TKNZXGQ . You are receiving this because you authored the thread.Message ID: @.***>

juftin commented 4 months ago

Fair enough, but figuring out how to implement NVIM/EMACS inside a Python process run by textual will likely be prohibitively difficult. I typically have to work with existing "widgets" that are already in the textual ecosystem, like the built-in TextArea.

Invoking NVIM/EMACs via a shell plugin (https://github.com/juftin/browsr/issues/44) is probably a cleaner path for this.

dwilliam62 commented 4 months ago

Yeah this is what I was imagining. It would call $EDITOR and pass the filename Or via a settings option. I was not expecting you to do something within this framework.

On Mon, Mar 4, 2024 at 6:00 PM Justin Flannery @.***> wrote:

Fair enough, but figuring out how to implement NVIM/EMACS inside a Python process run by textual https://github.com/textualize/textual/ will likely be prohibitively difficult. I typically have to work with existing "widgets" that are already in the textual ecosystem, like the built-in TextArea.

Invoking NVIM/EMACs via a shell plugin (#44 https://github.com/juftin/browsr/issues/44) is probably a cleaner path for this.

— Reply to this email directly, view it on GitHub https://github.com/juftin/browsr/issues/42#issuecomment-1977617397, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6Z4V6R4MCTJYD32BYOEQNTYWT4JPAVCNFSM6AAAAABEF34MGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGYYTOMZZG4 . You are receiving this because you authored the thread.Message ID: @.***>

davep commented 4 months ago

Fair enough, but figuring out how to implement NVIM/EMACS inside a Python process run by textual will likely be prohibitively difficult.

@juftin Apologies for barging in, and perhaps I've misread this, but it should be pretty straightforward.

juftin commented 4 months ago

@juftin Apologies for barging in, and perhaps I've misread this, but it should be pretty straightforward.

Thank you Dave - no need to apologies! I love having your textual knowledge on stuff like this. I actually stumbled on the concept of suspending the context manager after looking into this - this is an awesome solution to this. Ideally I'd be able to do this with the TextArea widget though so editing files would be supported on both local and remote filesystems (like editing an S3 file). Whether it's used for editing files or not, there is also a need to be able to run a local terminal session alongside browsr - I'm initially more inclined to use something like textual-terminal like this though.

davep commented 4 months ago

Sure thing, I thought it worth a mention just in case. Should be useful for those who prefer $EDITOR support (and as I'm sure you know, most who would likely have their editor set to support remote editing, so that might be worth keeping in mind -- see tramp in Emacs as an example).