diff options
| author | Akihiro Okuno <[email protected]> | 2022-06-06 18:50:24 +0900 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-06 11:50:24 +0200 | 
| commit | f778a38c31daf53db42c4187faf08fcd004d441b (patch) | |
| tree | 05c2cce63725f0d01d1805ea1aeeff57486f38cc /lua/lvim/core/autocmds.lua | |
| parent | 7c53bd64c570c1e7151090eb758a17211f45965d (diff) | |
fix(autocmds): toggle format-on-save properly (#2659)
Diffstat (limited to 'lua/lvim/core/autocmds.lua')
| -rw-r--r-- | lua/lvim/core/autocmds.lua | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 0ca21439..20716e83 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -118,11 +118,11 @@ function M.configure_format_on_save()  end  function M.toggle_format_on_save() -  local exists, _ = pcall(vim.api.nvim_get_autocmds, { +  local exists, autocmds = pcall(vim.api.nvim_get_autocmds, {      group = "lsp_format_on_save",      event = "BufWritePre",    }) -  if not exists then +  if not exists or #autocmds == 0 then      M.enable_format_on_save()    else      M.disable_format_on_save() | 
