From e99eca3a9df237db69b946ec3ce66264069c1682 Mon Sep 17 00:00:00 2001 From: Feliche-Demian Netliukh <51330172+Demianeen@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:42:14 +0000 Subject: [PATCH] fix(extras): early return for dial extra --- lua/lazyvim/plugins/extras/editor/dial.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 7a414e29..63c48d11 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -178,6 +178,7 @@ return { end local dial_augroup = vim.api.nvim_create_augroup("DialFileType", { clear = true }) + local is_current_buffer_has_group = false for lang, patterns in pairs(opts.groups_by_filetypes) do vim.api.nvim_create_autocmd("FileType", { @@ -193,12 +194,12 @@ return { vim.notify(pattern .. " in " .. vim.inspect(patterns) .. ". Current filetype: " .. vim.bo.filetype) if vim.bo.filetype == pattern then set_dial_group(lang) - return + is_current_buffer_has_group = true end end end - - -- if we haven't returned from function that means that we are in filetype without mappings - set_dial_group("default") + if not is_current_buffer_has_group then + set_dial_group("default") + end end, }