🐛 fix(nvim): cspell, typos and white_space are now dynamically added
This commit is contained in:
parent
a5b271fec2
commit
fcae01ad40
3 changed files with 26 additions and 26 deletions
|
@ -1,8 +1,8 @@
|
||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
opts = {
|
opts = function(_, opts)
|
||||||
formatters_by_ft = {
|
opts.formatters_by_ft["_"] = opts.formatters_by_ft["_"] or {}
|
||||||
["_"] = { "trim_whitespace" },
|
table.insert(opts.formatters_by_ft["_"], "trim_whitespace")
|
||||||
},
|
return opts
|
||||||
},
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,23 +8,23 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
opts = {
|
opts = function(_, opts)
|
||||||
linters_by_ft = {
|
opts.linters_by_ft["*"] = opts.linters_by_ft["*"] or {}
|
||||||
["*"] = { "cspell" },
|
table.insert(opts.linters_by_ft["*"], "cspell")
|
||||||
},
|
|
||||||
linters = {
|
opts.linters.cspell = {
|
||||||
cspell = {
|
condition = function(ctx)
|
||||||
condition = function(ctx)
|
if vim.fs.find({ "cspell.json" }, { path = ctx.filename, upward = true })[1] then
|
||||||
if vim.fs.find({ "cspell.json" }, { path = ctx.filename, upward = true })[1] then
|
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
vim.keymap.set("n", "<leader>!", function() require("util.cspell").addWordToDictionary() end, { desc = "Add Word to Dictionary", silent = true })
|
vim.keymap.set("n", "<leader>!", function() require("util.cspell").addWordToDictionary() end, { desc = "Add Word to Dictionary", silent = true })
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
}
|
||||||
},
|
|
||||||
},
|
return opts
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
opts = {
|
opts = function(_, opts)
|
||||||
linters_by_ft = {
|
opts.linters_by_ft["*"] = opts.linters_by_ft["*"] or {}
|
||||||
["*"] = { "typos" },
|
table.insert(opts.linters_by_ft["*"], "typos")
|
||||||
},
|
return opts
|
||||||
},
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue