From ebf7b2e4677ac4e8cad77fc4a7efa0fc9cf39ada Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 19 Mar 2023 04:14:08 +0100 Subject: insert-layout: Don't remove autocmds in `InsertLayoutOn` I assumed that I should be removing existing autocmds before adding new ones. If you ran the `:InsertLayout` command more than once, I didn't want old autocmds to stick around. The line was commented out because it fails on the first call to `:InsertLayout`, since at that point the `insert_layout` augroup doesn't exist. On closer inspection, however, it turns out that the old autocmds are not retained when running `:InsertLayout` subsequent times. Rather, the newly-defined ones are overwriting the old ones. So we don't need to worry about removing the old autocmds before adding new ones. --- bundle/insert-layout/plugin/insert_layout.vim | 2 -- 1 file changed, 2 deletions(-) (limited to 'bundle') diff --git a/bundle/insert-layout/plugin/insert_layout.vim b/bundle/insert-layout/plugin/insert_layout.vim index 2600da1..f5b93d3 100644 --- a/bundle/insert-layout/plugin/insert_layout.vim +++ b/bundle/insert-layout/plugin/insert_layout.vim @@ -55,8 +55,6 @@ def InsertLayoutOff(): void enddef def InsertLayoutOn(layout: string): void - # InsertLayoutOff() - # autocmd insert_layout InsertEnter OnInsertEnter(layout) # autocmd insert_layout InsertLeave OnInsertLeave() autocmd_add([ -- cgit v1.2.3