diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index 269e0a3f..fa647e3c 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -33,3 +33,6 @@ go.root_spec = { -- Show last command in the status line o.showcmd = false + +-- Enable spell checking +o.spell = true diff --git a/.config/nvim/lua/plugins/extras/linting/cspell.lua b/.config/nvim/lua/plugins/extras/linting/cspell.lua deleted file mode 100644 index 70b03766..00000000 --- a/.config/nvim/lua/plugins/extras/linting/cspell.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - { - "williamboman/mason.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "cspell" }) - end, - }, - { - "mfussenegger/nvim-lint", - opts = function(_, opts) - opts.linters_by_ft["*"] = opts.linters_by_ft["*"] or {} - table.insert(opts.linters_by_ft["*"], "cspell") - - opts.linters.cspell = { - condition = function(ctx) - if vim.fs.find({ "cspell.json" }, { path = ctx.filename, upward = true })[1] then - -- stylua: ignore - vim.keymap.set("n", "!", function() require("util.cspell").addWordToDictionary() end, { desc = "Add Word to Dictionary", silent = true }) - return true - else - return false - end - end, - } - - return opts - end, - }, -} diff --git a/.config/nvim/lua/util/cspell.lua b/.config/nvim/lua/util/cspell.lua deleted file mode 100644 index e5ea121e..00000000 --- a/.config/nvim/lua/util/cspell.lua +++ /dev/null @@ -1,27 +0,0 @@ -local M = {} - -function M.addWordToDictionary() - local word = vim.fn.expand("") - local dictionary_path = require("lazyvim.util.root").get() .. "/cspell-dictionary.txt" - - -- Append the word to the dictionary file - local file = io.open(dictionary_path, "a") - if file then - -- Detect new line at the end of the file or not - local last_char = file:seek("end", -1) - if last_char ~= nil and last_char ~= "\n" then - word = "\n" .. word - end - - file:write(word .. "") - file:close() - vim.notify("Added word to dictionary", "info", { title = "cSpell" }) - - -- Reload buffer to update the dictionary - vim.cmd("e!") - else - vim.notify("Could not open cSpell dictionary", "error", { title = "cSpell" }) - end -end - -return M diff --git a/.config/nvim/spell/en.utf-8.add b/.config/nvim/spell/en.utf-8.add new file mode 100644 index 00000000..d56b52fd --- /dev/null +++ b/.config/nvim/spell/en.utf-8.add @@ -0,0 +1,4 @@ +repl +EditorConfig +cmd +dir diff --git a/.config/nvim/spell/en.utf-8.add.spl b/.config/nvim/spell/en.utf-8.add.spl new file mode 100644 index 00000000..25317d02 Binary files /dev/null and b/.config/nvim/spell/en.utf-8.add.spl differ