From owner-freebsd-questions@freebsd.org Wed Dec 30 14:34:02 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B53EA56D27 for ; Wed, 30 Dec 2015 14:34:02 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3C641223 for ; Wed, 30 Dec 2015 14:34:01 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id tBUEAORL007051; Thu, 31 Dec 2015 01:10:25 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Thu, 31 Dec 2015 01:10:24 +1100 (EST) From: Ian Smith To: Polytropon cc: freebsd-questions@freebsd.org, "William A. Mahaffey III" Subject: Re: delete button in console In-Reply-To: Message-ID: <20151230233402.L8562@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 14:34:02 -0000 In freebsd-questions Digest, Vol 604, Issue 3, Message: 17 On Wed, 30 Dec 2015 06:05:29 +0100 Polytropon wrote: > On Tue, 29 Dec 2015 14:53:32 -0553.75, 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. > > No, this is a matter of terminal emulation. The keyboard usually > sends the same position code (or ASCII code) everywhere in the > world. If I remember correctly, Backspace is 0x08, and Delete is > something else. Native delete key is 0x7f, the last ASCII character. Goes way back .. but I can't remember the EBCDIC equivalent :) > > When I try the above, then 'stty -a', I see no setting. > > > > [wam@devbox, pre, 2:48:10pm] 2029 % bindkey '^?' delete-char > > > > .... > > That may be a vi thing - I've tried it here, and backspace does > not do what it usually does in vi (neither in "insert" or "vi" mode). > At the regular console prompt, it works as intended (and in all > other text mode editors, like ee, too). > > I am actually using rxvt, logged into another box, but it apparently > > advertises as xterm .... > > Is the .cshrc setting being made on _that_ box (the target box)? > If the rxvt is configured "xterm-compatible", make sure you also > have the xterm setting. Compare: > > bindkey ^? delete-char # for console > bindkey ^[[3~ delete-char # for xterm > > It's helpful to define both. Indeed. Long ago when first getting this going, I found it necessary to explicitly add 'stty erase ^H' after fixing the delete (forward) char/s in ~/.cshrc; I forget why, but likely couldn't hurt (William) to try .. if ($?prompt) then # An interactive shell -- set some stuff up set prompt = "$USER on `/bin/hostname -s`% " set filec set history = 1200 set savehist = 900 set ignoreeof # no exit on ^D set mail = (/var/mail/$USER) if ( $?tcsh ) then bindkey "^W" backward-delete-word bindkey -k up history-search-backward bindkey -k down history-search-forward bindkey "^?" delete-char bindkey "\e[3~" delete-char bindkey "\e[1~" beginning-of-line bindkey "\e[4~" end-of-line set autolist ambiguous endif stty erase ^H endif cheers, Ian