51 lines
1.6 KiB
Lua
51 lines
1.6 KiB
Lua
return {
|
|
-- Ensure ltex-ls is installed via Mason
|
|
{
|
|
"williamboman/mason.nvim",
|
|
opts = function(_, opts)
|
|
opts.ensure_installed = opts.ensure_installed or {}
|
|
vim.list_extend(opts.ensure_installed, { "ltex-ls" })
|
|
end,
|
|
},
|
|
|
|
-- Configure LTeX for grammar/style/spelling in LaTeX/Markdown
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = {
|
|
servers = {
|
|
ltex = {
|
|
settings = {
|
|
ltex = {
|
|
-- Change to "en-GB", "de-DE", etc. if needed
|
|
language = "en-US",
|
|
-- More thorough checks (slower but better for final drafts)
|
|
additionalRules = {
|
|
enablePickyRules = true,
|
|
},
|
|
-- Load a shared dictionary of domain/academic words
|
|
dictionary = {
|
|
["en-US"] = (function()
|
|
local words = {}
|
|
local dict_file = vim.fn.expand("~/.config/nvim/spell/ltex.dictionary.en-US.txt")
|
|
local ok, lines = pcall(vim.fn.readfile, dict_file)
|
|
if ok and lines then
|
|
for _, word in ipairs(lines) do
|
|
word = word:gsub("^%s+", ""):gsub("%s+$", "")
|
|
if word ~= "" and not word:match("^#") then
|
|
table.insert(words, word)
|
|
end
|
|
end
|
|
end
|
|
return words
|
|
end)(),
|
|
},
|
|
-- Check as you type; switch to "save" if it feels too slow
|
|
checkFrequency = "edit",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|