mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nvim: remove ltex-ls configuration
This commit is contained in:
parent
defe85a17d
commit
8037a95b03
1 changed files with 0 additions and 52 deletions
|
|
@ -155,58 +155,6 @@ for name, config in pairs(servers) do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function string:startswith(start) return self:sub(1, #start) == start end
|
|
||||||
-- Defining Ltex plus separately to opt out of the on_attach, which overrides the tinymist bindings and break format binding
|
|
||||||
require("lspconfig")["ltex_plus"].setup {
|
|
||||||
autostart = false, -- Start manually
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
ltex = {
|
|
||||||
language = "fr-FR",
|
|
||||||
disabledRules = {
|
|
||||||
["fr-FR"] = { "FRENCH_WHITESPACE", "COMMA_PARENTHESIS_WHITESPACE", "UNPAIRED_BRACKETS" },
|
|
||||||
},
|
|
||||||
languageToolHttpServerUri = "http://localhost:8081",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_init = function(client)
|
|
||||||
-- Load dictionary
|
|
||||||
local ltex_dict_path = vim.fs.normalize(vim.fn.stdpath("config") .. "/../ltex_dict")
|
|
||||||
local ltex_dict = {}
|
|
||||||
if vim.uv.fs_stat(ltex_dict_path) then
|
|
||||||
for line in io.lines(ltex_dict_path) do
|
|
||||||
if not string.startswith(line, "#") and line ~= "" then
|
|
||||||
table.insert(ltex_dict, line)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
client.config.settings.ltex.dictionary = {
|
|
||||||
["fr-FR"] = ltex_dict,
|
|
||||||
["en-US"] = ltex_dict,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
on_attach = function(client, bufno)
|
|
||||||
-- Best effort lang detection
|
|
||||||
if vim.bo.ft == "gitcommit" then
|
|
||||||
client.config.settings.ltex.language = "en-US"
|
|
||||||
elseif vim.bo.ft == "typst" or vim.bo.ft == "markdown" or vim.bo.ft == "mail" then
|
|
||||||
local lang_map = {
|
|
||||||
en = "en-US",
|
|
||||||
fr = "fr-FR",
|
|
||||||
}
|
|
||||||
for from, to in pairs(lang_map) do
|
|
||||||
if string.startswith(tostring(vim.bo.spelllang), from) then
|
|
||||||
client.config.settings.ltex.language = to
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufno })
|
|
||||||
local opts = { buffer = bufno }
|
|
||||||
map("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
-- Standalone plugins --
|
-- Standalone plugins --
|
||||||
------------------------
|
------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue