[ANN] TerminalPager.jl v0.5.0

Hi everyone!

I am releasing today TerminalPager.jl v0.5 with some nice new features (and some breaking changes :D).

Visual Mode

We now have a visual mode (type v), where you can see a vertical visual line to scroll through the data. You can also mark lines (type m). This feature helps when analyzing very big tables and you want to have a visual mark.

asciicast

It is also possible to copy (type y) the selected lines which is helpful, for example, to copy and paste examples in the documentation.

asciicast

Alternate Screen Buffer

The pager now supports using the terminal alternate screen buffer (Thanks @digital_carver!). Hence, when opening a help doctoring, for example, your current output will not be modified after you exit the pager.

asciicast

Customization

All the customization is now handled by Preferences.jl and persists between sections. Hence, if you want to change the active visual line color, you can do:

julia> TerminalPager.set_preference!("visual_mode_active_line_background", "45")

For more information, see the documentation of the function pager.

50 Likes

This is great! I use it almost everyday :slight_smile:

2 Likes

Awesome :slight_smile: I am glad it is being useful. Let me know if I broke something :smiley:

2 Likes

The new features are all amazing! I use TerminalPager.jl everyday, it is an essential part of my workflow, alongside OhMyREPL.

Thank you for making it!

2 Likes

Awesome! Thank you very much for the feedback :slight_smile:

1 Like

Just added this to my startup, it’s really cool thank you!

One question: what key do you use to go into pager mode? I can’t find any reference to it in the docs.

2 Likes

Oops, I will add :slight_smile: but it is pipe |.

2 Likes

wow, cool package! I was just looking for something like this the other day.
I just tried out v0.5 and after realizing I should set "always_use_alternate_screen_buffer_in_repl_mode" to true, I am very happy using it to inspect NetCDF datasets!.

A few suggestions:

  • Make it clear what the preference keys are, their defaults and their impacts (I had to look at the TerminalPager.pager function docs to find the preferences, and then look at TerminalPager.set_preference! to figure out how to set them. It would be useful to new users like myself if this was a separate doc page!
  • Add a doc page for keybindings. I see there’s function docs for set_keybinding, but it’s not clear to me which keybindings are available by default, and what all the available actions actually mean!
  • To me (and I suspect most other users), this is a package that would live in my (@v1.9) environment, and added to startup.jl so that it’s accessible in every other environment I work in. I would suggest basically adding this (Installation · OhMyREPL) to your docs, with the caveat that on newer versions on julia it should be sufficient with simply using TerminalPager in startup.jl.
2 Likes

Thanks @haakon !

  • Make it clear what the preference keys are, their defaults and their impacts (I had to look at the TerminalPager.pager function docs to find the preferences, and then look at TerminalPager.set_preference! to figure out how to set them. It would be useful to new users like myself if this was a separate doc page!

Yes, I fully agree that we need better documentation :slight_smile: Thanks for the suggestions.

  • Add a doc page for keybindings. I see there’s function docs for set_keybinding, but it’s not clear to me which keybindings are available by default, and what all the available actions actually mean!

Ok! In the mean time, you can press ? in the pager to show all the available keybindings.

  • To me (and I suspect most other users), this is a package that would live in my (@v1.9)environment, and added to startup.jl so that it’s accessible in every other environment I work in. I would suggest basically adding this (Installation · OhMyREPL ) to your docs, with the caveat that on newer versions on julia it should be sufficient with simply using TerminalPagerin startup.jl.

Perfect! Thanks!

I’ve just discovered this amazing package today. Thank you for this glorious work and for PrettyTables :heart:.

Do you have any plan to add a function to mark (like select_visual_line) all lines highlited by a search ?

That would be really useful in a scenario where you search & mark all resulting lines multiple times and then copy everything in the clipboard.

And the icing on the cake, to add a way to change the “format” of the rows/line in the clipboard (to paste it as markdown table or as a “tsv” table if you need to put those lines as is in a spreadsheet editor) ?

I’ve just discovered this amazing package today. Thank you for this glorious work and for PrettyTables :heart:.

Thanks!!

Do you have any plan to add a function to mark (like select_visual_line) all lines highlited by a search ?

I have never thought about it, but it seems a very nice feature! This feature is very easy to implement, we just need to think about the keybindings. For example, you perform a search. What would you type to mark all the lines with one or more matches?

And the icing on the cake, to add a way to change the “format” of the rows/line in the clipboard (to paste it as markdown table or as a “tsv” table if you need to put those lines as is in a spreadsheet editor) ?

This feature would be almost impossible. Since we are only copying text, and it can be anything, I have no idea how to implement something that will do this kind of conversion. Maybe this should be implemented in an external package that TerminalPager.jl can use as extension later on.

What would you type to mark all the lines with one or more matches?

Maybe a capital L to mark all the Lines?

And it’s also matching the key binding of the VS Code command :
select all occurrences of current selection : Ctrl/Command + Shift + L