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

bug: mismatched brackets in replace.desc regex for <Plug>(function name) #842

Closed
4 tasks done
dlyongemallo opened this issue Sep 6, 2024 · 2 comments
Closed
4 tasks done
Labels
bug Something isn't working stale

Comments

@dlyongemallo
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0

Operating system/version

Ubuntu 22.04

Describe the bug

When using which-key with a plugin that display its desc as <Plug>(function name), the default config uses a regex <Plug>%(?(.*)%)? to match the (optional) brackets, but because the wildcard is greedy, the right bracket is captured. This results in the right bracket being displayed as though it were part of the description.

Steps To Reproduce

  1. Use WhichKey along with a plugin that uses the <Plug>(function name) format for keymap descriptions, such as mg979/vim-visual-multi.
  2. Open neovim and run :WhichKey.

Expected Behavior

Expected: The keymaps have descriptions such as VM-Find-Under.

Actual: The keymaps have descriptions such as VM-Find-Under).

Health

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- WARNING |mini.icons| is not installed
- WARNING |nvim-web-devicons| is not installed
- WARNING Keymap icon support will be limited.

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found

Log

Debug Started for v3.13.2
{
  branch = "main",
  commit = "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0"
}
new Mode(n:1)
Trigger(add) Mode(n:1) ` ' " g` g' z= \ <C-W> ] [ g z
on_key: :
ModeChanged(n:c)
  new Mode(c:1)
  Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: W
on_key: h
on_key: i
on_key: c
on_key: h
on_key: K
on_key: e
on_key: y
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) <C-W> ] [ ` z ' " g` g' z= g \
State(start): Mode(n:0) Node() { delay = 0, keys = "", mode = "n", waited = 1000 }
  update Mode(n:1)
  continue:  Mode(n:1)
  getchar
  Trigger(add) Mode(n:1) ` ' " g` g' z= \ <C-W> ] [ g z
  on_key: :
  got: :
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) <C-W> ] [ ` z ' " g` g' z= g \
  feedkeys: Mode(n:1) :
on_key: :
ModeChanged(n:c)
  Safe(true)
Trigger(add) Mode(n:1) ` ' " g` g' z= \ <C-W> ] [ g z
on_key: q
on_key: a
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) <C-W> ] [ ` z ' " g` g' z= g \
Trigger(add) Mode(n:1) ` ' " g` g' z= \ <C-W> ] [ g z

Repro

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 = {} },
    { "mg979/vim-visual-multi" },
  },
})
@dlyongemallo dlyongemallo added the bug Something isn't working label Sep 6, 2024
Copy link
Contributor

github-actions bot commented Oct 7, 2024

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.

@github-actions github-actions bot added the stale label Oct 7, 2024
Copy link
Contributor

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

1 participant