broot: MacOs: alt-enter doesn't work for everybody (define another combination?)

alt-enter on mac seems to do the same than enter.

If some people are able to test on Mac, please tell me and watch this issue so that I can let you test before official release.

Please people also check the version of broot you have is at least 0.11.3. I suspect some obsolete brew formula is still around.


Please note that you always can remap yourself to another key combination:

[[verbs]]
key = "ctrl-o"
execution = ":open_leave"

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 37 (11 by maintainers)

Commits related to this issue

Most upvoted comments

option + enter on MacOS Terminal and iTerm need to be set up by users to work properly. Setting it to output Esc+Enter worked for me on iTerm2.

image

In the default Terminal.app, enabling the “Use Option as Meta Key” works (for me).

Screen Shot 2020-01-14 at 2 09 14 PM

@NickyWeber A cd must be done on the parent shell, that’s why there’s the br function. Assuming you use br, you could use this parameterization:

[[verbs]]
key = "ctrl-f"
execution = "cd {directory}"
from_shell = true

On Windows (e.g. CMD using the WSL Ubuntu) the key combination <kbd>Alt</kbd>+<kbd>Enter</kbd> is used for entering Fullscreen…

Setting iTerm as follow does not require any change of configuration under broot:

  • remapping iTerm.app “Toogle Full Screen” from command-enter to “control-command-F” using System Preferences->Keyboard->ShortCuts->App Shortcuts
  • changing the hex code sent under iTerm Preferences->Profiles->Default->Keys and mapping ‘command-return’ to “Send Hex Codes: 0x1b 0x0d” (0x1b 0x0d if you using the cmd key as “alt”, if you want to use the “option” key, the code needs to be 0x1b 0x0a)

@Etheryte I think the Homebrew version is 0.10.3, it seems that there have been versions released that fix the alt-enter

ideally, it would be possible to map another combination for doing what alt+enter does.

You can map another combination. The verb is :open_leave (the counterpart is :open_stay):

[[verbs]]
key = "ctrl-o"
execution = ":open_leave"

option + enter on MacOS Terminal and iTerm need to be set up by users to work properly. Setting it to output Esc+Enter worked for me on iTerm2.

image

This is a good workaround, but only as long as you don’t need to use the option key to type “special” characters such as é, ñ, ü, or etc. I’m afraid that makes it a bit of a deal-breaker for me; I’m going to look into using Karabiner-Elements to remap just option+enter and nothing else, and only in the terminal, but that is a pretty invasive/complex workaround — ideally, it would be possible to map another combination for doing what alt+enter does.

Update:

I didn’t need to go as far as using Karabiner-Elements. I was able to keep the ability to type é etc with this config:

Screenshot 2020-05-29 -152302-5SqAJrbH@2x

It is difficult to support all key codes all systems and all terminals. This isn’t quite universal. And there are a lot of edge cases. An ANSI code parsing layer is in the making. The plan is that Crossterm will use this library for parsing input events. Please have a look over at https://github.com/crossterm-rs/crossterm/pull/330. You might even want to test with this branch for broot.

Looks like the key events are coming from the crossterm lib.

We might need to hook into and log e.g., the could_not_parse_event_errors being raised in https://github.com/crossterm-rs/crossterm/blob/71029c4a8719ce08a2fa487d9403610ec48acf42/src/event/sys/unix/parse.rs to capture the exact bytes that e.g., iTerm2 is sending.

That lib might also end up needing some code specifically for OSX and/or iTerm. Right now it doesn’t look any OSX terminals are part of their test suite.

In the mean time, we can work around by setting ESC+ per https://github.com/Canop/broot/issues/86#issuecomment-572641935

@okomarov @Canop I’m using Alacritty there it works (cds into the directory and exits), I can confirm it doesn’t work in iTerm (does the same as plain enter)