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

Feature: Expand, modify, and create nested directories #26

Open elihunter173 opened 2 years ago

elihunter173 commented 2 years ago

This is closely related to #3 but slightly different.

Sometimes I would like to be able to use Dirbuf to easily move a bunch of files from a subdirectory to my current directory. Ideally I'd like to do this by just expanding the subdirectory within my current dirbuf, deleting the leading path, and saving to move all the files I changed into my current directory.

I want it to feel like folding, where you're just "unfolding" a directory to expand it and folding it to close it. I want to be able to expand a directory, move some files to my current directory, and close the directory and have all the files I didn't move get hidden again and all the files I moved to stay. Ideally it should just work how you think it does.

For a concrete example in pseudo-dirbuf, consider you're in a directory containing only the directory foo/ which itself contains bar and baz. You open the directory and see

#1 foo/

You "unfold" foo/ and see

#1 foo/
#2 foo/bar
#3 foo/baz

Then you make the following edit

#1 foo/
#2 bar
#3 foo/baz

Then you close foo to get

#1 foo/
#2 bar

Upon saving, this should result in the syncing plan being mv 'foo/bar' 'bar'.

Open Questions

lucastrvsn commented 2 years ago

First of all, thank you so much for this plugin. It's the best plugin for file navigation I've ever use (I was using dirvish for years and now your plugin is just so much better, omg I love it)

One thing I miss from Dirvish is creating multiple files at once, I think would be cool to have this feature as well. I don't know if here is the best place to suggest this, but I think its related.

index.js
ResponsiveImage.{js,test.js}

When :w this, would create the following files:

#00000001   index.js
#00000002   ResponsiveImage.js
#00000003   ResponsiveImage.test.js

or something like:

ResponsiveImage/index.js
ResponsiveImage/ResponsiveImage.{js,test.js}

:w

#00000001   ResponsiveImage/index.js
#00000002   ResponsiveImage/ResponsiveImage.js
#00000003   ResponsiveImage/ResponsiveImage.test.js

Let me know if it's better to suggest this on a separated issue instead of here. Thank you so much again!

elihunter173 commented 2 years ago

Let me know if it's better to suggest this on a separated issue instead of here. Thank you so much again!

Could you open a separate issue? I think this is a super interesting idea!

dagadbm commented 1 year ago

now also with nvim column you can also have some nice folds in the left to really explain you are expanding inside a directory

textzenith commented 1 year ago

You "unfold" foo/ and see

1 foo/

2 foo/bar

3 foo/baz

Yes, it should be so simple to do — though I like the option of using indents rather than reiterating the parent folder.