stevearc / oil.nvim

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

feature request: add a 'show absolute path' toggle (and allow edits) #289

Open Danielkonge opened 8 months ago

Danielkonge commented 8 months ago

Did you check existing requests?

Describe the feature

This feature request might have some overlap with #117, but I think the idea is a bit different and possibly(?) easier to implement (+ it feels more intuitive to me).

I would like to add a a command that allows you to toggle between the current file/directory names for paths in oil and the full absolute paths (+ maybe also a path relative to cwd if inside it).

When showing absolute paths I would then like to be able to edit the paths as usual (in absolute form) and get the "expected" behavior (see below).

Provide background

I would like to be able to have something like the following setup.

Say I have directories /some/path/dir1 /some/path/dir2 with a file filename inside dir1. In oil that would currently have the name filename when I am inside dir1, and I would like to be able to show its absolute path: /some/path/dir1/filename And if I then make an edit, say change it to /some/path/dir2/filename, I would like to be able to save and have the file move from dir1 to dir2.

I hope that this would not be too difficult to implement, since it would be a change in the absolute path, which should hopefully translate to a straightforward move command.

What is the significance of this feature?

strongly desired

Additional details

If you have any idea of where to start with an implementation of my suggestion, then I can spend some time on it and try to make a pull request.

stevearc commented 8 months ago

This would be difficult for the same reasons as #117. Right now there is exactly one way to move files to another location, and there is exactly one way to represent a file in a location. Once you introduce something like this, there are now multiple ways to move a file and there are multiple ways to represent a file at a location. It's not insurmountable, but it would be quite tricky to account for all the possible edge cases.

Danielkonge commented 8 months ago

If I would like to try to implement this, would you be fine with having a seperation between the two ways of moving files and representing files through a check for whether the path has a root or not? E.g. in a Unix system, assume that anything starting with / is an absolute path and anything else is of the form currently used in oil. (I think roots are a bit weirder in Windows, but they still exist.)

Or would that break something in oil?

Edit: Actually, making a absolute-path-mode might be easier. Then oil could have a clear distinction between standard-mode and absolute-path-mode, and it would always be clear which representation and move commands to use depending on the mode.

agus-videla commented 8 months ago

Just bumping to say I would really like this feature also!

simanga-dev commented 5 months ago

I am searching for a similar feature that allows me to display the parent folder at the top, similar to how neo-tree does it.