
; *****************************************************************************
; VT100/200 key bindings
; *****************************************************************************

!if &band $tcflags 64

	write-message "[VT100 keypad]"

	; VT100/200 keys

	; Define arrow keys.
		bind-to-key 	next-line 		FNN
		bind-to-key 	previous-line 		FNP
		bind-to-key 	forward-character 	FNF
		bind-to-key 	backward-character 	FNB
	
	; Define pf1-4
		bind-to-key 	gold-prefix 		KPa
		bind-to-key 	save-file 		KPb
		bind-to-key 	find-file 		KPc
		bind-to-key 	exit-emacs 		KPd
	
	; Define kp7,8,9,-
		bind-to-key 	previous-page 		KP7
		bind-to-key 	next-page 		KP8
		bind-to-key 	beginning-of-file 	KP9
		bind-to-key 	end-of-file 		KP-
	
	; Define kp4,5,6,,
		bind-to-key 	beginning-of-line 	KP4
		bind-to-key 	end-of-line 		KP5
		macro-to-key 	delete-current-line 	KP6
		macro-to-key	start-of-next-line 	KP,
	
	; Define kp1,2,3,ENTER
		bind-to-key 	previous-word 		KP1
		bind-to-key 	next-word 		KP2
		bind-to-key 	delete-previous-word 	KP3
		bind-to-key 	search-forward 		KPE
	
	; Define kp0,.
		bind-to-key 	insert-space 		KP0
		bind-to-key 	delete-next-character 	KP.
	
	; Redefine Bs
		bind-to-key	delete-previous-character	^H

	; Define GOLD and pf1,2,3,4
		macro-to-key 	toggle-help		G-KPa ;GOLD then GOLD
		bind-to-key 	write-file 		G-KPb
		bind-to-key 	insert-file 		G-KPc
		bind-to-key 	change-file-name 	G-KPd

	; Define GOLD and kp7,8,9,-
		bind-to-key 	set-mark 		G-KP7
		bind-to-key 	kill-region 		G-KP8
		bind-to-key 	copy-region 		G-KP9
		bind-to-key 	yank 			G-KP-

	; Define GOLD and kp4,5,6,,
		bind-to-key 	execute-macro-35 	G-KP4 ; kill to start of line
		bind-to-key 	kill-to-end-of-line 	G-KP5
		bind-to-key 	goto-line 		G-KP6
		bind-to-key 	open-line 		G-KP,

	; Define GOLD and kp1,2,3,ENTER
		macro-to-key 	toggle-insert-mode	G-KP1
		bind-to-key 	query-replace-string 	G-KP2
		bind-to-key 	delete-next-word 	G-KP3
		bind-to-key 	search-reverse 		G-KPe

	; Define GOLD and kp0,.
		macro-to-key	toggle-fn-window 	G-KP0 ; Toggle Function List
		bind-to-key 	quote-character 	G-KP.

	; Define GOLD and 0-9.
		bind-to-key 	next-window 		G-0
		bind-to-key 	delete-other-windows 	G-1
		bind-to-key 	split-current-window 	G-2
		bind-to-key 	begin-macro 		G-3
		bind-to-key 	end-macro 		G-4
		bind-to-key 	execute-macro 		G-5
		bind-to-key 	execute-file 		G-6
		bind-to-key 	execute-procedure 	G-7
!endif

; ******************************************************************************
; VT200 editing  cluster
; ******************************************************************************

!if &band $tcflags 128
	; VT200 Editing keypad

	; FIND key:
		bind-to-key 	search-forward 		FNS
		bind-to-key	search-reverse		G-FNS
		bind-to-key 	query-replace-string	M-FNS
	; SELECT key:
		bind-to-key	set-mark		FNM
	; REMOVE key:
		bind-to-key	kill-region		FNR
		bind-to-key	copy-region		G-FNR
	; INSERT key:
		bind-to-key	yank			FNY
	; HELP key:
		macro-to-key	toggle-help		FN5	; HELP
		bind-to-key	apropos			G-FN5
		macro-to-key	toggle-fn-window	M-FN5	; Toggle FN window
	; DO key:
		bind-to-key	execute-named-command	FN6
		bind-to-key	shell-command		G-FN6

	write-message "[VT200 keys]"

!endif

