From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17559 invoked from network); 21 Mar 2004 17:02:18 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 21 Mar 2004 17:02:18 -0000 Received: (qmail 22849 invoked by alias); 21 Mar 2004 17:02:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7219 Received: (qmail 22824 invoked from network); 21 Mar 2004 17:02:03 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 21 Mar 2004 17:02:03 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [167.160.213.139] by sunsite.dk (MessageWall 1.0.8) with SMTP; 21 Mar 2004 17:2:3 -0000 Received: from moonbase.zanshin.com (IDENT:schaefer@localhost [127.0.0.1]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i2LH22gr004228 for ; Sun, 21 Mar 2004 09:02:02 -0800 Received: (from schaefer@localhost) by moonbase.zanshin.com (8.12.11/8.12.11/Submit) id i2LH22hW004227 for zsh-users@sunsite.dk; Sun, 21 Mar 2004 09:02:02 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i2LH1wD25010; Sun, 21 Mar 2004 09:01:58 -0800 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040321170157.ZM25009@candle.brasslantern.com> Date: Sun, 21 Mar 2004 17:01:57 +0000 In-Reply-To: <20040321143156.GA31236@fargo> Comments: In reply to David ( Text in unknown character set ISO-8859-15 not shown ) "bindkey and widgets" (Mar 21, 3:31pm) References: <20040321143156.GA31236@fargo> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh-users Subject: Re: bindkey and widgets MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Envelope-Sender: On Mar 21, 3:31pm, David ( Text in unknown character set ISO-8859-15 wrote: } } It is possible to map the "Ctrl+RePag" combination using bindkey? Only if your terminal or emulator sends a different escape sequence for the RePag key when "modifier" keys like shift/ctrl/meta/alt are pressed. } '^\e[5~' and '\C-\e[5~' No. \e[5~ is the four-character sequence (escape left-bracket five tilde) that is sent when the unmodified RePag key is pressed. For function keys that send multi-character sequences, pressing the control key often has no effect, but if it has any effect at all it will be to cause another, different multi-character sequence to be sent. So you need to find out what that sequence is. The easiest way may be to type Ctrl+v (which usually means "quote next character") and then Ctrl+RePag and see what appears. If it looks like ^[[5~ (^[ is another way to write \e), then your keyboard and/or terminal emulator does not distinguish the ctrl modifier for function keys. If it looks different, then that is the sequence you use for bindkey. It may be possible to program your terminal emulator to recognize ctrl with function keys, but that's beyond what I'm prepared to explain here. } On the other hand, how can i map one action with two widgets?. When } the Control-K combination is pressed, i want two widgets to be executed, } namely kill-line and end-of-history. Creating a widget is probably the best way because it doesn't depend on any other bindings. However, you can use "bindkey -s". First, assuming Ctrl+k is presently bound to kill-line, you have to make a new binding for kill-line. Escape left-curly-bracket is an unlikely combination and not usually bound, so: bindkey '\e{' kill-line Then you need a binding for end-of-history, which isn't attached to a key by default. I'll choose escape right-curly-bracket for this example: bindkey '\e}' end-of-history Finally, rebind Ctrl+k with: bindkey -s '\C-k' '\e{\e}' The widget, on the other hand, would look like this: kill-line-and-end-history () { zle .kill-line && zle .end-of-history } zle -N kill-line kill-line-and-end-history That actually renames kill-line to your new widget, so all bindings for kill-line now include jumping to the end of the history. If you want to change Ctrl+k only, use: zle -N kill-line-and-end-history bindkey '\C-k' kill-line-and-end-history -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net