zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: bbarnes@austin.ibm.com, zsh-users@math.gatech.edu
Subject: Re: Key bindings in Zsh?
Date: Mon, 30 Aug 1999 02:29:33 +0000	[thread overview]
Message-ID: <990830022933.ZM4868@candle.brasslantern.com> (raw)
In-Reply-To: <37C54F6A.373C0A93@austin.ibm.com>

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
<http://www.zsh.org/mla/>.

} 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


  reply	other threads:[~1999-08-30  3:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-26 14:30 Brian P. Barnes
1999-08-30  2:29 ` Bart Schaefer [this message]
     [not found]   ` <37CD77EB.C23C2980@austin.ibm.com>
1999-09-01 21:20     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990830022933.ZM4868@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=bbarnes@austin.ibm.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).