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: Issues using with `tversteeg/registers.nvim` and `tpope/vim-surround` after v3 upgrade #655

Closed Frederick888 closed 1 month ago

Frederick888 commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

Arch Linux (rolling)

Describe the bug

After upgrading to v3, when I do e.g. VS{, the surrounded text is replaced by my 0 register.

Steps To Reproduce

  1. Yank some random line
  2. On another line, do VS{

Expected Behavior

The line is surrounded by {}, no other changes.

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.
- 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
- WARNING In mode n, <yS> overlaps with <ySs>, <ySS>:

- WARNING In mode n, <ys> overlaps with <yss>:

- 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.1.0
on_key: j
on_key: y
ModeChanged(n:no)
State(start): { "Mode(o)", "Node()", { update = true } }
  getchar
  on_key: y
  got: y
  reattach: { "", "o" }
  feedkeys: { "Mode(o)", "y" }
on_key: y
ModeChanged(no:n)
on_key: k
on_key: V
ModeChanged(n:V)
State(start): { "Mode(x)", "Node()", { update = true } }
  getchar
  on_key: S
  got: S
  reattach: { "S", "x" }
  feedkeys: { "Mode(x)", "S" }
on_key: S
ModeChanged(V:n)
ModeChanged(n:c)
ModeChanged(c:n)
on_key: {
ModeChanged(n:V)
State(start): { "Mode(x)", "Node()", { update = true } }
  getchar
  got: "
  reattach: { '"', "x" }
  feedkeys: { "Mode(x)", '"' }
ModeChanged(V:n)
ModeChanged(n:no)
ModeChanged(no:n)
on_key: :
ModeChanged(n:c)
on_key: q
on_key: !
on_key: <CR>
ModeChanged(c:n)

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)

vim.opt.timeoutlen = 1000

-- install plugins
local plugins = {
  'folke/tokyonight.nvim',
  -- add any other plugins here
  {
    'folke/which-key.nvim',
    event = 'VeryLazy',
    opts = {
      plugins = {
        registers = false,
      },
      debug = true,
    },
  },
  { 'tpope/vim-surround' },
  {
    'tversteeg/registers.nvim',
    opts = {},
    config = function(opts)
      local registers = require('registers')
      registers.setup(opts)
    end,
  },
}
require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

vim.cmd.colorscheme('tokyonight')
-- add anything else here
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here