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
4.99k stars 160 forks source link

bug: visual mode keymap `<CR>` not shown in which-key #540

Closed tummetott closed 3 weeks ago

tummetott commented 8 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1696795921

Operating system/version

MacOs 13.4.1

Describe the bug

When registering <CR> as keymap in visual mode, the keymap description is not shown in which-key

Steps To Reproduce

  1. Run the repro.lua: nvim --clean -u repro.lua
  2. Type v and wait for the keymap description window to show

Expected Behavior

Keymap description for <CR> is shown in the which-key window

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
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)

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    { 'folke/which-key.nvim', opts = {} },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")

require 'which-key'.register({
    ['<CR>'] = { function() print('hallo') end, 'some description' },
}, { mode = 'v' })
ddkasa commented 7 months ago

I am facing the same issue trying to register visual/select keymap. Has this issue been resolved by any chance?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.