[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: make undo operate as in (no flames please) vim

From: Drew Adams
Subject: RE: make undo operate as in (no flames please) vim
Date: Sat, 24 Jan 2009 17:04:32 -0800

> One thing I've actually come to dread is using undo.  I've never taken
> the time to get this setup in some way that seems more useful to me.
> I always just go for the `C-x u' repeatedly or else preface with some
> number (C-u 20 C-x u) to get close if lots of undos are needed.
> I often hit `C-x-u' (forgetting to release the C-x part) which brings
> me to `upcase-region', which I keep disabled; that means I'm whisked
> to a lengthy message about using `upcase-region' and generally
> completely disrupting what I was doing.
> This is of my own making and not a fault of emacs, but still I'd like
> to have the undo behavior I find in vim.  It seems way closer to what
> I usually want.  Where I press some keycombo and a whole sentence or
> whatever is undone.  Instead of `C-x u' repeatedly to undo the same
> line or even paragraph of type.

I can't help with the main question you raise (Vim-like undo), but I do wonder
why you use `C-x u' for undo. 

Both `C-_' and `C-/' are a lot easier to use, assuming they are available to
you. In particular, you can just hold them down to repeat, something you cannot
do with `C-x u'. If those keys are not available for some reason, and until you
find a Vim-like solution you are really happy with, why not bind undo to a
simple key sequence that can be repeated just by pressing and holding it?

The Emacs manual, node Undo, says that `C-x u' is really available as a binding
only because it is supposedly easier for users to remember. Personally, I think
we should get rid of that default binding. I cannot imagine anyone using an undo
binding that you can't just hold down to repeat. To me, that binding is a
vestige that should be excised. The last thing we should do is encourage a new
user, using the rationale of being easier to remember, to get in the bad habit
of using a key sequence that is not appropriate for undo.

I also don't recommend using a prefix arg with undo, except in particular
contexts. That is, if you're just guessing at a number, trying to aim at the
right number of undo operations directly, then I think that's probably a
mistake. In particular, if you want to return to an unmodified buffer, you risk
going past the origin without knowing it. (Yes, you can always revert the buffer
as an alternative.)

Anyway, people use Emacs differently; these are just my thoughts, based on my
own habits. YMMV.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]