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
4.99k stars 160 forks source link

bug: accepting spell suggestion replaces whole word even with `spelloptions+=camel` #517

Closed llllvvuu closed 3 weeks ago

llllvvuu commented 10 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-1088+g6b5f44817

Operating system/version

MacOS 13.4.1

Describe the bug

  1. which-key spell suggest always shows suggestions for the first misspelled word in the word, even if your cursor is on the last word
    • native spell suggest will instead show no suggestions for "MySpellledWordd" when hovered over "My", "Spelled" when hovered over "Spellled", and "Word" when hovered over "Wordd". which-key will always show suggestions for "Spellled"
    • This behavior difference is actually fine IMO.
  2. (the problem) when you accept the spell suggest, it replaces the entire word e.g. "MySpellledWordd" -> "Spelled". Native spell-suggest behaves correctly.

Steps To Reproduce

  1. nvim -u spell.lua
  2. Type in "MySpellledWordd" and use z= on each word.

Expected Behavior

Should match native spell suggest.

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", lazy = false },
  { "folke/which-key.nvim", event = "VeryLazy", config = true },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- vim.cmd.colorscheme("tokyonight")
-- add anything else here

vim.opt.spelllang = 'en_us'
vim.opt.spell = true
vim.opt.spelloptions:append({ "camel" })
github-actions[bot] commented 1 month ago

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.