diff --git a/lazy-lock.json b/lazy-lock.json index c79d67c..bc026d4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -63,6 +63,7 @@ "ripgrep": { "branch": "master", "commit": "041544853c86dde91c49983e5ddd0aa799bd2831" }, "ros.nvim": { "branch": "dev", "commit": "494635f02b6e6601e739e0bbf6f50d3886ad7e30" }, "schemastore.nvim": { "branch": "main", "commit": "357fe900baae09e1a3fcef913e49733d05d1f888" }, + "spell.nvim": { "branch": "dev", "commit": "3c9bb25d9d4042f0e48289998616fdae03e689b4" }, "sqlite.lua": { "branch": "master", "commit": "b487fcc8937b683942a1f7d9662fcf50ca5acd58" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "c261d903a78c2cda47a5e44488621f10f9dd7fcf" }, "telescope-vim-bookmarks.nvim": { "branch": "main", "commit": "92498cbf7c127dea37c3d27117b60dd7ab9baef4" }, diff --git a/lua/user/conf/init.lua b/lua/user/conf/init.lua index db476c8..6610669 100644 --- a/lua/user/conf/init.lua +++ b/lua/user/conf/init.lua @@ -744,6 +744,24 @@ return { end, }, + -- 单词拼写检查 + { + "minhanghuang/spell.nvim", + event = "VeryLazy", + config = function() + require("user.conf.spell") + end, + }, + -- -- dev单词拼写检查 + -- { + -- dir = "/Users/cox/work/code/github/spell.nvim", -- 本地repo绝对路径 + -- name = "nvim-spell", -- 可选,便于识别 + -- event = "VeryLazy", + -- config = function() + -- require("user.conf.spell") + -- end, + -- }, + -- 翻译 { "voldikss/vim-translator", diff --git a/lua/user/conf/spell.lua b/lua/user/conf/spell.lua new file mode 100644 index 0000000..5073ae7 --- /dev/null +++ b/lua/user/conf/spell.lua @@ -0,0 +1,11 @@ +local has_spell, spell = pcall(require, "nvim-spell") +if not has_spell then + vim.notify("nvim-spell not found!") + return +end + +spell.setup({ + enabled = true, + spellfile = vim.fn.stdpath('config') .. '/spell/custom.en.utf-8.add', + spelllang = { "en_us,cjk" }, +}) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index a55297a..f29b9f2 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -225,3 +225,10 @@ keymap("n", "", "(SmoothieDownwards)", { silent = true }) -- 翻译 keymap("n", "", "TranslateW", { silent = true }) keymap("v", "", "TranslateWV", { silent = true }) + +-- 单词拼写校验 +keymap("n", "zs", ":SpellSuggest", { silent = true }) +keymap("n", "zg", ":SpellAdd", { silent = true }) +keymap("n", "zn", ":SpellNext", { silent = true }) +keymap("n", "zp", ":SpellPrev", { silent = true }) +keymap("n", "ze", ":SpellTogglePlugin", { silent = true }) diff --git a/spell/custom.en.utf-8.add b/spell/custom.en.utf-8.add new file mode 100644 index 0000000..743f410 --- /dev/null +++ b/spell/custom.en.utf-8.add @@ -0,0 +1,11 @@ +leveldb +bytewise +comparator +dev +dir +VeryLazy +config +conf +nvim +github +keymap diff --git a/spell/custom.en.utf-8.add.spl b/spell/custom.en.utf-8.add.spl new file mode 100644 index 0000000..e77db6e Binary files /dev/null and b/spell/custom.en.utf-8.add.spl differ