Wednesday, September 8, 2010

Re: how to undo only the latest inserted character?

On 09/08/10 16:23, aleCodd wrote:
>
> the undo seems to change all text inserted since insert-mode was started.
>
> but what if i want to undo only one character, specifically if i mapped let
> say like this:
> ino a abc
> now after i start again the insert mode and type some text and the 'a'
> character which is mapped to 'abc', how do i undo only these three ('abc')
> characters?

I don't know of anything natively, but you might be able to use
"control-g u"

:help i_CTRL-G_u

in your mapping and/or abbreviation to set undo points before you
expand your mapping/abbr. Then a regular undo will do what you
want. You might try something like

:ino a <c-g>uabc

or

:iab a ^Guabc

(where the ^G may need to be entered as control+V followed by
control+G)

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: