Library
Documentation for TerminalPager.jl
.
TerminalPager.Keystroke
— Typestruct Keystorke
Structure that defines a keystroke.
Fields
raw::String
: Raw keystroke code converted to string.value::String
: String representing the keystroke.alt::Bool
:true
if ALT key was pressed (only valid ifvalue != :char
).ctrl::Bool
:true
if CTRL key was pressed (only valid ifvalue != :char
).shift::Bool
:true
if SHIFT key was pressed (only valid ifvalue != :char
).
TerminalPager._help!
— Method_help!(pargerd::Pager) -> Nothing
Open a new pager with the help.
TerminalPager._jlgetch
— Method_jlgetch(stream::IO) -> Keystroke
Wait for an keystroke in the stream stream
and return it (see Keystroke
).
TerminalPager.debug_keycode
— Methoddebug_keycode() -> Nothing
Debug key codes.
TerminalPager.delete_keybinding
— Methoddelete_keybinding(key::Union{Char, Symbol}; kwargs...) -> Nothing
Delete the keybinding key
. The modifiers keys can be selected using the keywords alt
, ctrl
, and shift
.
For more information about how specify key
see set_keybinding
.
TerminalPager.drop_all_preferences!
— Methoddrop_all_preferences!()
Drop all preferences.
Examples
julia> TerminalPager.drop_all_preference!()
TerminalPager.drop_preference!
— Methoddrop_preference!(pref::String, value) -> Nothing
Drop the preference pref
.
Examples
julia> TerminalPager.drop_preference!("visual_mode_line_background")
TerminalPager.pager
— Methodpager(obj; kwargs...)
Call the pager to show the output of the object obj
.
Keywords
Some of the default values shown here can be modified by user-defined preferences.
auto::Bool
: Iftrue
, then the pager is only shown if the output does not fit into the display. (Default =false
)change_freeze::Bool
: Iftrue
, then the user can change the number of frozen rows and columns inside the pager. (Default =true
)frozen_columns::Int = 0
: Number of columns to be frozen at startup. (Default = 0)frozen_rows::Int = 0
: Number of rows to be frozen at startup. (Default = 0)hashelp::Bool = true
: Iftrue
, then the user can see the pager help. (Default =true
)has_visual_mode::Bool = true
: Iftrue
, the user can use the visual mode. (Default =true
)show_ruler::Bool
: Iftrue
, a vertical ruler is shown at the pager with the line numbers. (Default =false
)use_alternate_screen_buffer::Bool
: Iftrue
, the pager will use the alternate screen buffer, which keeps the current screen when exiting the pager. Notice, however, that we use the XTerm escape sequences here. Hence, if your terminal is different, this option can lead to rendering problems.
Preferences
The user can defined custom preferences using the function TerminalPager.set_preference!
. The available preferences are listed as follows:
"active_search_decoration"
:String
with the ANSI escape sequence to decorate the active search element. One can easily obtain this sequence by converting aCrayon
to string. (Default =string(crayon"black bg:yellow")
)"inactive_search_decoration"
:String
with the ANSI escape sequence to decorate the inactive search element. One can easily obtain this sequence by converting aCrayon
to string. (Default =string(crayon"black bg:light_gray")
)"always_use_alternate_screen_buffer_in_repl_mode"
: Iftrue
, we will always use the alternate screen buffer when showing the pager in REPL mode. (Default = false)"block_alternate_screen_buffer"
: Iftrue
, the alternate screen buffer support will be globally blocked, regardless of the keyword options. This modification is helpful when the terminal is not compatible with XTerm. (Default =false
)"pager_mode"
: If it is "vi", some keywords are modified to match the behavior of Vi. Notice that this change only takes effect when a new Julia session is initialized. (Default = "default")"visual_mode_line_background"
:String
with the ANSI code of the background for the selected lines in the visual mode. (Default = "100")"visual_mode_active_line_background"
:String
with the ANSI code of the background for the active line in the visual mode. (Default = "44")
For more information, see: TerminalPager.set_preference!
, TerminalPager.drop_preference!
, and TerminalPager.drop_all_preferences!
.
TerminalPager.reset_keybindings
— Methodreset_keybindings() -> Nothing
Reset key bindings to the original ones.
TerminalPager.set_keybinding
— Methodset_keybinding(key::Union{Char, Symbol}, action::Symbol; kwargs...) -> Nothing
Set key binding key
to the action action
. The modifiers keys can be selected using the keywords alt
, ctrl
, and shift
.
key
can be a Char
or a Symbol
indicating one of the following special keys:
"<up>", "<down>", "<right>", "<left>", "<home>", "<end>", "<F1>", "<F2>",
"<F3>", "<F4>", "<F5>", "<F6>", "<F7>", "<F8>", "<F9>", "<F10>", "<F11>",
"<F12>", "<keypad_dot>", "<keypad_enter>", "<keypad_asterisk>",
"<keypad_plus>", "<keypad_minus>", "<keypad_slash>", "<keypad_equal>",
"<keypad_0>", "<keypad_1>", "<keypad_2>", "<keypad_3>", "<keypad_4>",
"<keypad_5>", "<keypad_6>", "<keypad_7>", "<keypad_8>", "<keypad_9>",
"<delete>", "<pageup>", "<pagedown>", "<tab>"
action
can be one of the following symbols:
:quit, :help, :up, :down, :left, :right, :fastup, :fastdown, :fastleft,
:fastright :bol, :eol, :pageup, :pagedown, :home, :end
TerminalPager.set_preference!
— Methodset_preference!(pref::String, value) -> Nothing
Set the preference pref
to the value
.
Examples
julia> TerminalPager.set_preference!("visual_mode_line_background", "44")
TerminalPager.@help
— Macro@help(f)
Open the documentation of the function f
in pager.
Examples
julia> @help write
TerminalPager.@stdout_to_pager
— Macro@stdout_to_pager(ex_in)
Capture the stdout
generated by ex_in
and show inside a pager.
The command must write to stdout
explicitly. For example, @stdout_to_pager 1
shows a blank screen since 1
does not write to stdout
, but returns 1
. @stdout_to_pager show(1)
, on the other hand, shows the number 1
inside the pager.
This macro can also be called using the shorter name @out2pr
.