Skip to content

Conversation

@ANGkeith
Copy link

@ANGkeith ANGkeith commented Nov 10, 2024

Description

# minimal.lua
vim.g.mapleader = " "

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/which-key.nvim", opts = {} },
    -- add any other plugins here
  },
})

local wk = require("which-key")

wk.add({
  {
    "<leader>mq",
    function()
      print("i am mq")
    end,
  },
  {
    "<leader>mw",
    function()
      print("i am mw")
    end,
  },
  {
    "<leader>mj",
    "j",
  },
  {
    "<leader>m",
    function()
      vim.notify("hail hydra")
      require("which-key").show({
        keys = "<leader>m",
        loop = true, -- this will keep the popup open until you hit <esc>
      })
    end,
  },
})

Before this pr, given the above config,

there's currently two problem:

  1. issuing the key <leader>mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...., we will falsly get the recusion warning
  2. issuing the key <leader>mh, we end up in a recursion

Related Issue(s)

@ANGkeith ANGkeith marked this pull request as ready for review November 10, 2024 14:31
@ANGkeith ANGkeith force-pushed the main branch 4 times, most recently from bb70c1b to e53faf7 Compare November 13, 2024 04:16
end)

if M.recursion > 50 then
recursion_threshold = M.hydra_mode and 200 or 50
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

increasing the threshold for hydra mode to fix the problem # 1 as described in the pr

@github-actions
Copy link
Contributor

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale This issue or PR has been inactive for a while label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This issue or PR has been inactive for a while

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: recursion when settings up hydra?

1 participant