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

Re: CLI Tricks



On Fri, Dec 12, 2003 at 11:38:34AM +0000, zzapper wrote:
> >
> >is there any where to get it start in non-insert mode (ie command mode)
> >
> I meant NON-INSERT

You can do

# my-cr() pushes \r\e to zle buffer as if typed
my-cr() { zle -U $'\r\e' }
# define my-cr as widget function
zle -N my-cr my-cr
# insert mode maps
bindkey '^m' my-cr
bindkey '^j' my-cr
# command mode maps
bindeky -a '^m' my-cr
bindeky -a '^j' my-cr

which remaps <cr> to <cr><esc>.  The very first input would be
in insert mode, but maybe you can live with that.  ;-)

Pavol



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