summaryrefslogtreecommitdiffstats
path: root/.config/nvim/plugin/50-spell.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-04 08:44:50 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-06 16:43:16 +0200
commit0bc002288b984d8ec8123c135456570c78a22da3 (patch)
tree020ed3f6a7f28a081687a3e46ea190e3aa724f7c /.config/nvim/plugin/50-spell.lua
downloaddotfiles-0bc002288b984d8ec8123c135456570c78a22da3.tar.gz
dotfiles-0bc002288b984d8ec8123c135456570c78a22da3.zip
feat: initial setup
- `dotfiles` (this project's CLI) - foot configuration - tmux configuration - bash configuration - nvim (as a git submodule) + configuration - ranger configuration - fzf configuration - KDE global shortcuts - Other miscellaneous dependencies
Diffstat (limited to '.config/nvim/plugin/50-spell.lua')
-rw-r--r--.config/nvim/plugin/50-spell.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/.config/nvim/plugin/50-spell.lua b/.config/nvim/plugin/50-spell.lua
new file mode 100644
index 0000000..56d4c5f
--- /dev/null
+++ b/.config/nvim/plugin/50-spell.lua
@@ -0,0 +1,34 @@
+--
+-- Spell check plugin
+--
+
+local function toggle_spell()
+ vim.o.spell = not vim.o.spell
+end
+
+local function set_spell_en()
+ vim.opt.spelllang = { "en_us" }
+end
+
+local function set_spell_fr()
+ vim.opt.spelllang = { "fr" }
+end
+
+local function set_spell_en_fr()
+ vim.opt.spelllang = { "en_us", "fr" }
+end
+
+vim.opt.spelllang = "en_us" -- Initial spell language
+vim.opt.spellfile = { -- Spellfiles for zg, zw, z=, etc
+ "/home/tvanbesi/.config/nvim/spell/en.utf-8.add",
+ "/home/tvanbesi/.config/nvim/spell/fr.utf-8.add",
+}
+
+vim.api.nvim_create_user_command("SpellToggle", toggle_spell, { desc = "Toggle spell checking" })
+vim.api.nvim_create_user_command("SpellSetEn", set_spell_en, { desc = "Set spell language to English" })
+vim.api.nvim_create_user_command("SpellSetFr", set_spell_fr, { desc = "Set spell language to French" })
+vim.api.nvim_create_user_command(
+ "SpellSetEnFr",
+ set_spell_en_fr,
+ { desc = "Set spell languages to English and French" }
+)