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

Re: changing bindings in isearch mode?

On Jan 17,  1:54am, Greg Klanderman wrote:
} It looks like the isearch mode bindings are hardcoded, is that right?

Sort of.  isearch was implemented before zsh had the concept of 
keymaps, so instead of using a keymap with its own set of widgets,
it hijacks the names of the widgets from the original keymap and
does its own internal thing when it sees you attempt to execute
one of those widgets.

} I'd really like to have <return> bound to exit isearch, like it does
} in emacs..
} Would it make sense to have an isearch keymap and use that?

I believe you should be able to accomplish this with a user-defined
wrapper widget that selects the keymap you want and then invokes the
appropriate built-in incremental-search widget.  I agree that's not
the best solution and that it would be better to re-implement isearch
with real widgets.
} Is there a key in isearch mode that will just exit isearch at the
} current position, and nothing else?

Yes:  Any undefined key.  So to make <enter> do that, you just have
to "bindkey -r ^M" (and possibly also ^J) in the keymap used by the 
aforementioned wrapper widget.

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