How to make the arrow keys work in standard csh provided with NeXTStep/openStep?

NeXT Computer, Inc. -> NEXTSTEP / OPENSTEP Software

Title: How to make the arrow keys work in standard csh provided with NeXTStep/openStep?
Post by: don_apple on January 27, 2023, 05:31:38 AM
Hello,

since I'm working a lot with bash on Linux I'm used to using the arrow keys to scroll through the command history, however when using the default csh provided by NeXTStep/OpenStep this doesn't work.

I found some instructions in "The NeXT-FAQ" (https://www.levenez.com/NeXTSTEP/faq.html):
4.6 How do I get the arrow keys to work in csh?

   csh, arrow keys
   
   This is for people who use a terminal app that does vt100 keyboard
   emulation - pasc
   
   First, add these lines to your .cshrc (preferably between the if and
   endif):
   

        set editmode=emacs
        set macrofiles=.macros

   
   
   Then create a file called .bindings and put in it:
   

        bind-to-key ExecuteNamedMacro '\e['

   
   
   And, next, you need to make a file called ".macros". Using an editor
   like emacs (which can insert control characters using a &Qcirc;
   prefix), into this file put:
   

        A^@^@^@^A^P
        B^@^@^@^A^N
        C^@^@^@^A^F
        D^@^@^@^A^B

   
   
   where ^@ means Control-@ and ^A means Control-A, etc. Also, don't
   put in the leading spaces. This will set up the left and right arrows
   to move back and forth on the line, and the up and down arrows will
   cycle through your history.
   
   On Intel machines these sequences are a little different:
   

        A^A^@^@^@^P
        B^A^@^@^@^N
        C^A^@^@^@^F
        D^A^@^@^@^B

   
   
   Then source .cshrc and the changes should take effect.
But I can't seem to get them to work, because I'm not able to get the special characters entered correctly in the .macros file mentioned there (I guess this might be due to the fact that I'm using a german keyboard).

Does anybody have the files mentioned there? Or are there some other options to get this to work (using the original csh and not by switching to tcsh or bash, since I want to keep the setup as original as possible)?
Title: Re: How to make the arrow keys work in standard csh provided with NeXTStep/openStep?
Post by: verdraith on January 27, 2023, 05:54:50 AM
Vi and console Emacs seems to struggle with the normal trick for typing raw control sequences on Unix:

Ctrl+v Ctrl+@
Probably because ^@ is NUL :-\

However, in Emacs.app 4.20 (https://www.nextcomputers.org/NeXTfiles/Software/NEXTSTEP/Apps/Text/EMACS/), the following works:

Ctrl+q Ctrl+@
You might be better off using telnet to do this if you don't have or are not familar with Emacs.

Caveat:  You'll need to either Ctrl+Shift+@ or Ctrl+@ depending on whether your keyboard's @ requires a shift.

With that said, some systems allow you to do this:
Ctrl+v Ctrl+Spaceto get a NUL.

p.s. there is a contemporary Bash package (2.00.0) available.

-- edit --
The Bash 2.00 port is from 1997... I suspect there might be a contemporary port of Bash 1 somewhere, too.
zsh also has a contemporary port.

-- edit --
No re bash 1, but there are these:
pdksh 5.2.3 from 1995,
zsh 2.4 from 1994,
tcsh 6.06

Peanuts-2 contains pdksh 5.2.3, zsh 2.4, and tcsh 6.06
Peanuts-U contains bash 2.00, and zsh 3.0.2
NEXTSTEP 3 ships with /usr/bin/zsh
Title: Re: How to make the arrow keys work in standard csh provided with NeXTStep/openStep?
Post by: verdraith on January 31, 2023, 07:17:49 AM
Actually, Ctrl+V Ctrl+Space appear to work with Terminal.app on both NEXTSTEP 2.2 m68k and OPENSTEP 4.2 m68k... it doesn't work on NEXTSTEP 3.3 Intel or OPENSTEP 4.2 Intel, annoyingly.

-- correction --
it works with csh on m68k and i386, but not zsh or bash.
Title: Re: How to make the arrow keys work in standard csh provided with NeXTStep/openStep?
Post by: don_apple on February 04, 2023, 05:28:37 AM
Thanks for the suggestions. Guess I'll have to do some more experimenting to try to get this to work.

Go to top  Forum index