# \[ANN\] Announcing TerminalPager.jl

**URL:** <https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561>\
**Category:** Package Announcements\
**Created:** [April 18, 2021, 7:54pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561 "2021-04-18T19:54:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 7:54pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/1 "2021-04-18T19:54:13Z")

</div>

Hi!

After developing [PrettyTables.jl](https://github.com/ronisbr/PrettyTables.jl), I understood how hard is to design cropping mechanism to show large data into the terminal. We did have a “nice” algorithm, but with some caveats. For example, it is not that easy to crop the table in the middle of the columns. Thus, PrettyTables.jl always crop columns at the end.

Recently, there was a request on Slack (Jerry Ling) to add a way to break the table, printing the columns that does not fit sequentially. However, it would be very, very difficult to do due to corner cases.

That’s why I decided to make a small package trying to replicate the command `less`. This is 100% written in Julia and should work in all platforms (at least in terminals that support the standard escape sequences).

This new package is called [TerminalPager.jl](https://github.com/ronisbr/TerminalPager.jl) and should fix those problems letting the user to scroll through the table:

![Gravação de Tela 2021-04-18 às 16.28.364](https://global.discourse-cdn.com/julialang/original/3X/7/8/78f40d91fbf87c5e9b5da46b1522bea357f1764e.gif)

(The recording used the old name Less.jl)

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [April 18, 2021, 8:00pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/2 "2021-04-18T20:00:35Z")

</div>

Maybe TerminalPager.jl?

The Less.jl link isn’t working for me.

May I request respecting

- common keybindings of Vim and Emacs like `less` does
- the `LESS` environment variable
- the `.lesskey` configuration file

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 8:03pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/3 "2021-04-18T20:03:34Z")

</div>

Sorry, I updated the link.

Yes, I think we can go with TerminalPager.jl 🙂 it makes sense! Thanks for your suggestion.

Thanks also for the feature requests. Yes, my idea is to add features to match those in `less` (like search for example).

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [April 18, 2021, 8:07pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/4 "2021-04-18T20:07:20Z")

</div>

I would prefer Less, and using it as

```julia
using Less
df |> less

```

and of course it would be great as replacement for `@less` or perhaps usable as

```julia
@less sum(a) |> less

```

Now forgot to say: GREAT, i missed it for a long time. THANK YOU!

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 8:14pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/5 "2021-04-18T20:14:37Z")

</div>

Thanks! Let’s hope it can be useful for the community 🙂

The problem of using `less` as a function name is that `less` is already a function in Julia.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [April 18, 2021, 8:29pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/6 "2021-04-18T20:29:40Z")

</div>

Also, what `less` means is usually only clear to some Unix users. The others will find the name very confusing and hard to search

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 8:30pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/7 "2021-04-18T20:30:27Z")

</div>

Good point! I will rename to TerminalPager.jl and add a `TerminalPager.less` function 😃

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 8:43pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/8 "2021-04-18T20:43:03Z")

</div>

Done, everything is fine now. Thank everyone for the suggestions! The package should be merged in three days. If anyone wants to test it before, just do:

```julia
julia>]add https://github.com/ronisbr/TerminalPager.jl

julia> using TerminalPager

julia> rand(10,100) |> TerminalPager.less

```

P.S.: I tested in Windows 10. It seems to work but with terrible performance. However, it could be caused by the virtual machine I was using. Feedback is appreciated!

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [April 18, 2021, 8:47pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/9 "2021-04-18T20:47:44Z")

</div>

Maybe `pager()` instead of `TerminalPager.less()`

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 8:55pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/10 "2021-04-18T20:55:23Z")

</div>

I just add both for now 🙂

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [April 18, 2021, 8:55pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/11 "2021-04-18T20:55:27Z")

</div>

> less(file::AbstractString, [line::Integer])
> 
> Show a file using the default pager

Than let me set

```julia
TerminalPager.less

```

as the default pager 🙂

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [April 18, 2021, 9:24pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/12 "2021-04-18T21:24:05Z")

</div>

Wow this is great. Very often I find myself needing `View(df)` from R which pop’s up the Table in a GUI/cell format. This is a good replacement in Julia REPL. Could it be possible to add a GUI/HTML so it can also work like R’s `View(df)`?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 10:07pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/13 "2021-04-18T22:07:01Z")

</div>

> [@affans](#):
>
> Wow this is great. Very often I find myself needing `View(df)` from R which pop’s up the Table in a GUI/cell format. This is a good replacement in Julia REPL. Could it be possible to add a GUI/HTML so it can also work like R’s `View(df)` ?

Thanks! I think it is better to keep this package to terminal only. My plan is to add it as a dependency of PrettyTables.jl to help showing large data. Hence, if we add a lot of things, then the loading time can be bad. However, we can create another package, something like GraphicalPager / Viewer or something.

The problem is that for GUI you need to find a good toolkit that can easily work along all the platforms. This can be challenging and, unfortunately, I do not have much expertise (creating GUIs using Julia).

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [April 18, 2021, 10:18pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/14 "2021-04-18T22:18:12Z")

</div>

Gtk.jl works on some platforms.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [April 18, 2021, 10:24pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/15 "2021-04-18T22:24:48Z")

</div>

FloatingTableView.jl does exactly this! with `View` in mind. (Though the function is called `browse` like in Stata)

> **[GitHub - pdeffebach/FloatingTableView.jl: Easy table viewing in a pop-up...](https://github.com/pdeffebach/FloatingTableView.jl)**
>
> Easy table viewing in a pop-up window in Julia. Contribute to pdeffebach/FloatingTableView.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 10:30pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/16 "2021-04-18T22:30:15Z")

</div>

> [@pdeffebach](#):
>
> FloatingTableView.jl does exactly this! with `View` in mind. (Though the function is called `browse` like in Stata)

Nice! I did not know about this package, very good 🙂

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [April 18, 2021, 10:38pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/17 "2021-04-18T22:38:21Z")

</div>

An awesome use for this pacakge would be for long docstrings. I’ve often wanted `? pretty_table` or `? transform` to be in a scrollable thing that doesn’t clutter my REPL.

Ill see if I can work on something about that.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 10:42pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/18 "2021-04-18T22:42:53Z")

</div>

You can use it right now! It just a little cumbersome to call the documentation in the current state:

```julia
julia> Base.Docs.doc(pretty_table) |> TerminalPager.less

```

 ![Captura de Tela 2021-04-18 às 19.41.27](https://global.discourse-cdn.com/julialang/original/3X/1/f/1f72544010f6fbb70c83e3431b53bffa5de41730.jpeg)

P.S.: The ideia to use this together with the docs is just awesome! Thanks for pointing this out 🙂

EDIT: A more short version `@doc(pretty_table) |> TerminalPager.less`

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [April 18, 2021, 10:46pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/19 "2021-04-18T22:46:13Z")

</div>

Tried TerminalPager.jl in Julia 1.6.0 Win10 (REPL + VS Code terminal) and in Debian REPL in Android.

Performance is very good everywhere but cannot retrieve the advertised behaviors:

- Do not see the row numbers on the left of the terminal nor the column numbers at the top

- The SHIFT + left / right arrows seem to move only by 1 column, instead of 10 (while SHIFT + up/down do move by 5 rows OK)

Thanks for the great stuff!

_ **NB:** would much prefer using this nice functionality as part of PrettyTables.jl_

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 18, 2021, 10:49pm UTC](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561/20 "2021-04-18T22:49:40Z")

</div>

> [@rafael.guerra](#):
>
> Tried TerminalPager.jl in Julia 1.6.0 Win10 (REPL + VS Code terminal) and in Debian REPL in Android.
> 
> Performance is very good everywhere but cannot retrieve the advertised behaviors:

Nice! Good to know, I do not have any linux machine right now to test. Thanks for letting me know.

> [@rafael.guerra](#):
>
> - Do not see the row numbers on the left of the terminal nor the column numbers at the top

The pager does not add any content to the string. This information comes from DataFrames.

> [@rafael.guerra](#):
>
> The SHIFT + left / right arrows seem to move only by 1 column, instead of 10 (while SHIFT + up/down do move by 5 rows OK)

Hum, we will have a lot of problems with those key codes. This can be related to VS code terminal not passing the correct escape codes for some reason. Can you test in a terminal please?

> [@rafael.guerra](#):
>
> Thanks for the great stuff!

Thanks! Let’s hope it can be useful 🙂

> [@rafael.guerra](#):
>
> **NB:** would much prefer using this nice functionality as part of PrettyTables.jl

That’s the idea! Add this package as a dependency to PrettyTables and have an option `crop = :less` or something.

[Next page](https://discourse.julialang.org/t/ann-announcing-terminalpager-jl/59561.md?page=2)
