Skip to content

Commit 04b4820

Browse files
committed
feat: add spell checker for both English
the plugin `spellwarn` was added, and set to support English, the flake was also update to include the new plugin.
1 parent 836c471 commit 04b4820

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
66
flake-utils.url = "github:numtide/flake-utils";
77
};
8-
98
outputs = {
109
self,
1110
nixpkgs,
@@ -208,6 +207,10 @@
208207
url = "github:folke/snacks.nvim";
209208
flake = false;
210209
};
210+
"spellwarn.nvim" = {
211+
url = "github:ravibrock/spellwarn.nvim";
212+
flake = false;
213+
};
211214
"which-key.nvim" = {
212215
url = "github:folke/which-key.nvim";
213216
flake = false;

lua/plugins/spellwarn.lua

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--[[
2+
-- Spell checker plugin set for English
3+
--
4+
-- Usage:
5+
-- ]s -> jump to next misspelled word
6+
-- [s -> jump to previous misspelled word
7+
-- z= -> show spelling suggestions
8+
-- zg -> add word to dictionary
9+
-- zw -> mark word as wrong
10+
-- ]]
11+
12+
local default_opts = {
13+
event = { -- event(s) to refresh diagnostics on
14+
"CursorHold",
15+
"InsertLeave",
16+
"TextChanged",
17+
"TextChangedI",
18+
"TextChangedP",
19+
},
20+
enable = true, -- enable diagnostics on startup
21+
ft_config = { -- spellcheck method: "cursor", "iter", or boolean
22+
alpha = false,
23+
help = false,
24+
lazy = false,
25+
lspinfo = false,
26+
mason = false,
27+
},
28+
ft_default = true, -- default option for unspecified file types
29+
max_file_size = nil, -- maximum file size to check in lines (nil for no limit)
30+
severity = { -- severity for each spelling error type (false to disable diagnostics for that type)
31+
spellbad = "WARN",
32+
spellcap = "HINT",
33+
spelllocal = "HINT",
34+
spellrare = "INFO",
35+
},
36+
suggest = false, -- show spelling suggestions in diagnostic message (works best with window-style message)
37+
num_suggest = 3, -- number of spelling suggestions shown in diagnostic message
38+
prefix = "possible misspelling(s): ", -- prefix for each diagnostic message
39+
diagnostic_opts = { severity_sort = true }, -- options for diagnostic display
40+
}
41+
42+
local function config()
43+
vim.opt.spell = true
44+
vim.opt.spelllang = { "en_us" }
45+
46+
require("spellwarn").setup(default_opts)
47+
end
48+
49+
return {
50+
"ravibrock/spellwarn.nvim",
51+
lazy = false,
52+
priority = 1500,
53+
config = config,
54+
}

0 commit comments

Comments
 (0)