elihunter173 / dirbuf.nvim

A file manager for Neovim which lets you edit your filesystem like you edit text
GNU Affero General Public License v3.0
423 stars 7 forks source link

UX improvement: Display hashes as virtual text #6

Closed andrewferrier closed 2 years ago

andrewferrier commented 2 years ago

As I understand it, the hashes in a dirbuf buffer are not really ever intended to be edited by a user. As such, I think it would be really to include them as virtual text only (similar to how diagnostics are displayed by NeoVim). This would make editing filenames much easier (A and $ go to the end of the filenames themselves, for example). Also means that users cannot accidentally edit the hashes.

Just a thought...

elihunter173 commented 2 years ago

You're correct you're never supposed to touch the hashes.

Virtual text is actually how I initially envisioned Dirbuf working and how a very early version of it worked before it even had a git history. Sadly though, virtual text just doesn't work for this use case. Virtual text works with extmarks which can't be copied or deleted by modifying text. So, if Dirbuf used virtual text, when you copy a line the hash wouldn't get copied, meaning we can't keep track of the changes, and when you delete a line the hash would fall onto the previous line, which just causes chaos with multiple hashes per line.

I'll play around with adding a :help conceal recipe to conceal the hash which might make the hash harder to edit, but in the meantime I'm going to close this issue since it's not actionable.

andrewferrier commented 2 years ago

Ah, OK, fair enough. Obviously I didn't know enough about how virtual text behaves in practice; sounds like you've done a lot more thinking about that than me.

Agree that the conceal would be nice though.

Thanks again; great plugin!