From 7a621bf5a48038817c6ec394d703f14e6d0df7d3 Mon Sep 17 00:00:00 2001 From: monaqa Date: Mon, 10 Jul 2023 22:20:18 +0900 Subject: [PATCH] fix: apply on_filetype in VISUAL mode inc/dec --- lua/dial/command.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/dial/command.lua b/lua/dial/command.lua index dcdd620..03e3b55 100644 --- a/lua/dial/command.lua +++ b/lua/dial/command.lua @@ -41,12 +41,17 @@ end ---Select the most appropriate augend from given augend group (in VISUAL mode). ---@param group_name? string function M.select_augend_visual(group_name) - if group_name == nil and vim.v.register == "=" then + local augends + if group_name ~= nil then + augends = config.augends.group[group_name] + elseif vim.v.register == "=" then group_name = vim.fn.getreg("=", 1) + augends = config.augends.group[group_name] + elseif config.augends.filetype[vim.bo.filetype] ~= nil then + augends = config.augends.filetype[vim.bo.filetype] else - group_name = util.unwrap_or(group_name, "default") + augends = config.augends.group["default"] end - local augends = config.augends.group[group_name] if augends == nil then error(("undefined augend group name: %s"):format(group_name)) end