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

Suggestion: use left and right for jumping into / out of directories as default #179

Closed
joepio opened this issue Jan 24, 2020 · 15 comments
Closed

Comments

@joepio
Copy link

joepio commented Jan 24, 2020

First of al, thanks for sharing this tool! I like it a lot.

Currently, both the bottom key, the left key and the right key move "down", to the next item. I'd suggest to use the left/right arrow keys for jumping out/into directories. This makes sense both visually (since children are on the right, parents on the left) and functionally (moving vertically is very common). I also think it's more intuitive than using the p key, and it matches with UX patterns in most other existing filesystem navigation apps.

Someone has suggested allowing this before, but it's not a default setting. I suggest using it as a default.

@Canop
Copy link
Owner

Canop commented Jan 24, 2020

I'll add those bindings, commented, to the config, but I won't activate them by default.

The rationale is:

  • key power users won't find it hard to uncomment this part in the config
  • normal human beings would be disturbed by not being able to move the cursor with arrow keys in the input

@joepio
Copy link
Author

joepio commented Jan 27, 2020

Fair point!

How about this: if there is no user input, use the left / right arrow keys for directory jumping. Currently, left and right both navigate down.

I often use broot not just for searching, but for folder navigation, too.

@Canop
Copy link
Owner

Canop commented Jan 27, 2020

Currently, left and right both navigate down.

What do you mean ? This looks like a bug but I don't reproduce it.

@joepio
Copy link
Author

joepio commented Jan 27, 2020

It's a bit different, it does not go down per say, but it seems to replicate the last movement:

  1. Open broot
  2. Press down
  3. Press left / right => it moves down

And the other direction:

  1. Open broot
  2. Press down x 3
  3. Press up
  4. Press left / right => it moves up

@Canop
Copy link
Owner

Canop commented Jan 27, 2020

This is a bug. It looks like #168
Can you follow the mentioned procedure to see what event is received by broot (and tell what's your OS and console application) ?

@joepio
Copy link
Author

joepio commented Jan 27, 2020

Sure, but where can I find dev.log?

@Canop
Copy link
Owner

Canop commented Jan 27, 2020

Assuming you started broot with BROOT_LOG=debug broot the log file should be in your work dir.

Maybe come to the chat ? https://miaou.dystroy.org/3

@joepio
Copy link
Author

joepio commented Jan 27, 2020

The left / right behavior disappeared when I updated broot!

@Canop
Copy link
Owner

Canop commented Mar 24, 2020

@joepio I'd like your validation on this one

@joepio
Copy link
Author

joepio commented Mar 25, 2020

Thanks for the addition, @Canop !

It's working pretty well, except for when the top item is selected. As a user, I expect the left arrow to navigate to parent, but if I press left on the top item, I close the app. That means that I can't open br and quickly navigate to some parent folder.

When I press right when standing on the top item, I navigate to the parent. When I press left after that, I move to the child again. This is exactly the opposite of what I expected: right = go to child, left = go to parent.

I think this is the issue: left seems to map to back, but I think it should map to parent.

@Canop
Copy link
Owner

Canop commented Mar 25, 2020

I tried mapping it to parent, the behavior is too inconsistent with what you'd expect, especially as right-left isn't a nil operation (in broot there's both a current selection and a current root).

What could be done is to prevent the left (or maybe the back, this is often discussed) to close the app.

@joepio
Copy link
Author

joepio commented Mar 25, 2020

But that would still result in the confusing right = go to parent behavior when the top item is selected, right?

@Canop
Copy link
Owner

Canop commented Mar 25, 2020

Right. This could be prevented too but that would make the right arrow a nil operation when the input is empty and the root is selected. That doesn't really feel better.

@runiq
Copy link

runiq commented Jun 4, 2021

How about adding a child item, just like there is a parent item? That way we could add bindings for that by ourselves.

My usecase is that, once I've selected a file with broot, a lot of the time I want to move to an intermediate directory somewhere between my starting directory and the exact directory the file is in.

For example:

  1. Imagine I am in ~, and I want to edit ~/dotfiles/neovim/lua/my/configs/lsp.lua.
  2. I type dot neo lsp and broot selects the correct file for me.
  3. Now, before I edit the file, I'd still like to switch my working directory to ~/dotfiles/neovim/lua, because that's where all the other relevant files will be.
  4. I use the focus {child} command a few times to move through dotfiles, neovim, lua.
  5. I :edit the file.

That would be awesome. :)

@Canop
Copy link
Owner

Canop commented Jun 4, 2021

@runiq I'm sorry I'm lost here. Could you come to the chat to help me understand your need ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants