Skip to content

Commit

Permalink
fix: apply on_filetype in VISUAL mode inc/dec
Browse files Browse the repository at this point in the history
  • Loading branch information
monaqa committed Jul 10, 2023
1 parent 6fc86a5 commit 7a621bf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lua/dial/command.lua
Expand Up @@ -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
Expand Down

0 comments on commit 7a621bf

Please sign in to comment.