TerminalPager.jl v0.6.5 adds an inline help viewer to the REPL, activated by hitting <alt>+<h>. Hitting <q> brings you back to the line where you were.
Credit
@Ronis_BR is the author of the TerminalPager.jl package. As we both collaborated on this new feature and we think it will be useful for many (if not most) REPL users, we agreed that I’ll write an announcement.
Motivation
While Julia’s help mode is very useful, in my opinion it has two usability problems:
If you find you need help after you started typing, you need to
jump back to the beginning of the line with <home>
hit <?>
hit <enter>
get your input back with <arrow up>
jump back again to the beginning of the line with <home>
remove the ? with <delete>
hit <end> to return to the end of the line
finally continue where you left off
This gets even more complicated if the function you need help with is in the middle of a complex expression.
It clutters the REPL output. While sometimes it is useful to see the help output permanently while typing the current line, this is often only needed because getting help again is tedious (see above). And even then you only see the last part of the help output, although the call syntax is most often what you need when typing a new command. Quite often it is at least as useful to see the output of the previous commands without needing to scroll there.
The new inline help mode of TerminalPager.jl solves both of these issues.
Usage
Load the package with using TerminalPager (and install it if necessary). I also recommend adding it to your startup file.
The following is a quick tutorial for users which are not familiar with the workings of a pager. You do not need all this functionality to use the help mode, but it might be nice to learn some useful shortcuts. You can follow along with this example in your REPL.
startswith( – which argument came first, was it the start or the whole string?
<alt> + <h> – help: read the documentation
<q> – quit: Back at the normal REPL containing startswith(
startswith("1 haystack", – continuing the input, but can the second argument be a regular expression?
<alt> + <h> – help: read the documentation
/Regex – search for “Regex” and jump there
<j> (repeatedly) – scroll down (and possibly up again with <k>) to look at the documentation of the correct method
<q> – quit: Back at the normal REPL containing startswith("1 haystack",
If maintainers wish to have this included into the REPL, we can work towards this goal. However, my current feeling is, at least for the moment, that this is more a package topic.
That being said, the main feature which is currently missing in Base for such a help functionality is the pager.
I also currently lack a Windows test environment where I could reproduce this. Do the regular <alt> sequences work in your setup like <alt> + <b> or <alt> + <f> to move a word forward or backward?
Could you change your terminal, i.e. use cmd, PowerShell, WSL or VS Code’s terminal?
Probably a dumb question, but could it be that Pkg hasn’t updated TerminalPager.jl to v0.6.5 or v0.6.6 due to some compatibility constraints? That would explain why the pager works, but not the inline help.
I have freshly installed TerminalPager.jl v0.6.6 under Julia v1.12.0 on a M4 Mac 15.7.1 (the same however on an old macOS on Intel Mac), Julia running in Terminal, or in VSCode.
The behavior is similar to reported by Jake above: <alt> + <h> produces ª (superscript a), <alt> + <Shift> + <h> produces Ó, F1 has no visible effect. | (the pipe symbol) gives the pager prompt, @help startswith works.
Can you please also check whether <alt> + <b> and <alt> + <f> work for you to move a word backward and forward?
If these do not work correctly, I think you need to configure your terminal to send escape sequences instead of Unicode characters. I am not a Mac user, but this is what Claude says:
Terminal.app: Enable “Use Option as Meta key” in Preferences → Profiles → Keyboard
iTerm2: Set Left Option Key to “Esc+” in Preferences → Profiles → Keys
This is great! Any chance you’ll make shift+F1 work like alt+shift+h, to provide a way to access the extended help for those of us who can’t use the alt-based shortcuts for whatever reason?