[ANN] TerminalPager.jl: REPL inline help added

Thanks for this idea. I like it and I think this should be simple to implement. However, we might even have the extended help on <F1> if there are no reasons against it.

In Terminal.app changed settings as suggested, now <alt> + <h> works.

Just: On my German keyboard I need the <alt> modifier to type such important characters as @ [ { ] }, now it was impossible :frowning:

Also, actually I use VSCode, like probably the majority of Julia users.

Good that we found that it is no inherent technical problem of TerminalPager.jl, although I understand that the cure is probably worse than the disease for you.

Maybe other Mac users can jump in. On a German keyboard you would typically press <Alt Gr> to access the characters you listed. I don’t know whether this is the same on a Mac.

Alternatively, maybe you can selectively bind some key combinations? Claude again:

Solution 1: Selective Meta Key Configuration

Instead of enabling “Use Option as Meta key” globally, you can:
Go to Terminal.app → Preferences → Profiles → Keyboard
Look for individual key mappings
Configure only specific Option+key combinations as Meta keys
Leave the ones you need for special characters (like Option+L for @, Option+8 for [, etc.) unconfigured

Solution 2: Create Custom Key Mappings

In Terminal.app Preferences → Profiles → Keyboard:
Click the “+” button to add new key mappings
For each special character, create a mapping:
Key: Option + the key you want to use
Action: “Send Text”
Text: The actual character (e.g., @, [, {, etc.)

On Mac, the left and right <alt> are equivalent.

I can try selective mappings, but probably not today.

Do you have any ideas for VSCode users?

Having effectively no <alt gr> key seems to be a serious limitation for a German user, which is probably unacceptable for most German Mac power users. So there are probably solutions for this problem and I hope that other Mac users jump in to help.

What I would try:

  • VSCode allows using an external terminal (the first option in settingsFeaturesTerminal. I don’t know whether that helps with key bindings, but it’s probably worth a try.
  • Claude pointed towards Karabiner-Elements which seems to be able to do fancy keyboard stuff on a Mac

I consider myself a power Mac user (at least, I used quite a lot of different programs on Mac over the last 30 years). This was the first time I got issues because of not having <alt gr>.

Concerning using an external terminal with VSCode: The built-in one is tighty integrated, which I’d probably lose with external one. Or how is it? Anyway, for me personally it is likely not worth the trouble.

Sorry, my post was misleading. I meant Mac power users on the terminal, as there <alt> is important for a lot of readline shortcuts, see e.g for the Fish shell. On the other hand, missing <alt gr> as a German user would also be a serious drawback. That’s why I really think there are solutions to this problem (as they are different keys, they send different key codes, so an application probably can distinguish them if needed).

The external terminal is still included in VSCode. You do not necessarily see a huge difference, it’s just a different terminal emulator. I use my preferred terminal emulator as an “external” terminal. I never missed the VSCode one.

I agree, that this sounds like too much trouble for something which should be simple. But we can define whatever shortcut we want. So what would be a good default key combination for a Mac user to access help?

In the long run, we should make the shortcut user-configurable anyway. @Ronis_BR already put the infrastructure into place in TerminalPager.jl for pager shortcuts, so I hope we can build on this for the help shortcut.

Many terminals on macOS allow you to remap one option key as alt (most commonly the left one I think) and keep the other one as option, which sounds like a fairly decent compromise. Looks like the built-in Terminal.app doesn’t have this, but popular ones like iTerm2 and Ghostty do. No idea about the VSCode one.

I guess the reason would be that you might want to provide access to both the regular and extended help without using the alt shortcuts (not to go full xkcd 1172, but I currently use alt(+shift)+{h,j,k,l} for window navigation/management, which is why I’m currently not able to use alt(+shift)+h in the REPL).

Yes, understood, with this proposal both <F1> and <alt> + <h> (and maybe more to cover Mac users) would be extended help. We could not identify any relevant benefits in the linked issue above to provide the regular help when using a pager.

1 Like

You can also press escape and then h in the REPL (the way it used to be in the beginning).

I rather keep the option modifier for Unicode input and use the escape key for, well, escape sequences.

2 Likes

Yes that works, and that’s all I need!

1 Like