folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

bug: Crash following 3.0 update #631

Closed etrobert closed 1 month ago

etrobert commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.9.5

Operating system/version

MacOS 14.5

Describe the bug

After updating to which-key 3.0, the plugin crashes when NeoVim is opened with the following error.

Checkhealth does not report anything worrisome.

The which-key UI does not appear.

image image image

Steps To Reproduce

nvim -u repro.lua

Expected Behavior

The plugin does not crash.

The which-key UI appears

Repro

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
    local lazyrepo = "https://github.com/folke/lazy.nvim.git"
    local out = vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "--branch=stable",
        lazyrepo,
        lazypath,
    })
    if vim.v.shell_error ~= 0 then
        vim.api.nvim_echo({
            { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
            { out, "WarningMsg" },
            { "\nPress any key to exit..." },
        }, true, {})
        vim.fn.getchar()
        os.exit(1)
    end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
    spec = {
        {
            "folke/which-key.nvim",
            event = "VeryLazy",
            init = function()
                vim.o.timeout = true
                vim.o.timeoutlen = 300
            end,
            opts = function()
                local wk = require("which-key")

                wk.register({
                    pv = { vim.cmd.Ex, "File Explorer" },
                })

                return {}
            end,
        },
    },
})
AmirGhiassian commented 1 month ago

Fixed in version 3.10, currently waiting on this PR to be approved

etrobert commented 1 month ago

Thank you! 💃