💾 Archived View for gemini.hitchhiker-linux.org › gemlog › spell_checking_in_neovim.gmi captured on 2023-05-24 at 17:40:33. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2023-06-14)

-=-=-=-=-=-=-

Spell checking in NeoVim

2023-05-21

I had an email reply to one of my posts this morning which pointed out a spelling error. Well, there was more to the reply, but for the sake of this post that's the important bit. Anyway, what's funny is that I was just last night looking at the possibility of adding spellcheck to my NeoVim configuration.

It turns out that NeoVim has a spell checker built in as of version 0.8. That's fantastic. You can turn it on with the command `:set spell`, or if you are using a language other than en_US `:set spelllang=<LANG>` where <LANG> would be your language code. But I really like having things like this mapped to an easy to remember keybind whenever possible, so I wanted to be able to toggle it on and off using `<leader>sc`. Well, that was pretty easy as well with the following snippet in init.lua.

-- Toggle spellcheck
local function toggle_spell_check()
    vim.opt.spell = not(vim.opt.spell:get())
end
vim.keymap.set('n', '<leader>sc', toggle_spell_check, {noremap=true})

I love having lua available in NeoVim.

Tags for this page

neovim

workflow

lua

Home

All posts

All content for this site is released under the CC BY-SA license.

© 2023 by JeanG3nie

Finger

Contact