diff --git a/README.md b/README.md index c52523c..d6b0be4 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,8 @@ If you **don’t have the physical macropad**, the table below shows which keybi | `e2` | Next error | | `e3` | See error message | | `e4` | See list of errors | +| `e5` | Show correction | +| `e` | Stop grammar LSP | | `f1` | Telescope files | | `f2` | Telescope grep | | `f3` | Telescope buffers | diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 550f3bc..be55286 100755 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -245,6 +245,7 @@ clang-tools python311Packages.python-lsp-server lua-language-server + ltex-ls-plus pylint black nixd diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index f64a71d..9902d11 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -253,6 +253,23 @@ vim.keymap.set("n", "e2", function() vim.diagnostic.jump({ prev=false, count = 1 }) end, { desc = "Next diagnostic" }) vim.keymap.set("n", "e3", vim.diagnostic.open_float, { desc = "Show diagnostic" }) vim.keymap.set("n", "e4", vim.diagnostic.setloclist, { desc = "Diagnostic list" }) + vim.keymap.set("n", "e5", vim.lsp.buf.code_action, { desc = "Show correction" }) + + vim.keymap.set("n", "e", function() + local clients = vim.lsp.get_clients({ name = "ltex" }) + + if #clients > 0 then + -- Stop LTeX + for _, client in ipairs(clients) do + client.stop() + end + print("LTeX OFF") + else + -- Start LTeX + vim.cmd("LspStart ltex") + print("LTeX ON") + end + end, { desc = "Toggle LTeX" }) vim.diagnostic.config({ update_in_insert = false, -- i don't get any new error when in insert @@ -298,7 +315,7 @@ }) vim.lsp.config("nixd", { cmd = { "nixd" }, - filetyypes = { "nix" }, + filetypes = { "nix" }, on_attach = on_attach, }) vim.lsp.config("pylsp", { @@ -315,8 +332,46 @@ } }) vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach }) + vim.lsp.config("ltex", { + cmd = { "ltex-ls-plus" }, + filetypes = { "markdown", "text", "tex", "plaintex" }, + on_attach = on_attach, + + settings = { + ltex = { + language = "fr", + + enabled = { + "markdown", + "text", + "tex", + "plaintex", + }, + + completionEnabled = true, + diagnosticSeverity = "information", + + additionalRules = { + enablePickyRules = false, + motherTongue = "fr", + }, + + dictionary = { + ["fr"] = { + "icelle", + "icelui", + "iceux", + "maldoror", + "evariste", + "galois", + "arno" + }, + }, + }, + }, + }) - vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd"}) + vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"}) -- ========================= -- DASHBOARD -- =========================