Spellchecking in neovim
This commit is contained in:
parent
654dda08d3
commit
cac651905c
1 changed files with 29 additions and 0 deletions
29
content/gemlog/spell_checking_in_neovim.gmi
Normal file
29
content/gemlog/spell_checking_in_neovim.gmi
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Meta(
|
||||||
|
title: "Spell checking in NeoVim",
|
||||||
|
summary: None,
|
||||||
|
published: Some(Time(
|
||||||
|
year: 2023,
|
||||||
|
month: 5,
|
||||||
|
day: 21,
|
||||||
|
hour: 15,
|
||||||
|
minute: 2,
|
||||||
|
second: 52,
|
||||||
|
)),
|
||||||
|
tags: [
|
||||||
|
"neovim",
|
||||||
|
"workflow",
|
||||||
|
"lua",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
---
|
||||||
|
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.
|
Loading…
Add table
Reference in a new issue