zsh-users
 help / color / mirror / code / Atom feed
* Re: Undo Depth in ZLE
@ 2010-03-08 11:18 Radostan Riedel
  2010-03-11  9:48 ` Nadav Har'El
  0 siblings, 1 reply; 4+ messages in thread
From: Radostan Riedel @ 2010-03-08 11:18 UTC (permalink / raw)
  To: zsh-users

In vi-mode the 'u' key is bounded to 
> vi-undo-change

According "man zshzle"


> vi-undo-change (unbound) (u) (unbound)
> Undo the last text modification.  If repeated, redo the modification.

Just try out :

> bindkey -M vicmd 'u' undo

best regards
Ray




Am Montag, den 08.03.2010, 15:55 +0530 schrieb Chidambaram Annamalai:
> Is there a way to undo more than once in ZLE?
> The default behavior in the vi mode in ZLE is to toggle between undo
and
> redo on pressing u.
> I want to be able to undo more than one previous change. Is it
possible?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Undo Depth in ZLE
  2010-03-08 11:18 Undo Depth in ZLE Radostan Riedel
@ 2010-03-11  9:48 ` Nadav Har'El
  2010-03-11 10:21   ` Frank Terbeck
  2010-03-11 15:05   ` Redisplay (Re: Undo Depth in ZLE) Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Nadav Har'El @ 2010-03-11  9:48 UTC (permalink / raw)
  To: Radostan Riedel; +Cc: zsh-users

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@math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Martin Luther King said "I have a dream",
http://nadav.harel.org.il           |not "I have a plan".


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Undo Depth in ZLE
  2010-03-11  9:48 ` Nadav Har'El
@ 2010-03-11 10:21   ` Frank Terbeck
  2010-03-11 15:05   ` Redisplay (Re: Undo Depth in ZLE) Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Terbeck @ 2010-03-11 10:21 UTC (permalink / raw)
  To: Nadav Har'El; +Cc: Radostan Riedel, zsh-users

Nadav Har'El wrote:
[...]
> 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.

It's called a *vi*-like mode and not a *vim*-like mode for a reason. :-)
Also, zsh has been around for a long time. Longer than vim being
everyone's vi-clone of choice.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Redisplay (Re: Undo Depth in ZLE)
  2010-03-11  9:48 ` Nadav Har'El
  2010-03-11 10:21   ` Frank Terbeck
@ 2010-03-11 15:05   ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2010-03-11 15:05 UTC (permalink / raw)
  To: zsh-users

On Mar 11, 11:48am, Nadav Har'El wrote:
}
} 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...)

Redisplay redraws just the current ZLE buffer, as opposed to clear-screen
(^L) which erases the terminal first.

This is useful if something else is scribbling on your display, like a
background job producing output, or console messages (if you're on the
console).

Redisplay also can be used to redraw a multi-line editor buffer that is
more than one screen tall, moving the line the cursor is on as close as
possible to the center of the screen.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-11 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-08 11:18 Undo Depth in ZLE Radostan Riedel
2010-03-11  9:48 ` Nadav Har'El
2010-03-11 10:21   ` Frank Terbeck
2010-03-11 15:05   ` Redisplay (Re: Undo Depth in ZLE) Bart Schaefer

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).