Path: utzoo!attcan!uunet!comp.vuw.ac.nz!byrd From: Mike.Williams@comp.vuw.ac.nz (Mike Williams) Newsgroups: comp.emacs Subject: Re: Arrow keys in xterm Message-ID: Date: 13 Sep 90 13:49:24 GMT References: <1990Sep12.181012.8563@msuinfo.cl.msu.edu> Sender: news@comp.vuw.ac.nz (News Admin) Organization: Dept. of Computer Science, Victoria Uni. of Wellington, NZ. Lines: 55 In-Reply-To: jes@mth.msu.edu's message of 12 Sep 90 18:10:12 GMT +-- In article <1990Sep12.181012.8563@msuinfo.cl.msu.edu> jes@mth.msu.edu (Jesse) writes: | | How do I make xterm arrow keys work inside EMACS? My solution is to redefine the xterm key mappings to send the normal sequences for {forward,backward}-char, {next,previous}-line, and so on. This also works brilliantly for tcsh, and for programs that use the GNU Readline interface (like bash). It will probably mess up any interactive program that relies on the standard ANSI terminal arrow-key codes. --- cut ------------------------------------------------------------------- XTerm*VT100.Translations: #override \ Up: string("^P") \n\ Down: string("^N") \n\ Left: string("^B") \n\ Right: string("^F") \n\ mUp: string("^[p") \n\ mDown: string("^[n") \n\ mLeft: string("^[b") \n\ mRight: string("^[f") \n\ F1: string("pd") string(0x0d) \n\ Prior: scroll-back(1,halfpage) \n\ Next: scroll-forw(1,halfpage) \n\ Home: scroll-back(1,page) \n\ End: scroll-forw(1,page) \n\ ShiftUp: scroll-back(1,line) \n\ ShiftDown: scroll-forw(1,line) \n\ Break: hard-reset() \n\ KP_Equal: set-scrollbar(toggle) \n\ KP_Divide: set-scroll-on-tty-output(toggle) \n\ KP_Multiply: soft-reset() \n\ KP_Subtract: scroll-back(1,halfpage) \n\ KP_Add: scroll-forw(1,halfpage) \n\ Insert: insert-selection(CUT_BUFFER0,PRIMARY) \n\ : insert-selection(CUT_BUFFER0,PRIMARY) \n\ F2: string("d -lg ") \n\ F3: string("dirs") string(0x0d) \n\ F10: string("top 20 | cat") string(0x0d) \n\ F12: string("| less") string(0x0d) \n --- end ------------------------------------------------------------------- This needs to be loaded using xrdb(1). If you have a ~/.xrdb or ~/.Xdefaults file, that's a good place for it. Note that the character sequence "^P" denotes Control-P (as usual), and "^[" denotes Escape. You'll have to replace this with the real characters, as xterm doesn't understand "^"-quoting. Do this using quoted-insert (C-q). -- /-------------------- byrd@comp.vuw.ac.nz --------------------\ | Mike Williams, Victoria University of Wellington, Aotearoa. | \------------ What's another word for Thesaurus? -------------/