helix icon indicating copy to clipboard operation
helix copied to clipboard

Add file picker dialogue when opening a directory with :o

Open weakphish opened this issue 3 years ago • 7 comments

This pull requests closes #2558.

The behavior of :o is modified such that when opening a directory, the file picker pane is opened on the chosen directory rather than returning an error.

Jun-08-2022 02-36-03

weakphish avatar Jun 08 '22 03:06 weakphish

The behavior with opening multiple directories might need a bit of tuning. :open .git .github pushes a picker for .git and then .github, so pickers end up in reverse order. It could also make sense to fail the command when more than one path is a directory, although I kinda like the multiple pickers. What do others think about the behavior?

the-mikedavis avatar Jun 08 '22 13:06 the-mikedavis

The behavior with opening multiple directories might need a bit of tuning. :open .git .github pushes a picker for .git and then .github, so pickers end up in reverse order. It could also make sense to fail the command when more than one path is a directory, although I kinda like the multiple pickers. What do others think about the behavior?

I think if I can reverse the order of the picker appearance, it's solid. I agree that multiple pickers is a good thing to have, generally.

weakphish avatar Jun 08 '22 22:06 weakphish

Would it make sense to display the name of the directory e.g. in the status line when you have the picker open? Just to make it a bit more visually obvious which directory you are looking at.

zen3ger avatar Jun 14 '22 12:06 zen3ger

I suppose it can be displayed in the command line area with editor.set_status().

sudormrfbin avatar Jun 21 '22 08:06 sudormrfbin

I don't know if there's a way to use editor.set_status due to the constraints on the function. The closest I can get is something like this: Screen Shot 2022-07-31 at 19 28 18

which I am not sure how to go about resolving @sudormrfbin @zen3ger

weakphish avatar Jul 31 '22 23:07 weakphish

I'm not sure this is a good idea allocation-wise but set_status can take a String so you can use path.to_string_lossy().to_string()

the-mikedavis avatar Aug 01 '22 20:08 the-mikedavis

It looks like the cx.editor.set_status statuses overwrite each other when there are multiple directories in a row. Maybe we could have the file picker write a status message when it opens saying something like "Picking files from {dir}"?

the-mikedavis avatar Aug 08 '22 23:08 the-mikedavis

@the-mikedavis If I am understanding you correctly, it seems that there is a lot of constraints on the callback that make this difficult. Did your suggestion mean implementing the status change as part of the callback, or is there a piece I'm missing?

Thanks for the help :)

weakphish avatar Oct 11 '22 02:10 weakphish

Hmm yeah I think it's not possible currently or easy to change to have one callback create the next like I'm thinking. I think it's probably fine to ignore set_statusing for the pickers for now and we can revisit it later / leave it as a TODO

the-mikedavis avatar Oct 11 '22 23:10 the-mikedavis

This seems fine to me after the set_status is removed. :+1:

dead10ck avatar Dec 22 '22 21:12 dead10ck

I removed the editor.set_status call.

weakphish avatar Dec 22 '22 21:12 weakphish