On Sat, Feb 14, 2009 at 2:42 AM, Dominique Pelle wrote:
>
> Sean wrote:
>
>>> 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

I wouldn't have thought that would affect abbrs... good to know.

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

:set paste  ;-)  - :set paste disables mappings, abbreviations,
auto-indenting, and many other things.  If this map still fires,
something is wrong.

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

+1

> When doing that, it might also be wise to increase undolevel:
>
> set undolevels=2000

+1

Though I think I'd do even more than that if I used those maps... I
sometimes use :earlier 24h or some such to let me view the code I had
yesterday without a VCS, assuming no vim crash, and I'd be sad if I'd
made too many changes for that to work...

~Matt

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

Reply via email to