When I open the Terminal and press the "page up" button it simply scrolls my Terminal screen one page up, so that I can see what I typed and what the executed commands outputs were earlier.
I want to bind this key to a command called "history-search-backward" but I can't find a correct argument to provide for a bindkey ??? history-search-backward
command.
I successfully set ctrl+N
to do history-search-backward: bindkey "^N" history-search-backward
but it is much trickier for page up/page down keys. What do I mean by "trickier":
When I execute read
command and then press ctrl+N
it shows ^N
in the output but if I do the same for page UP
or page DOWN
keys... it simply scrolls my screen up/down and outputs nothing. Same goes for od -c
and showkey -a
- no output, simply scroll screen up/down. Even echo $terminfo[kpp]
returns empty line, which concerns me because echo $terminfo[khome]
returns H
.
I downloaded "Key Codes" app (link to app store) and it provides me with these key codes for page UP/page DOWN keys but I can't figure out how to use "116 / 0x74
" or "121 / 0x79
" as an argument to bindkey
command or is it even possible.
I use macOS Sonoma 14.5 and a Terminal app which I believe is a built-in app, it uses zsh and echo $TERM
command outputs xterm-256color
.
How do I bindkey
page UP/page DOWN keys to history search commands?