I the plugin directory vim9script of a plugin of mine, i would like to toggle autocmd.
In plugin part, I got this augroup
foobar/plugin/foobar.vim
....
augroup difflayout
au!
autocmd CursorHold *.tmp call EnhancedDiffLayout()
augroup END
....
meanwhile in the following autoload part I got this to toggle autocmd.
foobar/autoload/foobar.vim
export def EnhancedDiffLayout_Toggle() #{{{
g:EnhancedDiffLayout_Options.autocmd_enabled = !g:EnhancedDiffLayout_Options.autocmd_enabled
if !g:EnhancedDiffLayout_Options.autocmd_enabled
echomsg "EnhancedDiffLayout_autocmd disabled"
autocmd! CursorHold *.tmp call EnhancedDiffLayout()
augroup! difflayout
else
echomsg "EnhancedDiffLayout_autocmd enabled"
augroup difflayout
au!
autocmd CursorHold *.tmp call EnhancedDiffLayout()
augroup END
endif
enddef #}}}
It seems at runtime that augroup cannot be deleted because autocmd! does not delete the autocmd.
How can I fix it ?
Thank you
NiVa
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/1f80c947-970b-4cec-850e-c6c881d40107n%40googlegroups.com.
No comments:
Post a Comment