Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A couple of questions on 'bindkey'



Peter wrote:
> It's quite possible Zefram intended to add some way of doing this, given
> the existence of arbitrary keymaps.  Probably the most natural way is a new
> option to bindkey, e.g. `bindkey -S keymap' to select a keymap:  select is
> the word current used in the bindkey entry in the zshmodules manual page,
> and bindkey already takes a `-M keymap' option to choose which keymap to
> operate on, so this would fit.

Mmm hmm. There's sort-of the capacity to do that now by linking to
'main' with the bindkey -A option, but it's somewhat half-arsed. 
Ignoring for a moment if I may what's in place already, I imagined one
putative advantage of a KEYMAP variable is conceptually that it could be
local to a function, and restored implictly on exit using the normal
typeset mechanism.  (Not sure that this works for special variables, but
it might do).  However I'm sure that given the frequent resets to 'main'
of the current keymap that crashing out of a function in a different
keymap might not necessarily be a problem even without 'trap'
shenanigans.

But that's a very helpful answer.  If a shell param doesn't seem
obviously the appropriate way to handle setting such things as keymaps
then it's probably not worthwhile adding the complexity.

> Or do you mean the listing code for output, bs->firstseq etc.?  That's
> just a convenience to make the output neater.  Even there it doesn't need
> to know how the keys were originally *bound*, just how they happen to be in
> the current keymap. That's quite useful, since having the output
> " "-"~" self-insert
> is a big win compared with the other possibility of showing all 95
> characters.

Well, I meant the whole shebang really.  Case in point - I don't really
understand why you say the output " "-"~" is a big win.  Who wants this
in the first place?  And why are they grateful that it's 94 lines
shorter than it otherwise would be?  For me, it just breaks the ability
to do a simple regexp grep for no real benefit.

Anyhow, I conclude that the existing behaviour is not regarded as
especially egregious.  And as you say, it not exactly rocket science to
maintain.  So I'll try to preserve it.

Thanks

A



Messages sorted by: Reverse Date, Date, Thread, Author