nvim: Improve auto spellfix mapping

If the cursor was on the very first letter of a word it would fix
the misspelled word instead - now it should stay and fix the
current word under cursor instead.
This commit is contained in:
Marty Oehme 2024-03-01 10:33:36 +01:00
parent 69da2610f4
commit fcaaba9e8d
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 3 additions and 2 deletions

View file

@ -9,3 +9,4 @@ for _, source in ipairs({
vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault)
end end
end end

View file

@ -132,5 +132,5 @@ map("n", "<localleader>ZE", ":setlocal spell! spelllang=en_us<cr>", { desc = "To
map("n", "<localleader>ZB", ":setlocal spell! spelllang=en_gb<cr>", { desc = "Toggle EN_GB spellcheck" }) map("n", "<localleader>ZB", ":setlocal spell! spelllang=en_gb<cr>", { desc = "Toggle EN_GB spellcheck" })
map("n", "<localleader>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "Toggle DE_DE spellcheck" }) map("n", "<localleader>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "Toggle DE_DE spellcheck" })
-- undo last spelling mistake from insert and normal mode -- undo last spelling mistake from insert and normal mode
map("i", "<c-z>", "<C-G>u<Esc>[s1z=`]a<C-G>u") map("i", "<c-z>", "<C-G>u<Esc>e[s1z=`]a<C-G>u")
map("n", "<localleader>z", "ms[s1z=`s", { desc = "Fix last spell error" }) map("n", "<localleader>z", "mse[s1z=`s", { desc = "Fix last spell error" })