Use of function keys for common comands at the ksh prompt.

Stefan Linnemann crissl at rulcvx.LeidenUniv.nl
Fri Mar 15 01:04:57 AEST 1991


In <54479 at sequent.UUCP> edw at sequent.UUCP (Ed Wright) writes:
>%>I would like to use my function keys (F1-F8) to save keystrokes.
>%>My keyboard generates "ESC O c-j" for F1-F8 respectively.

>Go to the shelf and get the book.
>The manual for your terminal should tell you haow to program the
>F keys.
>Thank god each terminal appears to be different! (:-)/2)
>THis is often a task that involves doing things that are not obvious
>and sometimnes frustrating.
>TVI-950s are easy
>HP700s are less so

You don't have to reprogram your terminal function keys.  Just use
the emacs command line editor and map ESC-O to ESC-[, after which
you can define ESC-O-[c-j] as aliases for whatever you fancy.  You'd
have to use __[c-j] as the alias names, but that's no problem.

The following lines are from my .profile:

--- part of .profile start ---
# make sure the emacs command line editor is used, independant of $EDITOR
export VISUAL=emacs
# set up aliases, functions and variables
alias -x _O='^[['	\
	__A='^P'	\
	__B='^N'	\
	__C='^F'	\
	__D='^B'	\
	__P='^[^['	\
	__Q='^[='	\
	__R='^[*'	\
	__S='^['
--- part of .profile end ---

In the above abstract from my .profile all the real control characters
have of course been replaced by representations.  To make it really
work, you'd have to replace them by the real thing.

__[A-D] are my cursor keys, which produce ESC-[-[A-D] and
__[P-S] are my function keys, which produce ESC-O-[P-S]:
they work wonders for me.

>It can be done.
>Have fun
>Ed
>-- 
> I think I've got the hang of it now .... :w  :q  :wq  :wq! ^d  X exit
> X Q  :quitbye  CtrlAltDel   ~~q  :~q  logout  save/quit :!QUIT ^[zz
> ^[ZZ ZZZZ  ^H  ^@  ^L  ^[c  ^# ^E ^X ^I ^T  ?  help  helpquit ^D  ^d
> ^C ^c helpexit ?Quit ?q  decwrl or uunet or tek !sequent!edw 

It's been done.
Good luck!
Stefan.

Stefan M. Linnemann, System programmer; Leiden University, the Netherlands.
crissl at rulcvx.LeidenUniv.nl



More information about the Comp.unix.shell mailing list