From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23015 invoked from network); 30 Aug 1999 03:01:50 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Aug 1999 03:01:50 -0000 Received: (qmail 27134 invoked by alias); 30 Aug 1999 03:01:33 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2533 Received: (qmail 27127 invoked from network); 30 Aug 1999 03:01:32 -0000 From: "Bart Schaefer" Message-Id: <990830022933.ZM4868@candle.brasslantern.com> Date: Mon, 30 Aug 1999 02:29:33 +0000 In-Reply-To: <37C54F6A.373C0A93@austin.ibm.com> Comments: In reply to "Brian P. Barnes" "Key bindings in Zsh?" (Aug 26, 9:30am) References: <37C54F6A.373C0A93@austin.ibm.com> X-Mailer: Z-Mail (5.0.0 30July97) To: bbarnes@austin.ibm.com, zsh-users@math.gatech.edu Subject: Re: Key bindings in Zsh? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 26, 9:30am, Brian P. Barnes wrote: } Subject: Key bindings in Zsh? } } My insert/delete/home/end/pgup/pgdn keys do not work in Zsh. They either } give me a squiggle ('~'), a beep or do the wrong thing: } Insert, pgup, pgdn -> ~ } home, end -> beep What exactly do you think they should do? Zsh has generally avoided the issue of bindings for things like the arrow keys, the keypad, and function keys because terminals and keyboards vary so widely and termcap/terminfo have historically been untrustworthy. The vt100-compatible arrow-key bindings are all that's ever been bound by default. There has been some discussion of initializing more from the terminal databases, but the question of what they should mean remains -- what is a "page" at a command line prompt? Does "Home" go all the way to the beginning of the history, or (as you seem to expect) just to beginning of line? Etc. } delete -> backspace That one's intentional; many keyboards have delete and backspace swapped, so zsh has always made them behave identically. } The keys work in other tools I use including Vim and Netscape so I don't } think I want to alter my Xmodmap. Zsh is not an X11 program and does not receive X11 keyboard events; it gets whatever sequence of characters the terminal or terminal emulator decides to send it. So your X mappings and what Netscape does are both largely irrelevant. } The Zsh manual makes a glancing reference to "use zle -N" in reference } to using user-defined widgets implemented as shell functions to execute } key mapping. There appears to be no documentation for this function Which zsh manual? The texinfo doc for 3.1.6 has an entire section "The zle Module" devoted to this, in which you'd have discovered that what you want is not "zle" anyway, but rather "bindkey". If you're using 3.0.6 or earlier, you want the section "Shell Builtin Commands", but 3.0 doc should not mention "zle -N" at all. In both cases, the set of actions (widgets) that can be bound to keys are described in the "Zsh Line Editor" section. You could also have tried searching the archives of this mailing list at . } I tried adding the following to my .zshrc file: `zle -N END end-of-line` That creates a new zle "widget" named END which calls the function named end-of-line when the key to which it is bound is pressed. It doesn't bind it to any key, though: you need "bindkey" for that. You probably want something in .zshrc like case $TERM in xterm) bindkey '\eOH' beginning-of-line bindkey '\eOF' end-of-line bindkey '\e[2~' overwrite-mode bindkey '\e[5~' beginning-of-buffer-or-history bindkey '\e[6~' end-of-buffer-or-history ;; aixterm) # similar commands but with aixterm sequences ;; # and so on for other terminal types esac -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com