Date: Tue, 29 Dec 2015 15:16:50 -0800 From: Sergei G <sergeig.public@gmail.com> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: delete button in console Message-ID: <CAFLLzCMdGnQXMFBo1wJexg1x7wJOnrL4bCK%2Bg10surB_aV-e1Q@mail.gmail.com> In-Reply-To: <20151229222622.GA18290@becker.bs.l> References: <56825701.30908@gmail.com> <20151229180750.187ed7c9.freebsd@edvax.de> <5682F182.7080603@hiwaay.net> <20151229222622.GA18290@becker.bs.l>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks all I have added bindkey "\e[3~" delete-char to my ~/.cshrc file and Delete, Home and End buttons work now. The file content is very close to the default, so I am providing portion of .cshrc for your reference: if ( $?tcsh ) then # http://stackoverflow.com/questions/1912328/how-to-map-delete-and-end-keys-on-tcsh-shell # Delete bindkey "\e[3~" delete-char # Home bindkey "\e[1~" beginning-of-line # End bindkey "\e[4~" end-of-line bindkey "^W" backward-delete-word bindkey -k up history-search-backward bindkey -k down history-search-forward endif On Tue, Dec 29, 2015 at 2:26 PM, Bertram Scharpf <lists@bertram-scharpf.de> wrote: > Hi, > > On Tuesday, 29. Dec 2015, 14:53:32 -0553, William A. Mahaffey III wrote: > > On 12/29/15 11:14, Polytropon wrote: > > > On Tue, 29 Dec 2015 01:48:49 -0800, Sergei G wrote: > > >> When I ssh to a FreeBSD machine and press 'Delete' button in csh > prompt > > >> I get character '~' printed on screen. Backspace works just fine. > > >> > > >> I think even an actual console behaves the same way. > > >> > > >> Is there a way to "map" the Delete button to work appropriately? Would > > >> it be my SSH client application or FreeBSD itself? > > > This is a thing that can be configured for the shell. I assume > > > you're using FreeBSD's default dialog shell, the C shell. In > > > this case, add to ~/.cshrc: > > > > > > bindkey ^? delete-char # for console > > > bindkey ^[[3~ delete-char # for xterm > > > > > > Or to /etc/csh.cshrc, if you want to make it a global setting. > > > > > > You can check the success with the "stty -a" command. > > > > Is this keyboard dependent ? My keyboard apparently sends '^?' for its > > backspace key. When I try the above, then 'stty -a', I see no setting. > > I cannot see what stty should have to do with it. stty's > "erase" and "erase2" do only work when icanon is set. > > Unfortunately "stty -a" yields wrong results because the > shell changes the parameters before entering the "stty" > program. To determine the true values, do the following. > > $ tty > /dev/pts/5 > > Here, 5 could be any number depending on what was allocated > when the emulator window was started. Then open another > terminal and ask there: > > $ stty -a -f /dev/pts/5 > > Of course, replace the 5 by the right number. You will see a > "-icanon". Notice the minus in front of the property. That > means every key pressed will be passed to the command line > editor immediately. > > If icanon is on, the line must be completed by pressing > enter or return (^M) and after that the characters will be > passed to the input-processing program. In this mode the > backspace (^H) deletes characters and the input routine will > not be aware they were pressed at all. > > "delete-char" is a csh function (man csh). Probably there is > something like delete-char-to-left that will be executed on > backspace (^H). I did not find it. In Zsh its name is > "backward-delete-char". > > By the way, you can explore the escape codes produced by > arrow keys etc. using the dd program. Just say > > $ dd > > and play around with the Ins/Del/Home/End/Fx etc. keys. As > long as dd runs, icanon is set. Convince yourself of that by > executing the above stty command again. Leave dd by pressing > Ctrl-C. > > Bertram > > > -- > Bertram Scharpf > Stuttgart, Deutschland/Germany > http://www.bertram-scharpf.de > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFLLzCMdGnQXMFBo1wJexg1x7wJOnrL4bCK%2Bg10surB_aV-e1Q>