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

Re: Undo Depth in ZLE



On Mon, Mar 08, 2010, Radostan Riedel wrote about "Re: Undo Depth in ZLE":
> Just try out :
> 
> > bindkey -M vicmd 'u' undo

Indeed, vi mode's "u" behaves like the the original BSD "vi" (and ksh),
where "u" only undoes one change (and repeating it redoes the change).

Personally, I would have liked the default to emulate not the old vi, but
rather vim, with which more people should be be familiar these days, and
its multi-level undo and redo.

To emulate vim's multi-level undo and redo, here is what I use in my .zshrc:

	bindkey -a u undo
	bindkey -a '^R' redo

By the way this overrides zsh's default mapping of ^R which is "redisplay".
What am I losing by doing this? (I didn't see "redisplay" does anything...)

Moreover, I also like to have undo in insert mode, especially to be able to
undo completions, so I also have:

	bindkey -v '^Z' undo
	bindkey -v '^R' redo


Nadav.

-- 
Nadav Har'El                        |      Thursday, Mar 11 2010, 25 Adar 5770
nyh@xxxxxxxxxxxxxxxxxxx             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Martin Luther King said "I have a dream",
http://nadav.harel.org.il           |not "I have a plan".



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