From owner-freebsd-questions@freebsd.org Tue Dec 29 23:16:51 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 E393AA542AE for ; Tue, 29 Dec 2015 23:16:51 +0000 (UTC) (envelope-from sergeig.public@gmail.com) Received: from mail-vk0-x231.google.com (mail-vk0-x231.google.com [IPv6:2607:f8b0:400c:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A43FA13E6 for ; Tue, 29 Dec 2015 23:16:51 +0000 (UTC) (envelope-from sergeig.public@gmail.com) Received: by mail-vk0-x231.google.com with SMTP id f2so159036490vkb.3 for ; Tue, 29 Dec 2015 15:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=CrW28VWMTyGEHbTJrmaGnHQdnpmL24Mq4kQ7zuymSTQ=; b=uC9XGKTNCA31EA6axiKTgmOW4EL3H2H58ffyPV8xb6bDYhf7mYFmfzwqj3zwx6dFY1 XLN2ERp7otFkBjvuZwduy4U7/Dsj35z3HLiNTnHCI8SmJlfCZHPEB1XpyFQ0iVROVyY/ Ik/jMny/I6KPDaxfK6uqvjmf5/zyOy6zM67gQUxMVEfHkKvs3Ze23DU9Zv+abLz1xhOg 0IycUaqfEgTfe0706+BIleuz3KVCjqRowqr2nrqtVUAhVZzv69JIlCSO7P06aB+qxCXe I/tjIbjcAYJyFTdnGLIrOtJLmKisp+F9X8V1UUI6j0VMkxhf048mp9yeT1hePf96UIKf LdwQ== MIME-Version: 1.0 X-Received: by 10.31.12.77 with SMTP id 74mr36673996vkm.28.1451431010329; Tue, 29 Dec 2015 15:16:50 -0800 (PST) Received: by 10.31.174.213 with HTTP; Tue, 29 Dec 2015 15:16:50 -0800 (PST) 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> Date: Tue, 29 Dec 2015 15:16:50 -0800 Message-ID: Subject: Re: delete button in console From: Sergei G To: FreeBSD Questions Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Tue, 29 Dec 2015 23:16:52 -0000 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 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" >