Library

Documentation for TerminalPager.jl.

TerminalPager.KeystrokeType
struct 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 if value != :char).
  • ctrl::Bool: true if CTRL key was pressed (only valid if value != :char).
  • shift::Bool: true if SHIFT key was pressed (only valid if value != :char).
source
TerminalPager.delete_keybindingMethod
delete_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.

source
TerminalPager.drop_preference!Method
drop_preference!(pref::String, value) -> Nothing

Drop the preference pref.

Examples

julia> TerminalPager.drop_preference!("visual_mode_line_background")
source
TerminalPager.pagerMethod
pager(obj; kwargs...)

Call the pager to show the output of the object obj.

Keywords

Info

Some of the default values shown here can be modified by user-defined preferences.

  • auto::Bool: If true, then the pager is only shown if the output does not fit into the display. (Default = false)
  • change_freeze::Bool: If true, 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: If true, then the user can see the pager help. (Default = true)
  • has_visual_mode::Bool = true: If true, the user can use the visual mode. (Default = true)
  • show_ruler::Bool: If true, a vertical ruler is shown at the pager with the line numbers. (Default = false)
  • use_alternate_screen_buffer::Bool: If true, 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 a Crayon 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 a Crayon to string. (Default = string(crayon"black bg:light_gray"))
  • "always_use_alternate_screen_buffer_in_repl_mode": If true, we will always use the alternate screen buffer when showing the pager in REPL mode. (Default = false)
  • "block_alternate_screen_buffer": If true, 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!.

source
TerminalPager.set_keybindingMethod
set_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
source
TerminalPager.set_preference!Method
set_preference!(pref::String, value) -> Nothing

Set the preference pref to the value.

Examples

julia> TerminalPager.set_preference!("visual_mode_line_background", "44")
source
TerminalPager.@stdout_to_pagerMacro
@stdout_to_pager(ex_in)

Capture the stdout generated by ex_in and show inside a pager.

Note

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.

Note

This macro can also be called using the shorter name @out2pr.

source