On Thu, September 24, 2009 12:25 pm, Andy Wokula wrote:
> For undoing, you can experiment, e.g.
>
>     :ia --> --><C-G>u<BS><BS><BS>\rightarrow
>
> <Esc>u  will then bring back the arrow "-->".
> Just invented right now, not common use AFAIK.

Interesting suggestion. How about that:

,----
| fu! UndoAb()
|     redir => abbrev
|     :silent :ab
|     redir END
|
|     let ab = split(abbrev, '\n')
|     for value in ab
|       let mode=split(value)[0]
|       let lhs =split(value)[1]
|       let rhs =value[17:]
|       let special=value[15:16]
|       if rhs =~ '<BS>'
|          continue
|       endif
|       let bs = repeat('<BS>', strlen(substitute(lhs, '.', '|', 'g')))
|       let spec_l = []
|       if special =~ '&'
|          call add(spec_l, '<script>')
|       endif
|       if special =~ '@'
|          call add(spec_l, '<buffer>')
|       endif
|       if mode == '!'
|          let mode='ic'
|       endif
|       if mode =~ 'i'
|          exe ':i'.(special=~'*'?'nore':'').'abbrev ' . join(spec_l) .  ' '. 
lhs . ' ' . lhs . '<C-G>u' . bs . rhs
|       endif
|       if mode =~ 'c'
|          exe ':c'.(special=~'*'?'nore':'').'abbrev ' . join(spec_l) .  ' ' .
lhs . ' ' . lhs . '<C-G>u' . bs . rhs
|       endif
|     endfor
| endfu
`----

This has some problems. The function cannot reliably determine, whether
it was already called. So it aborts, whenever it detects an backspace
'<BS>' on the rhs of the abbreviation.

Additionally, it seems, it is not possible to detect expression
abbreviations. So those will become invalid, I believe ;(

Other than that, just calling that function will parse all your
abbreviations and make them undoable. One could probably add the same
for mappings.

regards,
Christian
-- 
:wq!


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

Reply via email to