# The 3022 is a vt220 clone made by Newbury in England. If anyone would be
# kind enough to check this out on a genuine vt220, that would be much
# appreciated.

# define macro to display TERMinal-specific keychart file
define-macro keychart ^[xpushlibd^M^U^[xshell-command-with-typeout cat keychart.$TERM^M^[xpopd^M

# F keys
bind-to-key beginning-of-line ^[[17~
bind-to-key beginning-of-file ^[[18~
bind-to-key shrink-window ^[[19~
bind-to-key split-current-window ^[[20~
bind-to-key next-window ^[[21~
bind-to-key delete-other-window ^[[23~
bind-to-key grow-window ^[[24~
bind-to-key end-of-file ^[[25~
bind-to-key end-of-line ^[[26~
bind-macro-to-key keychart ^[[28~
bind-to-key delete-next-character ^[[29~
bind-to-key backward-word ^[[31~
bind-to-key set-mark ^[[32~
bind-to-key exchange-point-and-mark ^[[33~
bind-to-key forward-word ^[[34~

# PF keys, for compatibility with vt100
bind-to-key beginning-of-line ^[OP
bind-to-key backward-word ^[OQ
bind-to-key forward-word ^[OR
bind-to-key end-of-line ^[OS
bind-to-key split-current-window ^[^[OP
bind-to-key next-window ^[^[OQ
bind-to-key grow-window ^[^[OR
bind-to-key delete-other-window ^[^[OS

# Arrow keys
bind-to-key backward-character ^[[D
bind-to-key previous-line ^[[A
bind-to-key next-line ^[[B
bind-to-key forward-character ^[[C
bind-to-key backward-character ^[OD
bind-to-key previous-line ^[OA
bind-to-key next-line ^[OB
bind-to-key forward-character ^[OC

# Inscribed Function keys
bind-to-key search-forward ^[[1~
bind-to-key newline-and-backup ^[[2~
bind-macro-to-key kill-line ^[[3~
bind-to-key search-reverse ^[[4~
bind-to-key scroll-down ^[[5~
bind-to-key scroll-up ^[[6~

# Numeric Keypad keys
bind-to-key yank ^[Ow
bind-to-key copy-region ^[Ox
bind-to-key kill-region ^[Oy
bind-to-key previous-page ^[Om
bind-to-key spell-buffer ^[Ot
bind-to-key fill-paragraph ^[Ou
bind-to-key auto-fill-mode ^[Ov
bind-to-key next-page ^[Ol
bind-to-key list-buffers ^[Oq
bind-to-key select-buffer ^[Or
bind-to-key find-file ^[Os
bind-to-key shell ^[OM
bind-to-key execute-named-command ^[Op
bind-to-key over-write-mode ^[On

# ESC codes for vt100 compatibility
bind-to-key set-mark ^[^[Ow
bind-to-key exchange-point-and-mark ^[^[Oy
bind-to-key newline-and-backup ^[^[Oq
bind-macro-to-key kill-line ^[^[Os
