diff options
author | Chris <[email protected]> | 2021-07-07 11:44:10 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2021-07-07 11:44:10 -0400 |
commit | 2a16537216ffbf30759d01cd8ca70f606aed3a47 (patch) | |
tree | 717dd49195232eab4258c25e6ad0f0ff8bb14538 /lua/lv-neoformat/init.lua | |
parent | 649849ad582ea9d1ce3bcdae0428e9c49869025c (diff) |
check if group exists before removing
Diffstat (limited to 'lua/lv-neoformat/init.lua')
-rw-r--r-- | lua/lv-neoformat/init.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lua/lv-neoformat/init.lua b/lua/lv-neoformat/init.lua index 4f3bab60..ea3ff43c 100644 --- a/lua/lv-neoformat/init.lua +++ b/lua/lv-neoformat/init.lua @@ -1,12 +1,18 @@ -- autoformat if O.format_on_save then - require("lv-utils").define_augroups { - autoformat = { - { - "BufWritePre", - "*", - [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], - }, - }, - } + require("lv-utils").define_augroups({ + autoformat = { + { + "BufWritePre", + "*", + [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], + }, + }, + }) +end + +if not O.format_on_save then + vim.cmd([[if exists('#autoformat#BufWritePre') + :autocmd! autoformat + endif]]) end |