Closed maznu closed 2 years ago
I kinda like to navigate with keys, nice one
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.
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.
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 successAnd that's it!