-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pager support in the repl #6921
Comments
Hello all. A pager would be useful, especially for viewing lengthy documentation. I'd like to work on this issue if no one else is. Any tips on where to start? |
This is probably a bit naive (still learning Julia), but I had a similar need and asking around in Slack and wrapped up the advice I got into a function like this function pager(text)
run(pipeline(`echo $text`,`less`))
end Try this example (notice that markdown doesn't get parsed though). Seems to work ok, although I am sure it can be improved. julia> pager(@doc print) |
Thanks @quipa, that's quite useful. I modified it to:
which gives better output of data - Arrays, Dicts, etc. are displayed as usually done in the REPL, instead of a single-line long chain of values, and markdown output works too. (The markdown output includes an extra line at the end like
(PS: my actual |
My version:
|
Interpolating a string as the argument(s) to more(content) = more(repr("text/plain", content))
function more(text::AbstractString)
open(`less`, "w", stdout) do io
print(io, text)
end
end |
The best way to get this feature today is to use the TerminalPager package. Once loaded in your startup.jl (or in a Startup package loaded from there), it provides a (So perhaps this issue changes to the question of whether that package should be integrated into the |
Today I learned about pager mode in TerminalPager. Great!
|
I often find myself wishing for a pager in the repl when outputting large amount of output. I see that there is a
Base.less
but it is only used on files and not for outputting other stuff in the repl. In fact, it would be great to have support forless
,head
, andtail
like functionality for looking at arrays, hashes, etc. Thus to be able to do, e.g.,arr |> less
orless(arr)
orarr |> tail
.In addition, I think having the output of show() automatically go through
less
if it is longer that one page would be great. I hate seeing 100's of pages of output fly by when, e.g., a huge hash gets "shown" at the prompt (I just cannot seem to get in the habit of typing the;
at the right time). This behavior could be configurable of course.NOTE: see also https://groups.google.com/forum/#!topic/julia-users/2SbdNdW_EEM
The text was updated successfully, but these errors were encountered: