Sean wrote:

>> This has just been discussed 
>> today:http://groups.google.com/group/vim_use/msg/d2617151a3f8d95e
>>
>>     :h i_CTRL-G_u
>>
>> You can add an undo step whenever you insert a Space this way:
>>     :imap <Space> <Space><C-G>u
>>
>> Notes:
>> :imap (vs. :inoremap) is used to still be able to expand abbreviations.
>> There is no endless loop, see
>>     :h recursive_mapping
>>
>> --
>> Andy
>
> This is cool. I am interested in finding where those text goes. Is it
> still part of register . (<C-R>.)?
>
> Is it possible to find out a way, in insert mode, to get those text
> between <C-G>u?

I don't think that you can retrieve it. An undo sequence is not
just text added, it can also be text removed, or text changed.
What would a register store then?

One annoying thing with...

imap <Space> <Space><C-G>u

... is that it's not nice when trying to undo after pasting a large piece of
text from clipboard (set paste  then middle click to paste), since you
can then only undo word by word which can be painful.  It'd be nice to
be able to disable it when pasting text (how??).

Instead of remapping <space>, I prefer to just have the
following mappings (which don't interfere with pasting text):

inoremap <c-u> <c-g>u<c-u>
inoremap <c-w> <c-g>u<c-w>
inoremap <bs>  <c-g>u<bs>
inoremap <del> <c-g>u<del>

Since I often use those keys while in insert mode, it's enough
to increase the granularity of undo for me.

When doing that, it might also be wise to increase undolevel:

set undolevels=2000

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to