From b8ea02473b71e2bdf40b1d3e149772b2efa4c825 Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 9 Sep 2024 18:01:28 +0530 Subject: [PATCH] feat(neovim-plugin-updates): Change configs to accomodate plugin updates - WhichKey: config format changed - Conform: config format changed - nvim-ufo: fix version to `1.4.0` as newer version broke things - code-lsp: add ltex LSP that integrated with free LanguageTool server --- .../nvim/lua/plugins/code-formatting.lua | 28 +++++++------- .../.config/nvim/lua/plugins/code-generic.lua | 1 + common/.config/nvim/lua/plugins/code-lsp.lua | 20 ++++++++++ .../nvim/lua/plugins/utility-plugs.lua | 37 +++++++++---------- 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/common/.config/nvim/lua/plugins/code-formatting.lua b/common/.config/nvim/lua/plugins/code-formatting.lua index b708f3f..8ce769e 100644 --- a/common/.config/nvim/lua/plugins/code-formatting.lua +++ b/common/.config/nvim/lua/plugins/code-formatting.lua @@ -9,22 +9,22 @@ return { conform.setup({ formatters_by_ft = { - javascript = { { "prettierd", "prettier" } }, - typescript = { { "prettierd", "prettier" } }, - javascriptreact = { { "prettierd", "prettier" } }, - typescriptreact = { { "prettierd", "prettier" } }, - svelte = { { "prettierd", "prettier" } }, - css = { { "prettierd", "prettier" } }, - html = { { "prettierd", "prettier" } }, - json = { { "prettierd", "prettier" } }, - graphql = { { "prettierd", "prettier" } }, - yaml = { { "yamlfmt", "prettierd" } }, - markdown = { { "markdownlint" } }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + javascriptreact = { "prettierd", "prettier", stop_after_first = true }, + typescriptreact = { "prettierd", "prettier", stop_after_first = true }, + svelte = { "prettierd", "prettier", stop_after_first = true }, + css = { "prettierd", "prettier", stop_after_first = true }, + html = { "prettierd", "prettier", stop_after_first = true }, + json = { "prettierd", "prettier", stop_after_first = true }, + graphql = { "prettierd", "prettier", stop_after_first = true }, + yaml = { "yamlfmt", "prettierd", stop_after_first = true }, + markdown = { "markdownlint" }, lua = { "stylua" }, python = { "black" }, - sh = { { "shfmt", "shellharden" } }, - bash = { { "shfmt", "shellharden" } }, - zsh = { { "shfmt", "shellharden" } }, + sh = { "shfmt", "shellharden", stop_after_first = true }, + bash = { "shfmt", "shellharden", stop_after_first = true }, + zsh = { "shfmt", "shellharden", stop_after_first = true }, ["_"] = { "trim_whitespace" }, }, format_on_save = { diff --git a/common/.config/nvim/lua/plugins/code-generic.lua b/common/.config/nvim/lua/plugins/code-generic.lua index aa171bf..0f2487e 100644 --- a/common/.config/nvim/lua/plugins/code-generic.lua +++ b/common/.config/nvim/lua/plugins/code-generic.lua @@ -27,6 +27,7 @@ return { -- Better code folding { "kevinhwang91/nvim-ufo", + version = "v1.4.0", cond = require("config.util").is_not_vscode(), event = "VeryLazy", dependencies = { diff --git a/common/.config/nvim/lua/plugins/code-lsp.lua b/common/.config/nvim/lua/plugins/code-lsp.lua index cad9c77..2964e4d 100644 --- a/common/.config/nvim/lua/plugins/code-lsp.lua +++ b/common/.config/nvim/lua/plugins/code-lsp.lua @@ -73,6 +73,26 @@ return { }, bashls = { filetypes = { "sh", "bash", "zsh" } }, html = { filetypes = { "html", "twig", "hbs" } }, + ltex = { + filetypes = { "markdown", "text" }, + flags = { debounce_text_changes = 3000 }, + settings = { + ltex = { + language = "en", + markdown = { + nodes = { + CodeBlock = "ignore", + FencedCodeBlock = "ignore", + Code = "ignore", + AutoLink = "ignore", + }, + checkFrequency = "save", + languageToolHttpServerUri = "https://api.languagetool.org", + }, + }, + }, + }, + omnisharp = { -- DotNet = { -- enablePackageRestore = true, diff --git a/common/.config/nvim/lua/plugins/utility-plugs.lua b/common/.config/nvim/lua/plugins/utility-plugs.lua index 452e907..3b1f1e1 100644 --- a/common/.config/nvim/lua/plugins/utility-plugs.lua +++ b/common/.config/nvim/lua/plugins/utility-plugs.lua @@ -231,29 +231,26 @@ return { { "folke/which-key.nvim", + dependencies = { + "echasnovski/mini.icons", + }, config = function() -- document existing key chains - require("which-key").register({ - ["c"] = { name = "Code", _ = "which_key_ignore" }, - ["b"] = { name = "Buffer Operations", _ = "which_key_ignore" }, - ["d"] = { name = "Diagnostics", _ = "which_key_ignore" }, - ["f"] = { name = "File Operations", _ = "which_key_ignore" }, - ["g"] = { name = "Git", _ = "which_key_ignore" }, - ["h"] = { name = "Harpoon", _ = "which_key_ignore" }, - ["l"] = { name = "List Things", _ = "which_key_ignore" }, - ["n"] = { name = "NVIM Things", _ = "which_key_ignore" }, - ["q"] = { name = "Database Query", _ = "which_key_ignore" }, - ["r"] = { name = "Refactor Code", _ = "which_key_ignore" }, - ["s"] = { name = "Search/Grep Things", _ = "which_key_ignore" }, - ["t"] = { name = "Unit Test Operations", _ = "which_key_ignore" }, - ["x"] = { name = "Delete/Remove Something", _ = "which_key_ignore" }, + require("which-key").add({ + { "c", group = "Code" }, + { "b", group = "Buffer Operations" }, + { "d", group = "Diagnostics" }, + { "f", group = "File Operations" }, + { "g", group = "Git" }, + { "h", group = "Harpoon" }, + { "l", group = "List Things" }, + { "n", group = "NVIM Things" }, + { "q", group = "Database Query" }, + { "r", group = "Refactor Code" }, + { "s", group = "Search/Grep Things" }, + { "t", group = "Unit Test Operations" }, + { "x", group = "Delete/Remove Something" }, }) - -- register which-key VISUAL mode - -- required for visual hs (hunk stage) to work - require("which-key").register({ - [""] = { name = "VISUAL " }, - ["h"] = { "Git Hunk" }, - }, { mode = "v" }) end, },