Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open the File Picker in the folder of the active buffer #1352

Closed

Conversation

bbodi
Copy link
Contributor

@bbodi bbodi commented Dec 24, 2021

In Programming languages with deeply nested directory hierarchies (e.g. Java or TypeScript in an Angular Project), files in the same folder/package level often needs to be easily accessed or explored.
The deep level of directory hierarchies and the long file names these projects usually use make it difficult to find those files via the default File Picker.

In IntelliJ, one can press alt+home to get a navigatable dialog widget to explore/access the files in the currently editing file's folder.
image

A similar functionality could be achieved if there was a way to open the File Picker from the active file's folder.

@@ -648,6 +648,7 @@ impl Default for Keymaps {

"space" => { "Space"
"f" => file_picker,
"F" => file_picker_in_directory_of_active_buffer,
Copy link
Contributor

@pickfire pickfire Dec 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's space f F in doom emacs I guess that's pretty similar to this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it a suggestion or you just mentioned it? I would not sacrifice the current space f shortcut as a prefix, it is too common.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@bbodi bbodi Dec 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I maybe modify the PR to contain only the command implementation without the default key bindings, so the feature can be merged and used with custom configuration while the conversation about the keybindings is going?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can easily fill up the keybindings and later we will have to do like what doom emacs did, more like current space w which requires only an extra key, I think doing this earlier allows us to reduce breaking changes later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that space f should be kept as is. I don't think we need space f F, space F is enough.

Copy link
Contributor

@pickfire pickfire Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need space f F, space F is enough.

Yes, for now it's fine. But later when we have as much space f * like in doom emacs we might have to reconsider this. Doom emacs space mappings is quite well done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm not sure whether we will add all of those, helix isn't doom emacs. Emacs often relies on longer key sequences (SPC h d h etc), but we don't

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't actually find any documentation on SPC f https://github.com/hlissner/doom-emacs/search?p=1&q=spc+f

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to throw some new info out there I've raised a PR related to a similar picker command file_picker_at_cwd which opens the file picker at the current working directory: #1600

If that PR ends up being merged there would be 3 different file picker related commands including the file_picker_in_directory_of_active_buffer being discussed in this PR.

Does this new info impact your thoughts about the keymapping of commands and whether or not it would be appropriate to add a submenu to group the "picker" related commands?

@@ -270,6 +270,7 @@ impl MappableCommand {
append_mode, "Insert after selection (append)",
command_mode, "Enter command mode",
file_picker, "Open file picker",
file_picker_in_directory_of_active_buffer, "Open file picker in the directory of the active buffer",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if the description was shorter so that the infobox wouldn't be too big.

Copy link
Member

@archseer archseer Jan 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the command name, maybe file_picker_in_current_buffer_dir?

helix-term/src/commands.rs Outdated Show resolved Hide resolved
@archseer
Copy link
Member

archseer commented Jan 3, 2022

Sorry, looks like there's an error because find_root was changed in master

@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 18, 2022
@pickfire
Copy link
Contributor

pickfire commented Jun 8, 2022

Does #2412 solve your need? It opens a different type of file picker (non-recursive) but on the directory where the file is on.

@bbodi
Copy link
Contributor Author

bbodi commented Jun 8, 2022

Does #2412 solve your need? It opens a different type of file picker (non-recursive) but on the directory where the file is on.

Yes, thanks!

@pickfire
Copy link
Contributor

pickfire commented Jul 7, 2022

This is superseded by #2412, but I haven't got to find the time to clean it up or figure out the UX for directory preview yet.

@pickfire pickfire closed this Jul 7, 2022
@sudormrfbin sudormrfbin mentioned this pull request Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants