root@trwrb.UUCP (root) (06/29/89)
This is how I use cursor keys with micro emacs. Put the code below in
your .uemacsrc file. VT100 terminals output esc[A, esc[B, esc[C, and
esc[D for cursor up,down,left,and right. Method: First bind a macro
to esc[ ( esc = M). Then use the get key function >k to intercept
the next charactor output by the cursor key.
I use this method with other key combinations. For example:
esc cursor down, esc cursor up, esc cursor left, esc cursor right,
for multiple cursor movements
tab a, tab b, esc tab a, esc tab b, to move to and set
column tab positions
tab 1, tab 2, esc tab 1, esc tab 2, to move to and set line tab
positions
I also have function key f1 bound to togle my screen between 25 and 50 lines.
bind-to-key execute-macro-6 M-[
; cursor up, down, left , right
6 store-macro
set %key1 >k
!if &seq %key1 "A"
previous-line
!return
!endif
!if &seq %key1 "B"
next-line
!return
!endif
!if &seq %key1 "C"
forward-character
!return
!endif
!if &seq %key1 "D"
backward-character
!return
!endif
!endm