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

add options to allow more GUI-like keybindings #39

Closed
wants to merge 2 commits into from

Conversation

maznu
Copy link

@maznu maznu commented Jul 16, 2022

My muscle memory of 1990s and 2000s GUIs has taught me that Enter is "OK" and Esc is the "cancel" action. This PR proposes two command-line options:

  • --esc-is-cancel will change the Esc keybinding to exit with error; and remaps the Enter keybinding to do what Esc used to; therefore you use arrow keys to navigate, and Enter to accept the current directory
  • --enter-is-cd-and-exit will change the Enter keybinding to go into the selected directory (same as pressing the would do) but then immediately exit with success

And that's it!

@bfiics
Copy link

bfiics commented Jul 17, 2022

I kinda like to navigate with keys, nice one

@mgunyho mgunyho mentioned this pull request Jul 21, 2022
@mgunyho
Copy link
Owner

mgunyho commented Jul 21, 2022

Thanks for the PR! I like the idea of "cd and then exit", and alt-enter seems like a good default keyboard shortcut for that. However, the --enter-is-cd-and-exit and --esc-is-cancel options seem a bit specific. I would rather add options for full keyboard customization, and then these may be configured as desired.

@mgunyho mgunyho mentioned this pull request Sep 6, 2022
3 tasks
@mgunyho
Copy link
Owner

mgunyho commented Sep 10, 2022

I have now implemeted custom keyboard mappings in #57, which will be released soon. With this, you can add

--map Enter:ChangeDirAndExit,Esc:NotSearching:ExitWithoutCd

to your shell config, which will map Enter to "change to folder under cursor and exit with success" and Esc to "exit with error".

The default keyboard mapping for "cd and exit" is Alt-Enter or Ctrl-Space. I chose these because to me Alt-Enter feels consistent with the rest of the shortcuts, but it's sometimes used for other mappings (e.g. to make a window full screen), so Ctrl-Space is an alternative that I think is okay.

@mgunyho mgunyho closed this Sep 10, 2022
mgunyho added a commit that referenced this pull request Sep 11, 2022
The biggest new feature is the possibility to map custom keyboard shortcuts, using a syntax like `--map key-combination:action`.

Other improvements:

- Add keyboard mapping to select the folder under the cursor and exit immediately. The default keyboard shortcuts are `Alt-Enter` and `Ctrl-Space`. (Github #39)
- Fix exiting with `ctrl-c` with `--mouse=on` (Github #45)
- Update dependencies
- Lots of small updates to readme
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

Successfully merging this pull request may close these issues.

3 participants