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

bug: pasted text differs from deleted text when count argument is given

Open girishji opened this issue 2 years ago • 1 comments

Did you check docs and existing issues?

  • [X] I have read all the which-key.nvim docs
  • [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.8.3

Operating system/version

macos 12.6.3

Describe the bug

which-key changes the contents of register '-' and '"', so that pasted text differ from deleted text.

workaround: set 'registers = false' in options and problem goes away.

Lastly, to reproduce, add "require("which-key").setup()" to repro.lua (below).

Steps To Reproduce

  1. say you have text as follows:
one two three four
  1. put the cursor at the beginning of line and do this:
c2w<C-R>-
  1. you get
2one two three four

The "2" before the 'one' is inserted automatically by which-key. Text should not change after deleting and pasting.

Expected Behavior

described above

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",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
require("which-key").setup()

girishji avatar Mar 26 '23 18:03 girishji

Bug appears only when in insert mode and <C-R> is used to paste the " or - register. The count argument passed to c command gets prepended when register contents are pasted.

girishji avatar Mar 27 '23 10:03 girishji

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[bot] avatar Jul 06 '24 01:07 github-actions[bot]