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.43k stars 176 forks source link

bug: New updates breaking nvim-surround and similar surround manipulation plugins #837

Closed umutondersu closed 4 weeks ago

umutondersu commented 2 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.10.1

Operating system/version

Pop!_OS 22.04 LTS

Describe the bug

With the new versions of this plugin, plugins used for surround manipulation such as nvim-surround and mini.surround do not function. They can still be used by searching the keymaps with telescope and choosing the specific keymap however normally they don't work at all and do not show in which-key. The last commit number i was using before this error occurred is 4433e5ec9a507e5097571ed55c02ea9658fb268a. However I am not sure which update caused this issue.

Steps To Reproduce

  1. Have the last which-key and nvim-surround plugins.
  2. Try using nvim-surround

Expected Behavior

I expected nvim-surround to function.

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 ~
- OK |mini.icons| is installed
- OK |nvim-web-devicons| is installed

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
- WARNING In mode `n`, <ys> overlaps with <yss>:
  - <ys>: Add a surrounding pair around a motion (normal mode)
  - <yss>: Add a surrounding pair around the current line (normal mode)
- WARNING In mode `n`, <yS> overlaps with <ySS>:
  - <yS>: Add a surrounding pair around a motion, on new lines (normal mode)
  - <ySS>: Add a surrounding pair around the current line, on new lines (normal mode)
- 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

No response

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 = {} },
    {
    "kylechui/nvim-surround",
    version = "*",
    event = "VeryLazy",
    config = true,
},
  },
})
baroldgene commented 1 month ago

I'm experiencing the same with markdown.nvim. I was able to work around it by manually defining all the possible keymaps, but it's hacky and a bit ugly. Curious if there's a better way to define a keymap (description only, no RHS) where part of the middle of the keymap is a movement. For example I currently have it set up so that my hotkey to bold something in markdown is <leader>me%b where the % is a movement key. This can be one character (e.g. w) or multiple (e.g. iw) and I'm not sure how to define this in which-key other than to manually define both, which is essentially what I did, albeit by iterating over a list to create the mappings.

definitelynotrazu commented 1 month ago

Same here with mini.surround

Blechlawine commented 4 weeks ago

I had the same problem with mini.surround, but i got it somewhat working again by setting vim.o.timeout = false

umutondersu commented 4 weeks ago

vim.o.timeout = false

This has solve the problem for me as well! Thank you very much!