Friday, September 17, 2010

Re: Enabling/disabling abbreviations

Ответ на сообщение «Enabling/disabling abbreviations»,
присланное в 22:47:56 17 сентября 2010, Пятница,
отправитель Andre Majorel:

Don't know, why you need thousands of abbreviations, but you can use execute:
let s:abbreviations=[["e", "example"], ["e2", "example2"]]
function s:EnableAbbreviations(ablist)
for a in a:ablist
execute "inoreabbrev ".a[0]." ".a[1]
endfor
endfunction
function s:DisableAbbreviations(ablist)
for a in a:ablist
execute "iunabbrev ".a[0]
endfor
endfunction
command -nargs=0 -bar AbEnable call s:EnableAbbreviations(s:abbreviations)
command -nargs=0 -bar AbDisable call s:DisableAbbreviations(s:abbreviations)

Текст сообщения:
> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them
> all into functions that are no-ops when some global variable is
> set ?
>
> Or is there a way to group or tag abbreviations that I've missed ?
>
> Thanks in advance.

No comments:

Post a Comment