I have coded this instead to remove all autocommands of the group
echomsg "EnhancedDiffLayout_autocmd disabled"
augroup difflayout
autocmd!
augroup END
Le lundi 6 décembre 2021 à 13:36:41 UTC+1, Ni Va a écrit :
> Hi,
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_use/685086c3-e097-4d76-a673-ba2ecf9b24d7n%40googlegroups.com.