Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<C-a> somehow conflicts with mini.clue #94

Closed
simonmandlik opened this issue Jul 14, 2024 · 4 comments · Fixed by #95
Closed

<C-a> somehow conflicts with mini.clue #94

simonmandlik opened this issue Jul 14, 2024 · 4 comments · Fixed by #95
Labels
bug Something isn't working

Comments

@simonmandlik
Copy link

simonmandlik commented Jul 14, 2024

I am using dial.nvim alongside mini.clue and have recently noticed that <C-a> in visual mode doesn't work. In normal mode <C-a> works, and <C-x> (and also g* variants) work in both modes.

I have also opened similar issue with mini.clue: echasnovski/mini.nvim#1059

MWE:

local root = vim.fn.fnamemodify("./.repro", ":p")
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

local plugins = {
    "monaqa/dial.nvim",
    {
        "echasnovski/mini.clue",
        opts = function()
            return {
                triggers = {
                    { mode = "n", keys = "g" },
                    { mode = "v", keys = "g" }
                }
            }
        end
    }
}

require("lazy").setup(plugins, { root = root .. "/plugins", })

vim.keymap.set("n", "<C-a>", function()
    print("n <C-a>")
    require("dial.map").manipulate("increment", "normal")
end)
vim.keymap.set("v", "<C-a>", function()
    print("v <C-a>")
    require("dial.map").manipulate("increment", "visual")
end)
vim.keymap.set("n", "<C-x>", function()
    print("n <C-x>")
    require("dial.map").manipulate("decrement", "normal")
end)
vim.keymap.set("v", "<C-x>", function()
    print("v <C-x>")
    require("dial.map").manipulate("decrement", "visual")
end)
@monaqa
Copy link
Owner

monaqa commented Jul 15, 2024

Reproduced the problem, and it helped me to determine the cause. Thanks for the report.

dial.nvim uses the command g@ internally, and the definition of g@ was changed inside mini.clue, causing the conflict.
We don't know why g@ doesn't work as expected (you'll have to ask mini.clue to figure it out).
However, at least using the default g@ on dial.nvim should solve the problem, so I'll try to fix it that way.

@monaqa
Copy link
Owner

monaqa commented Jul 15, 2024

@simonmandlik #95 should fix the problem. Could you try the following configuration, update the plugin (with :Lazy + U), and check whether v_CTRL-A works? (it worked in my environment)

 local plugins = {
-    "monaqa/dial.nvim",
+    { "monaqa/dial.nvim", branch = "fix-cmd_normal_bang" },
     {
         "echasnovski/mini.clue",
         opts = function()
             return {
                 triggers = {
                     { mode = "n", keys = "g" },
                     { mode = "v", keys = "g" },
                 },
             }
         end,
     },
 }

@echasnovski
Copy link

Thanks for the quick fix!

Preferring :normal! ... instead of :normal ... for executing some built-in functionality is indeed usually a safer way. Not the OP, but for me it indeed seems to fix it.

@simonmandlik
Copy link
Author

Yes, I can confirm the fix works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants