On 9/25/06, Marius Roets <[EMAIL PROTECTED]> wrote:
I have a in my plsql.vim filetype plugin a lot of abbreviations to the
effect of :
iabbrev <buffer> then THEN
iabbrev <buffer> else ELSE
... So I was wondering if there was a
way where I could turn a set of abbreviations on and off, on the fly,
without reloading the buffer.

How about this:

function! MyAbbrevs()
  iabbrev <buffer> then THEN
  iabbrev <buffer> else ELSE
  let g:myabbrev_set=1
endfunc

function! UnsetMyAbbrev()
  iunabbrev <buffer>then
  iunabbrev <buffer>else
  let g:myabbrev_set=0
endfunc

function! ToggleMyAbbrev()
  if exists("g:myabbrev_set") && g:myabbrev_set
       call UnsetMyAbbrev()
  else
       call MyAbbrevs()
  endif
endfunc

call MyAbbrevs() " initial setting
nmap <F5> :call ToggleMyAbbrev()<cr>

Yakov

Reply via email to