which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

bug: Error detected while processing ModeChanged Autocommands

Open bitfoo1 opened this issue 2 years ago • 4 comments

Did you check docs and existing issues?

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

Neovim version (nvim -v)

NVIM v0.9.5

Operating system/version

MacOS 14.5

Describe the bug

Error detected while processing ModeChanged Autocommands for "*": Error executing lua callback: .../share/nvim/lazy/which-key.nvim/lua/which-key/config.lua:38: attempt to call field 'list_contains' (a nil value) stack traceback: .../share/nvim/lazy/which-key.nvim/lua/which-key/config.lua:38: in function 'defer' ...l/share/nvim/lazy/which-key.nvim/lua/which-key/state.lua:115: in function <...l/share/nvim/lazy/which-key.nvim/lua/which-key/state.lua:93>

Steps To Reproduce

  • Installing version >3.8.0 or using main branch
  • Hitting yy to yank line
  • Error popup shows

Expected Behavior

Line gets yanked no error shown.

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
- WARNING |nvim-web-devicons| is not installed

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

checking for overlapping keymaps ~
- WARNING In mode `n`, <sh> overlaps with <shl>, <shn>:
  - <sh>: Highlight surrounding
  - <shl>: Highlight previous surrounding
  - <shn>: Highlight next surrounding
- WARNING In mode `n`, <sr> overlaps with <srl>, <srn>:
  - <sr>: Replace surrounding
  - <srl>: Replace previous surrounding
  - <srn>: Replace next surrounding
- WARNING In mode `n`, <sd> overlaps with <sdl>, <sdn>:
  - <sd>: Delete surrounding
  - <sdl>: Delete previous surrounding
  - <sdn>: Delete next surrounding
- WARNING In mode `n`, <sF> overlaps with <sFl>, <sFn>:
  - <sF>: Find left surrounding
  - <sFl>: Find previous left surrounding
  - <sFn>: Find next left surrounding
- WARNING In mode `n`, <sf> overlaps with <sfl>, <sfn>:
  - <sf>: Find right surrounding
  - <sfl>: Find previous right surrounding
  - <sfn>: Find next right surrounding
- WARNING In mode `n`, <gb> overlaps with <gbc>:
  - <gb>: Comment toggle blockwise
  - <gbc>: Comment toggle current block
- WARNING In mode `n`, <gc> overlaps with <gcA>, <gco>, <gcc>, <gcO>:
  - <gc>: Comment toggle linewise
  - <gcA>: Comment insert end of line
  - <gco>: Comment insert below
  - <gcc>: Comment toggle current line
  - <gcO>: Comment insert above
- WARNING In mode `x`, <i> overlaps with <il>, <in>:
  - <i>: inside
  - <il>: Inside last textobject
  - <in>: Inside next textobject
- WARNING In mode `x`, <a> overlaps with <al>, <an>, <a%>:
  - <a>: around
  - <al>: Around last textobject
  - <an>: Around next textobject
- WARNING In mode `o`, <i> overlaps with <il>, <in>:
  - <i>: inside
  - <il>: Inside last textobject
  - <in>: Inside next textobject
- WARNING In mode `o`, <a> overlaps with <al>, <an>:
  - <a>: around
  - <al>: Around last textobject
  - <an>: Around next textobject
- 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.9.0
new Mode(n:1)
Trigger(add) Mode(n:1) ` ' " z= g' g` z <C-W> ] [ g
State(start): Mode(n:0) Node(z) { keys = "z", waited = 0 }
  update Mode(n:1)
  continue: z Mode(n:1)
  getchar
  got: z
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) z <C-W> ] [ ` ' " z= g g' g`
  feedkeys: Mode(n:1) zz
Trigger(add) Mode(n:1) ` ' " z= g' g` z <C-W> ] [ g
State(start): Mode(n:0) Node(z) { keys = "z", waited = 0 }
  update Mode(n:1)
  continue: z Mode(n:1)
  getchar
  got: z
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) z <C-W> ] [ ` ' " z= g g' g`
  feedkeys: Mode(n:1) zz
Trigger(add) Mode(n:1) ` ' " z= g' g` z <C-W> ] [ g
ModeChanged(n:no)
  new Mode(o:1)
  Safe(true)
  ModeChanged(no:n)
    Safe(true)
  Trigger(add) Mode(o:1) ] [ g
  ModeChanged(n:c)
    new Mode(c:1)
    Safe(true)
  Trigger(add) Mode(c:1) <C-R>
  ModeChanged(c:n)
    Unsafe(command-mode)
    suspend: Mode(n:1)
    Trigger(del) Mode(n:1) z <C-W> ] [ ` ' " z= g g' g`
  Trigger(add) Mode(n:1) ` ' " z= g' g` z <C-W> ] [ g

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 = {} },
    -- add any other plugins here
  },
})

bitfoo1 avatar Jul 18 '24 15:07 bitfoo1

Your Neovim installation is messed up. vim.list_contains has been around for ages...

folke avatar Jul 18 '24 15:07 folke

However, I can reproduce this. Weird. Will check

folke avatar Jul 18 '24 15:07 folke

loosk like I was wrong. It was renamed from tbl_contains to list_contains

folke avatar Jul 18 '24 15:07 folke

Thank you fixing this that fast. 🚀

bitfoo1 avatar Jul 18 '24 17:07 bitfoo1