Skip to content

Commit

Permalink
Merge pull request #71 from monaqa/fix-visual_on_filetype
Browse files Browse the repository at this point in the history
fix: apply on_filetype in VISUAL mode inc/dec
  • Loading branch information
monaqa committed Jul 10, 2023
2 parents 6fc86a5 + 7a621bf commit c6657df
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 c6657df

Please sign in to comment.