add in ltex-ls for grammar and enable spell

This commit is contained in:
DanRoscigno 2023-06-06 14:11:50 -04:00
parent e090db63c1
commit 80a6040b84
3 changed files with 281 additions and 0 deletions

View file

@ -72,6 +72,9 @@ require('lazy').setup({
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- Grammar checking
'vigoux/ltex-ls.nvim',
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
{
@ -513,6 +516,60 @@ cmp.setup {
},
}
-- I want spell checking on in markdown etc.
vim.api.nvim_create_augroup("spellcheck", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = "spellcheck",
pattern = { "gitcommit", "markdown", "mdx" },
command = "setlocal spell",
})
-- configure ltex-ls
require 'ltex-ls'.setup {
on_attach = on_attach,
capabilities = capabilities,
use_spellfile = false,
filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" },
settings = {
ltex = {
enabled = { "latex", "tex", "bib", "markdown", },
language = "en",
diagnosticSeverity = "information",
sentenceCacheSize = 2000,
additionalRules = {
enablePickyRules = true,
motherTongue = "en",
},
disabledRules = {
en = { "EN_QUOTES" }
},
dictionary = (function()
-- For dictionary, search for files in the runtime to have
-- and include them as externals the format for them is
-- dict/{LANG}.txt
--
-- Also add dict/default.txt to all of them
local files = {}
for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do
local lang = vim.fn.fnamemodify(file, ":t:r")
local fullpath = vim.fs.normalize(file, ":p")
files[lang] = { ":" .. fullpath }
end
if files.default then
for lang, _ in pairs(files) do
if lang ~= "default" then
vim.list_extend(files[lang], files.default)
end
end
files.default = nil
end
return files
end)(),
},
},
}
-- Confgiure the way that diagnostics look
local diagconfig = {