feat(vim): override the cspell linter for better integration

This will now use a custom config file `$HOME/.cspell.json` that will
use a custom dictionary for my own words. This will have things like my
name so cspell stop telling me I spelt my name wrong.

Will also add the `--language-id` flag with the current filetype, so it
can match language specific words.
This commit is contained in:
Ade Attwood 2022-11-15 20:08:40 +00:00
parent 0506dd4842
commit e93f9864b5

View file

@ -37,6 +37,30 @@ lint.linters.psalm = {
end
}
lint.linters.cspell = {
cmd = "cspell",
stdin = true,
args = {
"lint",
"--no-color",
"--no-progress",
"--no-summary",
"--config=" .. os.getenv("HOME") .. "/.cspell.json",
function()
local file_type = vim.api.nvim_buf_get_option(0, "filetype")
return "--language-id=" .. file_type
end,
"--",
"stdin",
},
stream = "stdout",
parser = require("lint.parser").from_errorformat("/:%l:%c - %m", {
source = "cspell",
severity = vim.diagnostic.severity.INFO,
}),
}
lint.linters_by_ft = {
php = {'phpcs'},
typescript = {'eslint'},