From fcae01ad4056fa4b000ad7ed15ee886cb78152c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sun, 7 Jan 2024 01:45:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nvim):=20cspell,=20typos=20a?= =?UTF-8?q?nd=20white=5Fspace=20are=20now=20dynamically=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extras/formatting/trim_whitespace.lua | 10 +++--- .../lua/plugins/extras/linting/cspell.lua | 32 +++++++++---------- .../nvim/lua/plugins/extras/linting/typos.lua | 10 +++--- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.config/nvim/lua/plugins/extras/formatting/trim_whitespace.lua b/.config/nvim/lua/plugins/extras/formatting/trim_whitespace.lua index 8c941cc9..6e754e0e 100644 --- a/.config/nvim/lua/plugins/extras/formatting/trim_whitespace.lua +++ b/.config/nvim/lua/plugins/extras/formatting/trim_whitespace.lua @@ -1,8 +1,8 @@ return { "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - ["_"] = { "trim_whitespace" }, - }, - }, + opts = function(_, opts) + opts.formatters_by_ft["_"] = opts.formatters_by_ft["_"] or {} + table.insert(opts.formatters_by_ft["_"], "trim_whitespace") + return opts + end, } diff --git a/.config/nvim/lua/plugins/extras/linting/cspell.lua b/.config/nvim/lua/plugins/extras/linting/cspell.lua index 71e905cf..70b03766 100644 --- a/.config/nvim/lua/plugins/extras/linting/cspell.lua +++ b/.config/nvim/lua/plugins/extras/linting/cspell.lua @@ -8,23 +8,23 @@ return { }, { "mfussenegger/nvim-lint", - opts = { - linters_by_ft = { - ["*"] = { "cspell" }, - }, - linters = { - cspell = { - condition = function(ctx) - if vim.fs.find({ "cspell.json" }, { path = ctx.filename, upward = true })[1] then + 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 true + else + return false + end + end, + } + + return opts + end, }, } diff --git a/.config/nvim/lua/plugins/extras/linting/typos.lua b/.config/nvim/lua/plugins/extras/linting/typos.lua index e8170f1c..cfc1ec6a 100644 --- a/.config/nvim/lua/plugins/extras/linting/typos.lua +++ b/.config/nvim/lua/plugins/extras/linting/typos.lua @@ -8,10 +8,10 @@ return { }, { "mfussenegger/nvim-lint", - opts = { - linters_by_ft = { - ["*"] = { "typos" }, - }, - }, + opts = function(_, opts) + opts.linters_by_ft["*"] = opts.linters_by_ft["*"] or {} + table.insert(opts.linters_by_ft["*"], "typos") + return opts + end, }, }