From 8301096c31f9855c74d5b732367b679bc8721b5e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 May 2024 21:36:43 +0200 Subject: [PATCH 01/92] perf(treesitter): dont let nvim-treesitter-textobjects stall loading treesitter --- lua/lazyvim/plugins/treesitter.lua | 57 ++++++++++++++++-------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 108582ff..a7ef36e5 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -16,33 +16,6 @@ return { require("lazy.core.loader").add_to_rtp(plugin) require("nvim-treesitter.query_predicates") end, - dependencies = { - { - "nvim-treesitter/nvim-treesitter-textobjects", - config = function() - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - local configs = require("nvim-treesitter.configs") - for name, fn in pairs(move) do - if name:find("goto") == 1 then - move[name] = function(q, ...) - if vim.wo.diff then - local config = configs.get_module("textobjects.move")[name] ---@type table - for key, query in pairs(config or {}) do - if q == query and key:find("[%]%[][cC]") then - vim.cmd("normal! " .. key) - return - end - end - end - return fn(q, ...) - end - end - end - end, - }, - }, cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, keys = { { "", desc = "Increment Selection" }, @@ -111,6 +84,36 @@ return { end, opts.ensure_installed) end require("nvim-treesitter.configs").setup(opts) + vim.schedule(function() + require("lazy").load({ plugins = { "nvim-treesitter-textobjects" } }) + end) + end, + }, + + { + "nvim-treesitter/nvim-treesitter-textobjects", + lazy = true, + config = function() + -- When in diff mode, we want to use the default + -- vim text objects c & C instead of the treesitter ones. + local move = require("nvim-treesitter.textobjects.move") ---@type table + local configs = require("nvim-treesitter.configs") + for name, fn in pairs(move) do + if name:find("goto") == 1 then + move[name] = function(q, ...) + if vim.wo.diff then + local config = configs.get_module("textobjects.move")[name] ---@type table + for key, query in pairs(config or {}) do + if q == query and key:find("[%]%[][cC]") then + vim.cmd("normal! " .. key) + return + end + end + end + return fn(q, ...) + end + end + end end, }, From b29d169afb7560ed4a9276e4379e28ffaed1a171 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 May 2024 21:41:56 +0200 Subject: [PATCH 02/92] perf(treesitter): load treesitter early during startup when opening a file from the cmdline --- lua/lazyvim/plugins/treesitter.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index a7ef36e5..97479b91 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -7,6 +7,7 @@ return { version = false, -- last release is way too old and doesn't work on Windows build = ":TSUpdate", event = { "LazyFile", "VeryLazy" }, + lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline init = function(plugin) -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which From 965a469ca8cb1d58b49c4e5d8b85430e8c6c0a25 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 May 2024 21:43:02 +0200 Subject: [PATCH 03/92] perf(startup): render a file opened from the cmdline as soon as possible and get rid of lazy_file logic --- lua/lazyvim/util/plugin.lua | 93 +++++++++++-------------------------- 1 file changed, 27 insertions(+), 66 deletions(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 13a2acec..0a6edc3b 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -3,7 +3,6 @@ local Plugin = require("lazy.core.plugin") ---@class lazyvim.util.plugin local M = {} -M.use_lazy_file = true M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } ---@type table @@ -55,76 +54,38 @@ function M.extra_idx(name) end end --- Properly load file based plugins without blocking the UI function M.lazy_file() - M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 + -- This autocmd will only trigger when a file was loaded from the cmdline. + -- It will render the file as quickly as possible. + vim.api.nvim_create_autocmd("BufReadPost", { + once = true, + callback = function(event) + -- Skip if we already entered vim + if vim.v.vim_did_enter == 1 then + return + end + + -- Try to guess the filetype (may change later on during Neovim startup) + local ft = vim.filetype.match({ buf = event.buf }) + if ft then + -- Add treesitter highlights and fallback to syntax + local lang = vim.treesitter.language.get_lang(ft) + if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then + vim.bo[event.buf].syntax = ft + vim.notify("Could not load treesitter for " .. ft, "warn", { title = "LazyVim" }) + end + + -- Trigger early redraw + vim.cmd([[redraw]]) + end + end, + }) -- Add support for the LazyFile event local Event = require("lazy.core.handler.event") - if M.use_lazy_file then - -- We'll handle delayed execution of events ourselves - Event.mappings.LazyFile = { id = "LazyFile", event = "User", pattern = "LazyFile" } - Event.mappings["User LazyFile"] = Event.mappings.LazyFile - else - -- Don't delay execution of LazyFile events, but let lazy know about the mapping - Event.mappings.LazyFile = { id = "LazyFile", event = { "BufReadPost", "BufNewFile", "BufWritePre" } } - Event.mappings["User LazyFile"] = Event.mappings.LazyFile - return - end - - local events = {} ---@type {event: string, buf: number, data?: any}[] - - local done = false - local function load() - if #events == 0 or done then - return - end - done = true - vim.api.nvim_del_augroup_by_name("lazy_file") - - ---@type table - local skips = {} - for _, event in ipairs(events) do - local augroups = Event.get_augroups(event.event) - local groups = vim.tbl_filter(function(t) - return not vim.tbl_contains({ t }, "filetypedetect") - end, augroups) - skips[event.event] = skips[event.event] or groups - end - - vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) - for _, event in ipairs(events) do - if vim.api.nvim_buf_is_valid(event.buf) then - Event.trigger({ - event = event.event, - exclude = skips[event.event], - data = event.data, - buf = event.buf, - }) - if vim.bo[event.buf].filetype then - Event.trigger({ - event = "FileType", - buf = event.buf, - }) - end - end - end - vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) - events = {} - end - - -- schedule wrap so that nested autocmds are executed - -- and the UI can continue rendering without blocking - load = vim.schedule_wrap(load) - - vim.api.nvim_create_autocmd(M.lazy_file_events, { - group = vim.api.nvim_create_augroup("lazy_file", { clear = true }), - callback = function(event) - table.insert(events, event) - load() - end, - }) + Event.mappings.LazyFile = { id = "LazyFile", event = M.lazy_file_events } + Event.mappings["User LazyFile"] = Event.mappings.LazyFile end function M.fix_imports() From cffed60fe4734d02e32efda5be22707342d5f9ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 14 May 2024 19:43:45 +0000 Subject: [PATCH 04/92] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 53beed41..b5925029 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 13 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 14 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 3585d61c938d62a331d474a8ff69c44faa4f3a10 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 14 May 2024 22:25:40 +0200 Subject: [PATCH 05/92] style: remove debug :) --- lua/lazyvim/util/plugin.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 0a6edc3b..3e90a767 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -72,7 +72,6 @@ function M.lazy_file() local lang = vim.treesitter.language.get_lang(ft) if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then vim.bo[event.buf].syntax = ft - vim.notify("Could not load treesitter for " .. ft, "warn", { title = "LazyVim" }) end -- Trigger early redraw From 1df3c5d70b2265f8582b0ed414f085e9066960da Mon Sep 17 00:00:00 2001 From: Gethin Davies Date: Tue, 14 May 2024 21:36:31 +0100 Subject: [PATCH 06/92] fix(dial): Fix dial commands in Visual line+block (#2933) --- lua/lazyvim/plugins/extras/editor/dial.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 20ebd7ff..72ecc926 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -5,7 +5,9 @@ M.dials_by_ft = {} ---@param increment boolean ---@param g? boolean function M.dial(increment, g) - local is_visual = vim.fn.mode(true):sub(1, 1) == "v" + local mode = vim.fn.mode(true) + -- Use visual commands for VISUAL 'v', VISUAL LINE 'V' and VISUAL BLOCK '\22' + local is_visual = mode == "v" or mode == "V" or mode == "\22" local func = (increment and "inc" or "dec") .. (g and "_g" or "_") .. (is_visual and "visual" or "normal") local group = M.dials_by_ft[vim.bo.filetype] or "default" return require("dial.map")[func](group) From 3c04789ef15bba15e8c0c71ef31db38c76b2ad67 Mon Sep 17 00:00:00 2001 From: XY Lin Date: Tue, 14 May 2024 21:37:27 +0100 Subject: [PATCH 07/92] fix(clangd): update the attribute name for process ID (#3047) The attribute name for picked process id when attaching the debugger is `pid`, not `processId` --- lua/lazyvim/plugins/extras/lang/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 7705360d..b5d707d7 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -144,7 +144,7 @@ return { type = "codelldb", request = "attach", name = "Attach to process", - processId = require("dap.utils").pick_process, + pid = require("dap.utils").pick_process, cwd = "${workspaceFolder}", }, } From 9047d041a8296e34ed7236e5344f5b927cd28f8b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 08:48:55 +0200 Subject: [PATCH 08/92] perf(yanky): `schedule_wrap` sqlite push to history to prevent blocking Neovim on copy/paste --- lua/lazyvim/plugins/extras/coding/yanky.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index e3549643..a1ef26c7 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -4,7 +4,7 @@ return { "gbprod/yanky.nvim", dependencies = not LazyVim.is_win() and { "kkharji/sqlite.lua" } or {}, opts = { - highlight = { timer = 250 }, + highlight = { timer = 150 }, ring = { storage = LazyVim.is_win() and "shada" or "sqlite" }, }, keys = { @@ -28,5 +28,11 @@ return { { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, }, + config = function(_, opts) + require("yanky").setup(opts) + local sqlite = require("yanky.storage.sqlite") + local push = sqlite.push + sqlite.push = vim.schedule_wrap(push) + end, }, } From 1892ebad78f9e855797ee7859bf5c4e1c5c93c39 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 May 2024 06:49:36 +0000 Subject: [PATCH 09/92] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index b5925029..78d4c15c 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 14 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 15 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 6a2545025eb6fcc78998b8a4c6d121729980925b Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Wed, 15 May 2024 12:29:55 +0300 Subject: [PATCH 10/92] fix(lsp): check if `diagnostics.signs` is disabled by user (#2897) --- lua/lazyvim/plugins/lsp/init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 30ef5115..4681b384 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -120,10 +120,12 @@ return { -- diagnostics signs if vim.fn.has("nvim-0.10.0") == 0 then - for severity, icon in pairs(opts.diagnostics.signs.text) do - local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper) - name = "DiagnosticSign" .. name - vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + if type(opts.diagnostics.signs) ~= "boolean" then + for severity, icon in pairs(opts.diagnostics.signs.text) do + local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper) + name = "DiagnosticSign" .. name + vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + end end end From 12a48b8ce1521fcac01b89099a4ca8bbc3547769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Wed, 15 May 2024 14:11:29 +0400 Subject: [PATCH 11/92] feat(snippet): add friendly-snippets to native extra (#2944) --- .../plugins/extras/coding/native_snippets.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/native_snippets.lua b/lua/lazyvim/plugins/extras/coding/native_snippets.lua index cc501ff7..e94d40ad 100644 --- a/lua/lazyvim/plugins/extras/coding/native_snippets.lua +++ b/lua/lazyvim/plugins/extras/coding/native_snippets.lua @@ -11,13 +11,18 @@ return { }, { "nvim-cmp", - opts = { - snippet = { + dependencies = { + { "rafamadriz/friendly-snippets" }, + { "garymjr/nvim-snippets", opts = { friendly_snippets = true } }, + }, + opts = function(_, opts) + opts.snippet = { expand = function(args) vim.snippet.expand(args.body) end, - }, - }, + } + table.insert(opts.sources, { name = "snippets" }) + end, keys = { { "", From a97fa3b7563eb2c5305c8f32461bb150d17e45ae Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 15:31:08 +0200 Subject: [PATCH 12/92] feat(lua): added `LazyVim` as a treesitter builtin --- queries/lua/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 829b2b08..eb048490 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -2,3 +2,6 @@ ((identifier) @namespace.builtin (#eq? @namespace.builtin "vim")) + +((identifier) @namespace.builtin + (#eq? @namespace.builtin "LazyVim")) From 543dead590a949255fbbada9e1775c31ad654682 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 15 May 2024 21:39:28 +0800 Subject: [PATCH 13/92] fix(dap): load vscode launch files with jsonc parser (#1839) This seems to be the proper fix for #1503. jsonc ensures compatibility with native vscode. Ref: https://github.com/mfussenegger/nvim-dap/issues/964 --- lua/lazyvim/plugins/extras/dap/core.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 7e370629..bf57ebc3 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -26,8 +26,6 @@ return { }, opts = {}, config = function(_, opts) - -- setup dap config by VsCode launch.json file - -- require("dap.ext.vscode").load_launchjs() local dap = require("dap") local dapui = require("dapui") dapui.setup(opts) @@ -81,6 +79,11 @@ return { }, }, }, + + -- VsCode launch.json parser + { + "folke/neoconf.nvim", + }, }, -- stylua: ignore @@ -115,5 +118,10 @@ return { { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } ) end + + -- setup dap config by VsCode launch.json file + local vscode = require("dap.ext.vscode") + vscode.json_decode = require("neoconf.json.jsonc").decode_jsonc + vscode.load_launchjs() end, } From 2c86da7c2df61c23366e4073312ab12fa6d7e424 Mon Sep 17 00:00:00 2001 From: Radvil <36059968+radvil@users.noreply.github.com> Date: Wed, 15 May 2024 21:45:13 +0800 Subject: [PATCH 14/92] feat(typescript): configure inlayHint (#2995) * feat(typescript): configure inlayHint since LazyVim have toggle inlayhint keymap, it make sense to configure them for each extra languages provided. In this commit I just add the configuration for typescript, since IDK how to configure the rest of lang extras that was provided. * fix: changed defaults --------- Co-authored-by: Radvil Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/typescript.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 4bb280d6..4e3846ec 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -1,3 +1,14 @@ +local inlay_hints_settings = { + includeInlayEnumMemberValueHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayParameterNameHints = "literal", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayVariableTypeHints = false, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, +} + return { -- add typescript to treesitter @@ -46,8 +57,13 @@ return { desc = "Remove Unused Imports", }, }, - ---@diagnostic disable-next-line: missing-fields settings = { + typescript = { + inlayHints = inlay_hints_settings, + }, + javascript = { + inlayHints = inlay_hints_settings, + }, completions = { completeFunctionCalls = true, }, From 91ead221167a722a8dd8651cb5c53bf5db4d1b4d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 15:48:46 +0200 Subject: [PATCH 15/92] feat(lua_ls): configure default lua_ls inlay hint settings --- lua/lazyvim/plugins/lsp/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 4681b384..26abffa0 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -75,6 +75,17 @@ return { completion = { callSnippet = "Replace", }, + doc = { + privateName = { "^_" }, + }, + hint = { + enable = true, + setType = false, + paramType = true, + paramName = "Disable", + semicolon = "Disable", + arrayIndex = "Disable", + }, }, }, }, From 914ca4a455169916da4614d76c15d1d1bf22e9bc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 15:53:19 +0200 Subject: [PATCH 16/92] feat(noice): added keymap `snt` to show Noice messages in telescope. Fixes #1306 --- lua/lazyvim/plugins/ui.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 2cd9496c..e983084f 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -322,6 +322,7 @@ return { { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + { "snt", function() require("noice").cmd("telescope") end, desc = "Noice Telescope" }, { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll Forward", mode = {"i", "n", "s"} }, { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll Backward", mode = {"i", "n", "s"}}, }, From 16e6c86b2778ba35696de5067ff033cc5bdbe6db Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Wed, 15 May 2024 06:56:16 -0700 Subject: [PATCH 17/92] feat(terraform): ensure tflint is installed (#2336) --- lua/lazyvim/plugins/extras/lang/terraform.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index b199b4f1..02c05793 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -18,6 +18,14 @@ return { }, }, }, + -- ensure terraform tools are installed + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "tflint" }) + end, + }, { "nvimtools/none-ls.nvim", optional = true, From a8659d02b954ca320088aab48aad8a95b3bbb86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Schmidt?= Date: Wed, 15 May 2024 16:01:24 +0200 Subject: [PATCH 18/92] feat(omnisharp): support neotest dotnet (#3051) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rafał Schmidt --- lua/lazyvim/plugins/extras/lang/omnisharp.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index d4bd698b..3885dd08 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -96,4 +96,18 @@ return { end end, }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "Issafalcon/neotest-dotnet", + }, + opts = { + adapters = { + ["neotest-dotnet"] = { + -- Here we can set options for neotest-dotnet + }, + }, + }, + }, } From d36e3a5c73c07f54b31c4ec5334f68ed5492123e Mon Sep 17 00:00:00 2001 From: Avinash Thakur <19588421+80avin@users.noreply.github.com> Date: Wed, 15 May 2024 19:38:15 +0530 Subject: [PATCH 19/92] fix(extras.lang.typescript): support `node` debug type along with `pwa-node` (#2983) * feat(typescript): add "node" debug adapter add "node" debug adapter for compatibility with .vscode/launch.json * refactor: ... --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/typescript.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 4e3846ec..a1c6aba1 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -103,6 +103,20 @@ return { }, } end + if not dap.adapters["node"] then + dap.adapters["node"] = function(cb, config) + if config.type == "node" then + config.type = "pwa-node" + end + local nativeAdapter = dap.adapters["pwa-node"] + if type(nativeAdapter) == "function" then + nativeAdapter(cb, config) + else + cb(nativeAdapter) + end + end + end + for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do if not dap.configurations[language] then dap.configurations[language] = { From 36802fea198f536ac20c0e2514fc4f54cee2904b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Freitas?= Date: Wed, 15 May 2024 14:10:06 +0000 Subject: [PATCH 20/92] fix(keymaps): better up/down keymaps description (#1909) --- lua/lazyvim/config/keymaps.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 79ae665d..71bc61b6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -5,10 +5,10 @@ local map = LazyVim.safe_keymap_set -- better up/down -map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) -- Move to window using the hjkl keys map("n", "", "h", { desc = "Go to Left Window", remap = true }) From 9b7e4b7c030ebffa285288c5e96dc8e671b798a8 Mon Sep 17 00:00:00 2001 From: Leo Kirchner Date: Wed, 15 May 2024 16:11:27 +0200 Subject: [PATCH 21/92] docs(README-DE.md): improves German README (#2413) - Translates remaining English text - Fixes a couple of spelling and grammar issues --- README-DE.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README-DE.md b/README-DE.md index e104f174..f5a05985 100644 --- a/README-DE.md +++ b/README-DE.md @@ -5,11 +5,11 @@

- Install + Installieren · - Configure + Konfigurieren · - Docs + Dokumentation

@@ -36,8 +36,8 @@

-LazyVim ist ein Neovim setup aufgebaut auf [💤 lazy.nvim](https://github.com/folke/lazy.nvim). -Es erleichter das Anpassen und erweitern von Ihrer Konfiguration. +LazyVim ist ein Neovim-Setup aufgebaut auf [💤 lazy.nvim](https://github.com/folke/lazy.nvim). +Es erleichtert das Anpassen und Erweitern von Ihrer Konfiguration. Anstatt von vorne anzufangen oder eine vorgefertigte Distro zu verwenden, gibt LazyVim das beste aus beiden Welten - die Flexibilität Ihre Konfiguration zu verändern und einzustellen wie Sie es wollen und die Einfachheit von einem vorgefertigten Setup. @@ -52,7 +52,7 @@ und die Einfachheit von einem vorgefertigten Setup. - 💤 Passe deine Konfiguration einfach an und erweitere diese mit [lazy.nvim](https://github.com/folke/lazy.nvim) - 🚀 Extrem schnell - 🧹 Logische Voreinstellungen für optionen, autocmds und keymaps -- 📦 Kommt mit einem Haufen vor Konfigurierten, ready to use Plugins +- 📦 Kommt mit einem Haufen vorkonfigurierter, ready-to-use Plugins ## ⚡️ Vorraussetzungen @@ -108,15 +108,15 @@ docker run -w /root -it --rm alpine:edge sh -uelic ' -## 📂 File Structure +## 📂 Dateistruktur -The files under config will be automatically loaded at the appropriate time, -so you don't need to require those files manually. -**LazyVim** comes with a set of default config files that will be loaded -**_before_** your own. See [here](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) - -You can add your custom plugin specs under `lua/plugins/`. All files there -will be automatically loaded by [lazy.nvim](https://github.com/folke/lazy.nvim) +Die Dateien unter `config` werden automatisch und zur richtigen Zeit geladen, +sodass ein manuelles `require` nicht nötig ist. +**LazyVim** bringt Konfigurationsdatein mit, die **_vor_** Ihren eigenen geladen werden - +siehe [hier](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) +Sie können eigene Plugins unter `lua/plugins/` hinzufügen. Alle Dateien innerhalb +dieses Ordners werden automatisch mit [lazy.nvim](https://github.com/folke/lazy.nvim) +geladen.
 ~/.config/nvim
@@ -133,6 +133,6 @@ will be automatically loaded by [lazy.nvim](https://github.com/folke/lazy.nvim)
 └── init.toml
 
-## ⚙️ Configuration +## ⚙️ Konfiguration -Refer to the [docs](https://lazyvim.github.io) +Siehe [Dokumentation](https://lazyvim.github.io). From 9337db17c2f6082e10c97456185d8ba3fa473769 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Wed, 15 May 2024 10:12:18 -0400 Subject: [PATCH 22/92] fix(autocmds): remove query from q-to-quit autocmd (#2838) --- lua/lazyvim/config/autocmds.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 48faab3d..b2135870 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -59,7 +59,6 @@ vim.api.nvim_create_autocmd("FileType", { "lspinfo", "notify", "qf", - "query", "spectre_panel", "startuptime", "tsplayground", From fc5ee49495093fe8e63b1648f81af371c2930129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Wed, 15 May 2024 18:15:11 +0400 Subject: [PATCH 23/92] fix(gitsigns): update deprecated hunk nav mappings (#2935) --- lua/lazyvim/plugins/editor.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 907d2dc0..95267532 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -391,8 +391,10 @@ return { end -- stylua: ignore start - map("n", "]h", gs.next_hunk, "Next Hunk") - map("n", "[h", gs.prev_hunk, "Prev Hunk") + map("n", "]h", function() gs.nav_hunk("next") end, "Next Hunk") + map("n", "[h", function() gs.nav_hunk("prev") end, "Prev Hunk") + map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk") + map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk") map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") map("n", "ghS", gs.stage_buffer, "Stage Buffer") From c70a78e63137ec48e1c78b23413332716f572590 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 16:23:38 +0200 Subject: [PATCH 24/92] fix(cmp): dont add autobrackets if prev char is a bracket. Closes #2949 --- lua/lazyvim/plugins/coding.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 3cdcc668..17380078 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -84,8 +84,11 @@ return { local entry = event.entry local item = entry:get_completion_item() if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then - local keys = vim.api.nvim_replace_termcodes("()", false, false, true) - vim.api.nvim_feedkeys(keys, "i", true) + local prev_char = vim.fn.getline("."):sub(vim.fn.col(".") - 1, vim.fn.col(".")) + if prev_char ~= "(" and prev_char ~= ")" then + local keys = vim.api.nvim_replace_termcodes("()", false, false, true) + vim.api.nvim_feedkeys(keys, "i", true) + end end end) end, From f25ac504b896a522c645d456766adac2afa28801 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 May 2024 18:09:55 +0200 Subject: [PATCH 25/92] perf(yanky): remove performance optim for sqlite since it has been merged upstream --- lua/lazyvim/plugins/extras/coding/yanky.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index a1ef26c7..3e3a3bbc 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -28,11 +28,5 @@ return { { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, }, - config = function(_, opts) - require("yanky").setup(opts) - local sqlite = require("yanky.storage.sqlite") - local push = sqlite.push - sqlite.push = vim.schedule_wrap(push) - end, }, } From b601ade71c7f8feacf62a762d4e81cf99c055ea7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 18:12:55 +0200 Subject: [PATCH 26/92] chore(main): release 10.25.0 (#3147) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba1a334d..bc9ff8ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,49 @@ # Changelog +## [10.25.0](https://github.com/LazyVim/LazyVim/compare/v10.24.0...v10.25.0) (2024-05-15) + + +### Features + +* **extras:** add refactoring.nvim ([#3040](https://github.com/LazyVim/LazyVim/issues/3040)) ([73de8dd](https://github.com/LazyVim/LazyVim/commit/73de8dde2bb513337426d5ead862e4fc6dbb8fdf)) +* **lua_ls:** configure default lua_ls inlay hint settings ([91ead22](https://github.com/LazyVim/LazyVim/commit/91ead221167a722a8dd8651cb5c53bf5db4d1b4d)) +* **lua:** added `LazyVim` as a treesitter builtin ([a97fa3b](https://github.com/LazyVim/LazyVim/commit/a97fa3b7563eb2c5305c8f32461bb150d17e45ae)) +* **noice:** added keymap `<leader>snt` to show Noice messages in telescope. Fixes [#1306](https://github.com/LazyVim/LazyVim/issues/1306) ([914ca4a](https://github.com/LazyVim/LazyVim/commit/914ca4a455169916da4614d76c15d1d1bf22e9bc)) +* **omnisharp:** support neotest dotnet ([#3051](https://github.com/LazyVim/LazyVim/issues/3051)) ([a8659d0](https://github.com/LazyVim/LazyVim/commit/a8659d02b954ca320088aab48aad8a95b3bbb86c)) +* **snippet:** add friendly-snippets to native extra ([#2944](https://github.com/LazyVim/LazyVim/issues/2944)) ([12a48b8](https://github.com/LazyVim/LazyVim/commit/12a48b8ce1521fcac01b89099a4ca8bbc3547769)) +* **terraform:** ensure tflint is installed ([#2336](https://github.com/LazyVim/LazyVim/issues/2336)) ([16e6c86](https://github.com/LazyVim/LazyVim/commit/16e6c86b2778ba35696de5067ff033cc5bdbe6db)) +* **typescript:** configure inlayHint ([#2995](https://github.com/LazyVim/LazyVim/issues/2995)) ([2c86da7](https://github.com/LazyVim/LazyVim/commit/2c86da7c2df61c23366e4073312ab12fa6d7e424)) +* **vue:** add Vue.js support to LazyVim ([#3094](https://github.com/LazyVim/LazyVim/issues/3094)) ([f449025](https://github.com/LazyVim/LazyVim/commit/f4490252fb2262208923ba197eb521732a602ac1)) + + +### Bug Fixes + +* **ansible:** ansiblels not loading, keymap desc. ([#2739](https://github.com/LazyVim/LazyVim/issues/2739)) ([abb1ff0](https://github.com/LazyVim/LazyVim/commit/abb1ff0d600b3446b612390f0482cf92bdc84ab0)) +* **autocmds:** remove query from q-to-quit autocmd ([#2838](https://github.com/LazyVim/LazyVim/issues/2838)) ([9337db1](https://github.com/LazyVim/LazyVim/commit/9337db17c2f6082e10c97456185d8ba3fa473769)) +* **clangd:** update the attribute name for process ID ([#3047](https://github.com/LazyVim/LazyVim/issues/3047)) ([3c04789](https://github.com/LazyVim/LazyVim/commit/3c04789ef15bba15e8c0c71ef31db38c76b2ad67)) +* **cmp:** dont add autobrackets if prev char is a bracket. Closes [#2949](https://github.com/LazyVim/LazyVim/issues/2949) ([c70a78e](https://github.com/LazyVim/LazyVim/commit/c70a78e63137ec48e1c78b23413332716f572590)) +* **dap:** load vscode launch files with jsonc parser ([#1839](https://github.com/LazyVim/LazyVim/issues/1839)) ([543dead](https://github.com/LazyVim/LazyVim/commit/543dead590a949255fbbada9e1775c31ad654682)) +* **dial:** Fix dial commands in Visual line+block ([#2933](https://github.com/LazyVim/LazyVim/issues/2933)) ([1df3c5d](https://github.com/LazyVim/LazyVim/commit/1df3c5d70b2265f8582b0ed414f085e9066960da)) +* **dot:** remove `.env` => `sh` since this is already the default ([a0afe8f](https://github.com/LazyVim/LazyVim/commit/a0afe8fef9dc76b469a78435cdd3f2c5ee01f282)) +* **dot:** use syntax `sh` for dotenv files. Closes [#3145](https://github.com/LazyVim/LazyVim/issues/3145) ([42010d1](https://github.com/LazyVim/LazyVim/commit/42010d1dfbb0ba9c74c1ec0c93c5c9db21ebee47)) +* **extras.lang.typescript:** support `node` debug type along with `pwa-node` ([#2983](https://github.com/LazyVim/LazyVim/issues/2983)) ([d36e3a5](https://github.com/LazyVim/LazyVim/commit/d36e3a5c73c07f54b31c4ec5334f68ed5492123e)) +* **fzf-native:** try rebuilding fzf-native when needed. Fixes [#2464](https://github.com/LazyVim/LazyVim/issues/2464) ([39901c1](https://github.com/LazyVim/LazyVim/commit/39901c1f00eca36beb211978164744ae41be7781)) +* **gitsigns:** update deprecated hunk nav mappings ([#2935](https://github.com/LazyVim/LazyVim/issues/2935)) ([fc5ee49](https://github.com/LazyVim/LazyVim/commit/fc5ee49495093fe8e63b1648f81af371c2930129)) +* **keymaps:** better up/down keymaps description ([#1909](https://github.com/LazyVim/LazyVim/issues/1909)) ([36802fe](https://github.com/LazyVim/LazyVim/commit/36802fea198f536ac20c0e2514fc4f54cee2904b)) +* **lazyfile:** exclude `filetypedetect` from skips ([#3004](https://github.com/LazyVim/LazyVim/issues/3004)) ([c54eeb5](https://github.com/LazyVim/LazyVim/commit/c54eeb53905e8da27814f52eaf1ad63aeff4cbe4)) +* **lsp:** check if `diagnostics.signs` is disabled by user ([#2897](https://github.com/LazyVim/LazyVim/issues/2897)) ([6a25450](https://github.com/LazyVim/LazyVim/commit/6a2545025eb6fcc78998b8a4c6d121729980925b)) +* **pretty_path:** properly escape `%` characters ([e89653f](https://github.com/LazyVim/LazyVim/commit/e89653f4107724f53964a379337947490117a7dc)) +* **rust:** update creates.nvim src option to completion ([#3149](https://github.com/LazyVim/LazyVim/issues/3149)) ([8087283](https://github.com/LazyVim/LazyVim/commit/8087283fea62e5673764dfa13906eadb24110622)) + + +### Performance Improvements + +* **startup:** render a file opened from the cmdline as soon as possible and get rid of lazy_file logic ([965a469](https://github.com/LazyVim/LazyVim/commit/965a469ca8cb1d58b49c4e5d8b85430e8c6c0a25)) +* **treesitter:** dont let nvim-treesitter-textobjects stall loading treesitter ([8301096](https://github.com/LazyVim/LazyVim/commit/8301096c31f9855c74d5b732367b679bc8721b5e)) +* **treesitter:** load treesitter early during startup when opening a file from the cmdline ([b29d169](https://github.com/LazyVim/LazyVim/commit/b29d169afb7560ed4a9276e4379e28ffaed1a171)) +* **yanky:** `schedule_wrap` sqlite push to history to prevent blocking Neovim on copy/paste ([9047d04](https://github.com/LazyVim/LazyVim/commit/9047d041a8296e34ed7236e5344f5b927cd28f8b)) +* **yanky:** remove performance optim for sqlite since it has been merged upstream ([f25ac50](https://github.com/LazyVim/LazyVim/commit/f25ac504b896a522c645d456766adac2afa28801)) + ## [10.24.0](https://github.com/LazyVim/LazyVim/compare/v10.23.0...v10.24.0) (2024-05-12) From 44d51e5a6521aef6093751c263f73b149f1c3771 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Thu, 16 May 2024 11:44:19 +0545 Subject: [PATCH 27/92] refactor(options): prefer opt in place of vim.opt (#3167) --- lua/lazyvim/config/options.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index c20adcec..31141c67 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -92,21 +92,21 @@ if vim.fn.has("nvim-0.10") == 1 then end -- Folding -vim.opt.foldlevel = 99 +opt.foldlevel = 99 if vim.fn.has("nvim-0.9.0") == 1 then - vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] - vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" + opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] + opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" end -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now if vim.fn.has("nvim-0.10") == 1 then - vim.opt.foldmethod = "expr" - vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" - vim.opt.foldtext = "" - vim.opt.fillchars = "fold: " + opt.foldmethod = "expr" + opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" + opt.foldtext = "" + opt.fillchars = "fold: " else - vim.opt.foldmethod = "indent" + opt.foldmethod = "indent" end vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" From 97d7b2d262f18ad41b64299eeb02174ba1dde68b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 May 2024 05:59:54 +0000 Subject: [PATCH 28/92] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 78d4c15c..6df78613 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 15 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 16 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 6e7ba50141b1cda415c9391fd345a1e428bad9b6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 08:07:29 +0200 Subject: [PATCH 29/92] fix(cmp): never auto bracket for snippets and correct prev char check. Fixes #2949 --- lua/lazyvim/plugins/coding.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 17380078..e279187d 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -83,8 +83,9 @@ return { end local entry = event.entry local item = entry:get_completion_item() - if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then - local prev_char = vim.fn.getline("."):sub(vim.fn.col(".") - 1, vim.fn.col(".")) + if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) and item.insertTextFormat ~= 2 then + local cursor = vim.api.nvim_win_get_cursor(0) + local prev_char = vim.api.nvim_buf_get_text(0, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2] + 1, {})[1] if prev_char ~= "(" and prev_char ~= ")" then local keys = vim.api.nvim_replace_termcodes("()", false, false, true) vim.api.nvim_feedkeys(keys, "i", true) From 183d6eea606556c8bd7f80a70660c54670e04649 Mon Sep 17 00:00:00 2001 From: Avinash Thakur <19588421+80avin@users.noreply.github.com> Date: Thu, 16 May 2024 15:27:56 +0530 Subject: [PATCH 30/92] fix(dap): add debugger to filetypes mapping for launch.json (#3165) --- lua/lazyvim/plugins/extras/dap/core.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index bf57ebc3..285d7258 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -121,7 +121,12 @@ return { -- setup dap config by VsCode launch.json file local vscode = require("dap.ext.vscode") + local _filetypes = require("mason-nvim-dap.mappings.filetypes") + local filetypes = vim.tbl_deep_extend("force", _filetypes, { + ["node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" }, + ["pwa-node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" }, + }) vscode.json_decode = require("neoconf.json.jsonc").decode_jsonc - vscode.load_launchjs() + vscode.load_launchjs(nil, filetypes) end, } From 2391ac04202b04c0321fedcf17e47859d56458b2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 16:37:26 +0200 Subject: [PATCH 31/92] refactor(options): refactored options --- lua/lazyvim/config/options.lua | 59 ++++++++++++---------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 31141c67..80223ad1 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -2,7 +2,7 @@ vim.g.mapleader = " " vim.g.maplocalleader = "\\" --- Enable LazyVim auto format +-- LazyVim auto format vim.g.autoformat = true -- LazyVim root dir detection @@ -28,18 +28,24 @@ vim.g.lazygit_config = true local opt = vim.opt opt.autowrite = true -- Enable auto write - -if not vim.env.SSH_TTY then - -- only set clipboard if not in ssh, to make sure the OSC 52 - -- integration works automatically. Requires Neovim >= 0.10.0 - opt.clipboard = "unnamedplus" -- Sync with system clipboard -end - +-- only set clipboard if not in ssh, to make sure the OSC 52 +-- integration works automatically. Requires Neovim >= 0.10.0 +opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.cursorline = true -- Enable highlighting of the current line opt.expandtab = true -- Use spaces instead of tabs +opt.fillchars = { + foldopen = "", + foldclose = "", + fold = " ", + foldsep = " ", + diff = "╱", + eob = " ", +} +opt.foldlevel = 99 +opt.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" @@ -66,11 +72,10 @@ opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current +opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support -if not vim.g.vscode then - opt.timeoutlen = 300 -- Lower than default (1000) to quickly trigger which-key -end +opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key opt.undofile = true opt.undolevels = 10000 opt.updatetime = 200 -- Save swap file and trigger CursorHold @@ -78,38 +83,16 @@ opt.virtualedit = "block" -- Allow cursor to move where there is no text in visu opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -opt.fillchars = { - foldopen = "", - foldclose = "", - fold = " ", - foldsep = " ", - diff = "╱", - eob = " ", -} if vim.fn.has("nvim-0.10") == 1 then opt.smoothscroll = true -end - --- Folding -opt.foldlevel = 99 - -if vim.fn.has("nvim-0.9.0") == 1 then - opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] + opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" + opt.foldmethod = "expr" + opt.foldtext = "" +else + opt.foldmethod = "indent" opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" end --- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now -if vim.fn.has("nvim-0.10") == 1 then - opt.foldmethod = "expr" - opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" - opt.foldtext = "" - opt.fillchars = "fold: " -else - opt.foldmethod = "indent" -end - -vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" - -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 From 8dae76c1fd6fb90199b56cda8b6ec21576d02eb5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 16:44:01 +0200 Subject: [PATCH 32/92] fix(dap): use jsonc support from plenary. Same as the code from neoconf. Fixes #3174 --- lua/lazyvim/plugins/extras/dap/core.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 285d7258..fa6724b3 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -126,7 +126,10 @@ return { ["node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" }, ["pwa-node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" }, }) - vscode.json_decode = require("neoconf.json.jsonc").decode_jsonc + local json = require("plenary.json") + vscode.json_decode = function(str) + return vim.json.decode(json.json_strip_comments(str)) + end vscode.load_launchjs(nil, filetypes) end, } From 9fe8b15928077cb0c20aeea111b42f9698c78330 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 16:49:35 +0200 Subject: [PATCH 33/92] fix(health): add warning when not using 0.10.0 --- lua/lazyvim/health.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/health.lua b/lua/lazyvim/health.lua index a23c90f5..4822de86 100644 --- a/lua/lazyvim/health.lua +++ b/lua/lazyvim/health.lua @@ -10,6 +10,9 @@ function M.check() if vim.fn.has("nvim-0.9.0") == 1 then ok("Using Neovim >= 0.9.0") + if vim.fn.has("nvim-0.10.0") == 0 then + warn("Use Neovim >= 0.10.0 for the best experience") + end else error("Neovim >= 0.9.0 is required") end From f02507b1598379250baab293c423f79c393e28e5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 17:44:32 +0200 Subject: [PATCH 34/92] feat(util): set_upvalue --- lua/lazyvim/util/inject.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/lazyvim/util/inject.lua b/lua/lazyvim/util/inject.lua index 81e0f57a..859afc81 100644 --- a/lua/lazyvim/util/inject.lua +++ b/lua/lazyvim/util/inject.lua @@ -31,4 +31,20 @@ function M.get_upvalue(func, name) end end +function M.set_upvalue(func, name, value) + local i = 1 + while true do + local n = debug.getupvalue(func, i) + if not n then + break + end + if n == name then + debug.setupvalue(func, i, value) + return + end + i = i + 1 + end + LazyVim.error("upvalue not found: " .. name) +end + return M From d999be7401783e0f3a610319fa1b327d38fa3e52 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 17:45:12 +0200 Subject: [PATCH 35/92] feat(coding)!: use native comments on 0.10, with support for ts_context_commentstring --- lua/lazyvim/plugins/coding.lua | 26 +++++++++++-------- .../plugins/extras/coding/mini-comment.lua | 13 ++++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/coding/mini-comment.lua diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index e279187d..a917cbc4 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -210,18 +210,22 @@ return { opts = { enable_autocmd = false, }, + init = function() + if vim.fn.has("nvim-0.10") == 1 then + -- Majestically override the native `get_commentstring` function. + vim.schedule(function() + LazyVim.inject.set_upvalue( + LazyVim.inject.get_upvalue(require("vim._comment").textobject, "get_comment_parts"), + "get_commentstring", + function() + return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring + end + ) + end) + end + end, }, - { - "echasnovski/mini.comment", - event = "VeryLazy", - opts = { - options = { - custom_commentstring = function() - return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring - end, - }, - }, - }, + { import = "lazyvim.plugins.extras.coding.mini-comment", enabled = vim.fn.has("nvim-0.10") == 0 }, -- Better text-objects { diff --git a/lua/lazyvim/plugins/extras/coding/mini-comment.lua b/lua/lazyvim/plugins/extras/coding/mini-comment.lua new file mode 100644 index 00000000..d401c9de --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/mini-comment.lua @@ -0,0 +1,13 @@ +return { + { + "echasnovski/mini.comment", + event = "VeryLazy", + opts = { + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring + end, + }, + }, + }, +} From 3c4ebd522e7c475cfedcee5dfa7a008e798c404c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:03:58 +0200 Subject: [PATCH 36/92] feat(coding)!: native snippets are now the default on Neovim 0.10. Install the luasnip extra to get luasnip back --- lua/lazyvim/plugins/coding.lua | 85 +++++++++++-------- lua/lazyvim/plugins/extras/coding/luasnip.lua | 44 ++++++++++ .../plugins/extras/coding/native_snippets.lua | 69 --------------- lua/lazyvim/util/plugin.lua | 3 +- 4 files changed, 96 insertions(+), 105 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/coding/luasnip.lua delete mode 100644 lua/lazyvim/plugins/extras/coding/native_snippets.lua diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index a917cbc4..3280f957 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -96,50 +96,65 @@ return { }, -- snippets - { - "L3MON4D3/LuaSnip", - build = (not LazyVim.is_win()) - and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" - or nil, - dependencies = { - { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - { + vim.snippet + and { "nvim-cmp", dependencies = { - "saadparwaiz1/cmp_luasnip", + { "rafamadriz/friendly-snippets" }, + { "garymjr/nvim-snippets", opts = { friendly_snippets = true } }, }, opts = function(_, opts) opts.snippet = { expand = function(args) - require("luasnip").lsp_expand(args.body) + vim.snippet.expand(args.body) end, } - table.insert(opts.sources, { name = "luasnip" }) + table.insert(opts.sources, { name = "snippets" }) end, - }, - }, - opts = { - history = true, - delete_check_events = "TextChanged", - }, - -- stylua: ignore - keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, silent = true, mode = "i", - }, - { "", function() require("luasnip").jump(1) end, mode = "s" }, - { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, - }, - }, + keys = { + { + "", + function() + if vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) + return + end + return "" + end, + expr = true, + silent = true, + mode = "i", + }, + { + "", + function() + vim.schedule(function() + vim.snippet.jump(1) + end) + end, + silent = true, + mode = "s", + }, + { + "", + function() + if vim.snippet.active({ direction = -1 }) then + vim.schedule(function() + vim.snippet.jump(-1) + end) + return + end + return "" + end, + expr = true, + silent = true, + mode = { "i", "s" }, + }, + }, + } + or { import = "lazyvim.plugins.extras.coding.luasnip", enabled = vim.fn.has("nvim-0.10") == 0 }, -- auto pairs { diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua new file mode 100644 index 00000000..3a12f9db --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -0,0 +1,44 @@ +return { + "L3MON4D3/LuaSnip", + build = (not LazyVim.is_win()) + and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" + or nil, + dependencies = { + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + { + "nvim-cmp", + dependencies = { + "saadparwaiz1/cmp_luasnip", + }, + opts = function(_, opts) + opts.snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + } + table.insert(opts.sources, { name = "luasnip" }) + end, + }, + }, + opts = { + history = true, + delete_check_events = "TextChanged", + }, + -- stylua: ignore + keys = { + { + "", + function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, + expr = true, silent = true, mode = "i", + }, + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, +} diff --git a/lua/lazyvim/plugins/extras/coding/native_snippets.lua b/lua/lazyvim/plugins/extras/coding/native_snippets.lua deleted file mode 100644 index e94d40ad..00000000 --- a/lua/lazyvim/plugins/extras/coding/native_snippets.lua +++ /dev/null @@ -1,69 +0,0 @@ -if not vim.snippet then - LazyVim.warn("Native snippets are only supported on Neovim >= 0.10.0") - return {} -end - -return { - desc = "Use native snippets instead of LuaSnip. Only works on Neovim >= 0.10!", - { - "L3MON4D3/LuaSnip", - enabled = false, - }, - { - "nvim-cmp", - dependencies = { - { "rafamadriz/friendly-snippets" }, - { "garymjr/nvim-snippets", opts = { friendly_snippets = true } }, - }, - opts = function(_, opts) - opts.snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - } - table.insert(opts.sources, { name = "snippets" }) - end, - keys = { - { - "", - function() - if vim.snippet.active({ direction = 1 }) then - vim.schedule(function() - vim.snippet.jump(1) - end) - return - end - return "" - end, - expr = true, - silent = true, - mode = "i", - }, - { - "", - function() - vim.schedule(function() - vim.snippet.jump(1) - end) - end, - silent = true, - mode = "s", - }, - { - "", - function() - if vim.snippet.active({ direction = -1 }) then - vim.schedule(function() - vim.snippet.jump(-1) - end) - return - end - return "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - }, - }, -} diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 3e90a767..ad13247a 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -10,6 +10,7 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.formatting.conform"] = "`conform.nvim` is now the default **LazyVim** formatter.", ["lazyvim.plugins.extras.linting.nvim-lint"] = "`nvim-lint` is now the default **LazyVim** linter.", ["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.", + ["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**", } M.deprecated_modules = { @@ -91,7 +92,7 @@ function M.fix_imports() Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec) local dep = M.deprecated_extras[spec and spec.import] if dep then - dep = dep .. "\n" .. "Please remove the extra to hide this warning." + dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning." LazyVim.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 }) return false end From 9839f10013b287229f4aaad14e75a6044d0f6cb5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:07:38 +0200 Subject: [PATCH 37/92] refactor: comments code --- lua/lazyvim/plugins/coding.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 3280f957..d4070b4c 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -225,7 +225,10 @@ return { opts = { enable_autocmd = false, }, - init = function() + }, + { + import = "lazyvim.plugins.extras.coding.mini-comment", + enabled = function() if vim.fn.has("nvim-0.10") == 1 then -- Majestically override the native `get_commentstring` function. vim.schedule(function() @@ -237,10 +240,11 @@ return { end ) end) + else + return true end end, }, - { import = "lazyvim.plugins.extras.coding.mini-comment", enabled = vim.fn.has("nvim-0.10") == 0 }, -- Better text-objects { From 03704e22998be9db17f114acc4060d714fe652fb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:20:09 +0200 Subject: [PATCH 38/92] feat(ui)!: moved treesitter-context to an extra. No longer a core plugin --- lua/lazyvim/plugins/editor.lua | 1 - .../plugins/extras/ui/treesitter-context.lua | 21 +++++++++++++++++ lua/lazyvim/plugins/treesitter.lua | 23 ------------------- 3 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/ui/treesitter-context.lua diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 95267532..61f9cd86 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -452,7 +452,6 @@ return { -- buffer remove { "echasnovski/mini.bufremove", - keys = { { "bd", diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua new file mode 100644 index 00000000..a1f8d5f3 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua @@ -0,0 +1,21 @@ +-- Show context of the current function +return { + "nvim-treesitter/nvim-treesitter-context", + event = "LazyFile", + opts = { mode = "cursor", max_lines = 3 }, + keys = { + { + "ut", + function() + local tsc = require("treesitter-context") + tsc.toggle() + if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then + LazyVim.info("Enabled Treesitter Context", { title = "Option" }) + else + LazyVim.warn("Disabled Treesitter Context", { title = "Option" }) + end + end, + desc = "Toggle Treesitter Context", + }, + }, +} diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 97479b91..19aef89b 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -118,29 +118,6 @@ return { end, }, - -- Show context of the current function - { - "nvim-treesitter/nvim-treesitter-context", - event = "LazyFile", - enabled = true, - opts = { mode = "cursor", max_lines = 3 }, - keys = { - { - "ut", - function() - local tsc = require("treesitter-context") - tsc.toggle() - if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then - LazyVim.info("Enabled Treesitter Context", { title = "Option" }) - else - LazyVim.warn("Disabled Treesitter Context", { title = "Option" }) - end - end, - desc = "Toggle Treesitter Context", - }, - }, - }, - -- Automatically add closing tags for HTML and JSX { "windwp/nvim-ts-autotag", From 69e6daae2ccb4b7b7180e439c1b05d72d3c64e11 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:53:21 +0200 Subject: [PATCH 39/92] feat(ui)!: move `mini.indentscope` to an extra --- .../plugins/extras/ui/mini-indentscope.lua | 42 +++++++++++++++++++ lua/lazyvim/plugins/ui.lua | 36 +--------------- 2 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/ui/mini-indentscope.lua diff --git a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua new file mode 100644 index 00000000..a7632145 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua @@ -0,0 +1,42 @@ +return { + -- Active indent guide and indent text objects. When you're browsing + -- code, this highlights the current level of indentation, and animates + -- the highlighting. + { + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = "LazyFile", + opts = { + -- symbol = "▏", + symbol = "│", + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + event = "LazyFile", + opts = { + scope = { enabled = false }, + }, + }, +} diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index e983084f..c24b6e44 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -219,7 +219,7 @@ return { char = "│", tab_char = "│", }, - scope = { enabled = false }, + scope = { show_start = false, show_end = false }, exclude = { filetypes = { "help", @@ -239,40 +239,6 @@ return { main = "ibl", }, - -- Active indent guide and indent text objects. When you're browsing - -- code, this highlights the current level of indentation, and animates - -- the highlighting. - { - "echasnovski/mini.indentscope", - version = false, -- wait till new 0.7.0 release to put it back on semver - event = "LazyFile", - opts = { - -- symbol = "▏", - symbol = "│", - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - -- Displays a popup with possible key bindings of the command you started typing { "folke/which-key.nvim", From e37a699096ccb209c1babc29c1d5eeeab74102a1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:55:50 +0200 Subject: [PATCH 40/92] feat(mini.surround)!: move `mini.surround` to an extra --- lua/lazyvim/plugins/coding.lua | 37 ------------------- .../plugins/extras/coding/mini-surround.lua | 36 ++++++++++++++++++ lua/lazyvim/plugins/extras/editor/leap.lua | 1 + 3 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/coding/mini-surround.lua diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index d4070b4c..30331e10 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -181,43 +181,6 @@ return { }, }, - -- Fast and feature-rich surround actions. For text that includes - -- surrounding characters like brackets or quotes, this allows you - -- to select the text inside, change or modify the surrounding characters, - -- and more. - { - "echasnovski/mini.surround", - keys = function(_, keys) - -- Populate the keys based on the user's options - local plugin = require("lazy.core.config").spec.plugins["mini.surround"] - local opts = require("lazy.core.plugin").values(plugin, "opts", false) - local mappings = { - { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, - { opts.mappings.delete, desc = "Delete Surrounding" }, - { opts.mappings.find, desc = "Find Right Surrounding" }, - { opts.mappings.find_left, desc = "Find Left Surrounding" }, - { opts.mappings.highlight, desc = "Highlight Surrounding" }, - { opts.mappings.replace, desc = "Replace Surrounding" }, - { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, - } - mappings = vim.tbl_filter(function(m) - return m[1] and #m[1] > 0 - end, mappings) - return vim.list_extend(mappings, keys) - end, - opts = { - mappings = { - add = "gsa", -- Add surrounding in Normal and Visual modes - delete = "gsd", -- Delete surrounding - find = "gsf", -- Find surrounding (to the right) - find_left = "gsF", -- Find surrounding (to the left) - highlight = "gsh", -- Highlight surrounding - replace = "gsr", -- Replace surrounding - update_n_lines = "gsn", -- Update `n_lines` - }, - }, - }, - -- comments { "JoosepAlviste/nvim-ts-context-commentstring", diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua new file mode 100644 index 00000000..101903e6 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -0,0 +1,36 @@ +-- Fast and feature-rich surround actions. For text that includes +-- surrounding characters like brackets or quotes, this allows you +-- to select the text inside, change or modify the surrounding characters, +-- and more. +return { + "echasnovski/mini.surround", + keys = function(_, keys) + -- Populate the keys based on the user's options + local plugin = require("lazy.core.config").spec.plugins["mini.surround"] + local opts = require("lazy.core.plugin").values(plugin, "opts", false) + local mappings = { + { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, + { opts.mappings.delete, desc = "Delete Surrounding" }, + { opts.mappings.find, desc = "Find Right Surrounding" }, + { opts.mappings.find_left, desc = "Find Left Surrounding" }, + { opts.mappings.highlight, desc = "Highlight Surrounding" }, + { opts.mappings.replace, desc = "Replace Surrounding" }, + { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, + } + mappings = vim.tbl_filter(function(m) + return m[1] and #m[1] > 0 + end, mappings) + return vim.list_extend(mappings, keys) + end, + opts = { + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + replace = "gsr", -- Replace surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua index 19bfd4a8..afcdc4b7 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -38,6 +38,7 @@ return { -- rename surround mappings from gs to gz to prevent conflict with leap { "echasnovski/mini.surround", + optional = true, opts = { mappings = { add = "gza", -- Add surrounding in Normal and Visual modes From 4f4911ff95bc35438a2b8dd2d058b15f105f2ff1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 18:56:54 +0200 Subject: [PATCH 41/92] feat(coding)!: move `mini.ai` to an extra --- lua/lazyvim/plugins/coding.lua | 96 ------------------- lua/lazyvim/plugins/extras/coding/mini-ai.lua | 95 ++++++++++++++++++ 2 files changed, 95 insertions(+), 96 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/coding/mini-ai.lua diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 30331e10..a2a36581 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -208,100 +208,4 @@ return { end end, }, - - -- Better text-objects - { - "echasnovski/mini.ai", - -- keys = { - -- { "a", mode = { "x", "o" } }, - -- { "i", mode = { "x", "o" } }, - -- }, - event = "VeryLazy", - opts = function() - local ai = require("mini.ai") - return { - n_lines = 500, - custom_textobjects = { - o = ai.gen_spec.treesitter({ - a = { "@block.outer", "@conditional.outer", "@loop.outer" }, - i = { "@block.inner", "@conditional.inner", "@loop.inner" }, - }, {}), - f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), - c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), - t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, - d = { "%f[%d]%d+" }, -- digits - e = { -- Word with case - { - "%u[%l%d]+%f[^%l%d]", - "%f[%S][%l%d]+%f[^%l%d]", - "%f[%P][%l%d]+%f[^%l%d]", - "^[%l%d]+%f[^%l%d]", - }, - "^().*()$", - }, - g = function() -- Whole buffer, similar to `gg` and 'G' motion - local from = { line = 1, col = 1 } - local to = { - line = vim.fn.line("$"), - col = math.max(vim.fn.getline("$"):len(), 1), - } - return { from = from, to = to } - end, - u = ai.gen_spec.function_call(), -- u for "Usage" - U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name - }, - } - end, - config = function(_, opts) - require("mini.ai").setup(opts) - -- register all text objects with which-key - LazyVim.on_load("which-key.nvim", function() - ---@type table - local i = { - [" "] = "Whitespace", - ['"'] = 'Balanced "', - ["'"] = "Balanced '", - ["`"] = "Balanced `", - ["("] = "Balanced (", - [")"] = "Balanced ) including white-space", - [">"] = "Balanced > including white-space", - [""] = "Balanced <", - ["]"] = "Balanced ] including white-space", - ["["] = "Balanced [", - ["}"] = "Balanced } including white-space", - ["{"] = "Balanced {", - ["?"] = "User Prompt", - _ = "Underscore", - a = "Argument", - b = "Balanced ), ], }", - c = "Class", - d = "Digit(s)", - e = "Word in CamelCase & snake_case", - f = "Function", - g = "Entire file", - o = "Block, conditional, loop", - q = "Quote `, \", '", - t = "Tag", - u = "Use/call function & method", - U = "Use/call without dot in name", - } - local a = vim.deepcopy(i) - for k, v in pairs(a) do - a[k] = v:gsub(" including.*", "") - end - - local ic = vim.deepcopy(i) - local ac = vim.deepcopy(a) - for key, name in pairs({ n = "Next", l = "Last" }) do - i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic) - a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac) - end - require("which-key").register({ - mode = { "o", "x" }, - i = i, - a = a, - }) - end) - end, - }, } diff --git a/lua/lazyvim/plugins/extras/coding/mini-ai.lua b/lua/lazyvim/plugins/extras/coding/mini-ai.lua new file mode 100644 index 00000000..b97c248e --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/mini-ai.lua @@ -0,0 +1,95 @@ +-- Better text-objects +return { + "echasnovski/mini.ai", + -- keys = { + -- { "a", mode = { "x", "o" } }, + -- { "i", mode = { "x", "o" } }, + -- }, + event = "VeryLazy", + opts = function() + local ai = require("mini.ai") + return { + n_lines = 500, + custom_textobjects = { + o = ai.gen_spec.treesitter({ + a = { "@block.outer", "@conditional.outer", "@loop.outer" }, + i = { "@block.inner", "@conditional.inner", "@loop.inner" }, + }, {}), + f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), + c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), + t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, + d = { "%f[%d]%d+" }, -- digits + e = { -- Word with case + { + "%u[%l%d]+%f[^%l%d]", + "%f[%S][%l%d]+%f[^%l%d]", + "%f[%P][%l%d]+%f[^%l%d]", + "^[%l%d]+%f[^%l%d]", + }, + "^().*()$", + }, + g = function() -- Whole buffer, similar to `gg` and 'G' motion + local from = { line = 1, col = 1 } + local to = { + line = vim.fn.line("$"), + col = math.max(vim.fn.getline("$"):len(), 1), + } + return { from = from, to = to } + end, + u = ai.gen_spec.function_call(), -- u for "Usage" + U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name + }, + } + end, + config = function(_, opts) + require("mini.ai").setup(opts) + -- register all text objects with which-key + LazyVim.on_load("which-key.nvim", function() + ---@type table + local i = { + [" "] = "Whitespace", + ['"'] = 'Balanced "', + ["'"] = "Balanced '", + ["`"] = "Balanced `", + ["("] = "Balanced (", + [")"] = "Balanced ) including white-space", + [">"] = "Balanced > including white-space", + [""] = "Balanced <", + ["]"] = "Balanced ] including white-space", + ["["] = "Balanced [", + ["}"] = "Balanced } including white-space", + ["{"] = "Balanced {", + ["?"] = "User Prompt", + _ = "Underscore", + a = "Argument", + b = "Balanced ), ], }", + c = "Class", + d = "Digit(s)", + e = "Word in CamelCase & snake_case", + f = "Function", + g = "Entire file", + o = "Block, conditional, loop", + q = "Quote `, \", '", + t = "Tag", + u = "Use/call function & method", + U = "Use/call without dot in name", + } + local a = vim.deepcopy(i) + for k, v in pairs(a) do + a[k] = v:gsub(" including.*", "") + end + + local ic = vim.deepcopy(i) + local ac = vim.deepcopy(a) + for key, name in pairs({ n = "Next", l = "Last" }) do + i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic) + a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac) + end + require("which-key").register({ + mode = { "o", "x" }, + i = i, + a = a, + }) + end) + end, +} From 66dc9c09d6356ddc7e5870a4aa74824d3623d315 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 19:00:13 +0200 Subject: [PATCH 42/92] feat(util)!: move `vim-startuptime` to an extra --- lua/lazyvim/plugins/extras/util/startuptime.lua | 8 ++++++++ lua/lazyvim/plugins/util.lua | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/util/startuptime.lua diff --git a/lua/lazyvim/plugins/extras/util/startuptime.lua b/lua/lazyvim/plugins/extras/util/startuptime.lua new file mode 100644 index 00000000..5775b564 --- /dev/null +++ b/lua/lazyvim/plugins/extras/util/startuptime.lua @@ -0,0 +1,8 @@ +-- measure startuptime +return { + "dstein64/vim-startuptime", + cmd = "StartupTime", + config = function() + vim.g.startuptime_tries = 10 + end, +} diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index c3870889..cf5d9e03 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -1,14 +1,5 @@ return { - -- measure startuptime - { - "dstein64/vim-startuptime", - cmd = "StartupTime", - config = function() - vim.g.startuptime_tries = 10 - end, - }, - -- Session management. This saves your session in the background, -- keeping track of open buffers, window arrangement, and more. -- You can restore sessions when returning through the dashboard. From 20081460b65bc7a117933b0dcebbcaa4dcb82b23 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 20:52:53 +0200 Subject: [PATCH 43/92] feat(extras): added extra for the `nvim-treesitter` rewrite. Some plugins are not compatible and will be disabled. --- .../plugins/extras/ui/treesitter-rewrite.lua | 93 +++++++++++++++++++ lua/lazyvim/util/init.lua | 15 +++ 2 files changed, 108 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua new file mode 100644 index 00000000..034462d5 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua @@ -0,0 +1,93 @@ +-- backwards compatibility with the old treesitter config for adding custom parsers +local function patch() + local parsers = require("nvim-treesitter.parsers") + parsers.get_parser_configs = setmetatable({}, { + __call = function() + return parsers + end, + }) +end + +if vim.fn.executable("tree-sitter") == 0 then + LazyVim.error("**treesitter-rewrite** requires the `tree-sitter` executable to be installed") + return {} +end + +return { + { + "nvim-treesitter/nvim-treesitter", + version = false, -- last release is way too old and doesn't work on Windows + branch = "main", + build = ":TSUpdate", + lazy = false, + cmd = {}, + opts = function() + patch() + return { + highlight = { enable = true }, + indent = { enable = true }, + ensure_install = { + "bash", + "c", + "diff", + "html", + "javascript", + "jsdoc", + "json", + "jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "toml", + "tsx", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + }, + } + end, + init = function() end, + ---@param opts TSConfig + config = function(_, opts) + ---@return string[] + local function norm(ensure) + return ensure == nil and {} or type(ensure) == "string" and { ensure } or ensure + end + + -- ensure_installed is deprecated, but still supported + opts.ensure_install = LazyVim.dedup(vim.list_extend(norm(opts.ensure_install), norm(opts.ensure_installed))) + + require("nvim-treesitter").setup(opts) + patch() + + -- backwards compatibility with the old treesitter config for indent + if vim.tbl_get(opts, "indent", "enable") then + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end + + -- backwards compatibility with the old treesitter config for highlight + if vim.tbl_get(opts, "highlight", "enable") then + vim.api.nvim_create_autocmd("FileType", { + callback = function() + pcall(vim.treesitter.start) + end, + }) + end + end, + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + enabled = false, + }, + { + "windwp/nvim-ts-autotag", + enabled = false, + }, +} diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index f343c338..2d7be13f 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -170,4 +170,19 @@ function M.safe_keymap_set(mode, lhs, rhs, opts) end end +---@generic T +---@param list T[] +---@return T[] +function M.dedup(list) + local ret = {} + local seen = {} + for _, v in ipairs(list) do + if not seen[v] then + table.insert(ret, v) + seen[v] = true + end + end + return ret +end + return M From 73126e30c7d0a2e2e1ad78226a954d26dbffe841 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:06:45 +0200 Subject: [PATCH 44/92] docs: updated news for 11.0 release --- NEWS.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1ca0ea62..11477bcd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,30 @@ # What's new? +## 11.x + +Since Neovim 0.10 has been released, I've been working on a new version of **LazyVim** +that is fully compatible with all the latest Neovim features. + +Additionally, some core plugins have been moved to extras. + +- `native snippets` are not the default on Neovim 0.10 + Older versions of Neovim will use the new `luasnip` extra. + +- `native comments` are now the default on Neovim 0.10 + Older versions of Neovim will use the new `mini-comment` extra. + `nvim-ts-context-commentstring` has been integrated in the native comments. + +- plugins moved to extras: + + - `mini.ai` which I couldn't live without, but not everyone needs it + - `mini.surround` + - `mini.indentscope` scopes are now also highlighted with `indent-blankline` + - `nvim-treesitter-context` + +- There's a new extra for the `nvim-treesitter` **rewrite**. + Since the rewrite is not backward compatible, some plugins will be disabled + when you enable this extra: `vim-illuminate`, `nvim-ts-autotag`, and `nvim-ts-autotag`. + ## 10.x - added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md) From 2de7f24530eacd31b0089f45a8e6081b834b8ff9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:23:29 +0200 Subject: [PATCH 45/92] docs: update --- NEWS.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS.md b/NEWS.md index 11477bcd..0d425f43 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,18 @@ Additionally, some core plugins have been moved to extras. Older versions of Neovim will use the new `mini-comment` extra. `nvim-ts-context-commentstring` has been integrated in the native comments. +- `inlay hints` have been in **LazyVim** for a while, but are now + enabled by default. To disable then: + + ```lua + { + "nvim-lspconfig", + opts = { + inlay_hints = { enabled = true }, + } + } + ``` + - plugins moved to extras: - `mini.ai` which I couldn't live without, but not everyone needs it @@ -24,6 +36,7 @@ Additionally, some core plugins have been moved to extras. - There's a new extra for the `nvim-treesitter` **rewrite**. Since the rewrite is not backward compatible, some plugins will be disabled when you enable this extra: `vim-illuminate`, `nvim-ts-autotag`, and `nvim-ts-autotag`. + I would **NOT** recommend enabling this extra for now. ## 10.x From 960e958548adce7d96ff2e0c014ce2249897125e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:20:24 +0200 Subject: [PATCH 46/92] feat(lsp): enable inlay hints by default on Neovim 0.10 --- lua/lazyvim/plugins/lsp/init.lua | 44 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 26abffa0..41a89724 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -38,7 +38,7 @@ return { -- Be aware that you also will need to properly configure your LSP server to -- provide the inlay hints. inlay_hints = { - enabled = false, + enabled = true, }, -- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0 -- Be aware that you also will need to properly configure your LSP server to @@ -140,27 +140,29 @@ return { end end - -- inlay hints - if opts.inlay_hints.enabled then - LazyVim.lsp.on_attach(function(client, buffer) - if client.supports_method("textDocument/inlayHint") then - LazyVim.toggle.inlay_hints(buffer, true) - end - end) - end + if vim.fn.has("nvim-0.10") == 1 then + -- inlay hints + if opts.inlay_hints.enabled then + LazyVim.lsp.on_attach(function(client, buffer) + if client.supports_method("textDocument/inlayHint") then + LazyVim.toggle.inlay_hints(buffer, true) + end + end) + end - -- code lens - if opts.codelens.enabled and vim.lsp.codelens then - LazyVim.lsp.on_attach(function(client, buffer) - if client.supports_method("textDocument/codeLens") then - vim.lsp.codelens.refresh() - --- autocmd BufEnter,CursorHold,InsertLeave lua vim.lsp.codelens.refresh() - vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { - buffer = buffer, - callback = vim.lsp.codelens.refresh, - }) - end - end) + -- code lens + if opts.codelens.enabled and vim.lsp.codelens then + LazyVim.lsp.on_attach(function(client, buffer) + if client.supports_method("textDocument/codeLens") then + vim.lsp.codelens.refresh() + --- autocmd BufEnter,CursorHold,InsertLeave lua vim.lsp.codelens.refresh() + vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { + buffer = buffer, + callback = vim.lsp.codelens.refresh, + }) + end + end) + end end if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then From b739eb35033acaf20423920d103d5ad3e8350f23 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:21:58 +0200 Subject: [PATCH 47/92] fix(treesitter-rewrite): disable vim-illuminate --- lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua index 034462d5..d1b60c4c 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua @@ -13,6 +13,11 @@ if vim.fn.executable("tree-sitter") == 0 then return {} end +if vim.fn.has("nvim-0.10") == 0 then + LazyVim.error("**treesitter-rewrite** requires Neovim >= 0.10") + return {} +end + return { { "nvim-treesitter/nvim-treesitter", @@ -90,4 +95,8 @@ return { "windwp/nvim-ts-autotag", enabled = false, }, + { + "RRethy/vim-illuminate", + enabled = false, + }, } From 3b74ef793fb7cd8964231393a57b9e3c846b7d1e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:22:17 +0200 Subject: [PATCH 48/92] feat(keymaps): added leader-uI to open InspectTree --- lua/lazyvim/config/keymaps.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 71bc61b6..089448d1 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -139,6 +139,7 @@ map("n", "qq", "qa", { desc = "Quit All" }) -- highlights under cursor map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) +map("n", "uI", "InspectTree", { desc = "Inspect Tree" }) -- LazyVim Changelog map("n", "L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" }) From e7ee289c7fbaf4f22854ebbadf733e7bd8069794 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 19:27:11 +0000 Subject: [PATCH 49/92] chore(main): release 11.0.0 --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc9ff8ac..5b773b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ # Changelog +## [11.0.0](https://github.com/LazyVim/LazyVim/compare/v10.25.0...v11.0.0) (2024-05-16) + + +### ⚠ BREAKING CHANGES + +* **util:** move `vim-startuptime` to an extra +* **coding:** move `mini.ai` to an extra +* **mini.surround:** move `mini.surround` to an extra +* **ui:** move `mini.indentscope` to an extra +* **ui:** moved treesitter-context to an extra. No longer a core plugin +* **coding:** native snippets are now the default on Neovim 0.10. Install the luasnip extra to get luasnip back +* **coding:** use native comments on 0.10, with support for ts_context_commentstring + +### Features + +* **coding:** move `mini.ai` to an extra ([4f4911f](https://github.com/LazyVim/LazyVim/commit/4f4911ff95bc35438a2b8dd2d058b15f105f2ff1)) +* **coding:** native snippets are now the default on Neovim 0.10. Install the luasnip extra to get luasnip back ([3c4ebd5](https://github.com/LazyVim/LazyVim/commit/3c4ebd522e7c475cfedcee5dfa7a008e798c404c)) +* **coding:** use native comments on 0.10, with support for ts_context_commentstring ([d999be7](https://github.com/LazyVim/LazyVim/commit/d999be7401783e0f3a610319fa1b327d38fa3e52)) +* **extras:** added extra for the `nvim-treesitter` rewrite. Some plugins are not compatible and will be disabled. ([2008146](https://github.com/LazyVim/LazyVim/commit/20081460b65bc7a117933b0dcebbcaa4dcb82b23)) +* **keymaps:** added leader-uI to open InspectTree ([3b74ef7](https://github.com/LazyVim/LazyVim/commit/3b74ef793fb7cd8964231393a57b9e3c846b7d1e)) +* **lsp:** enable inlay hints by default on Neovim 0.10 ([960e958](https://github.com/LazyVim/LazyVim/commit/960e958548adce7d96ff2e0c014ce2249897125e)) +* **mini.surround:** move `mini.surround` to an extra ([e37a699](https://github.com/LazyVim/LazyVim/commit/e37a699096ccb209c1babc29c1d5eeeab74102a1)) +* **ui:** move `mini.indentscope` to an extra ([69e6daa](https://github.com/LazyVim/LazyVim/commit/69e6daae2ccb4b7b7180e439c1b05d72d3c64e11)) +* **ui:** moved treesitter-context to an extra. No longer a core plugin ([03704e2](https://github.com/LazyVim/LazyVim/commit/03704e22998be9db17f114acc4060d714fe652fb)) +* **util:** move `vim-startuptime` to an extra ([66dc9c0](https://github.com/LazyVim/LazyVim/commit/66dc9c09d6356ddc7e5870a4aa74824d3623d315)) +* **util:** set_upvalue ([f02507b](https://github.com/LazyVim/LazyVim/commit/f02507b1598379250baab293c423f79c393e28e5)) + + +### Bug Fixes + +* **cmp:** never auto bracket for snippets and correct prev char check. Fixes [#2949](https://github.com/LazyVim/LazyVim/issues/2949) ([6e7ba50](https://github.com/LazyVim/LazyVim/commit/6e7ba50141b1cda415c9391fd345a1e428bad9b6)) +* **dap:** add debugger to filetypes mapping for launch.json ([#3165](https://github.com/LazyVim/LazyVim/issues/3165)) ([183d6ee](https://github.com/LazyVim/LazyVim/commit/183d6eea606556c8bd7f80a70660c54670e04649)) +* **dap:** use jsonc support from plenary. Same as the code from neoconf. Fixes [#3174](https://github.com/LazyVim/LazyVim/issues/3174) ([8dae76c](https://github.com/LazyVim/LazyVim/commit/8dae76c1fd6fb90199b56cda8b6ec21576d02eb5)) +* **health:** add warning when not using 0.10.0 ([9fe8b15](https://github.com/LazyVim/LazyVim/commit/9fe8b15928077cb0c20aeea111b42f9698c78330)) +* **treesitter-rewrite:** disable vim-illuminate ([b739eb3](https://github.com/LazyVim/LazyVim/commit/b739eb35033acaf20423920d103d5ad3e8350f23)) + ## [10.25.0](https://github.com/LazyVim/LazyVim/compare/v10.24.0...v10.25.0) (2024-05-15) From 58cf6f971b78170aef5f26ccb79149213f4a692d Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Thu, 16 May 2024 23:02:26 +0300 Subject: [PATCH 50/92] fix(news.md): correct phrase to disable `inlay_hints` --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0d425f43..34edd6d6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,13 +15,13 @@ Additionally, some core plugins have been moved to extras. `nvim-ts-context-commentstring` has been integrated in the native comments. - `inlay hints` have been in **LazyVim** for a while, but are now - enabled by default. To disable then: + enabled by default. To disable them: ```lua { "nvim-lspconfig", opts = { - inlay_hints = { enabled = true }, + inlay_hints = { enabled = false }, } } ``` From 76f9dbb40c807738ba5516ea3b5da7e3b6886166 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 22:11:52 +0200 Subject: [PATCH 51/92] refactor: use LazyVim.opts --- lua/lazyvim/plugins/extras/coding/mini-surround.lua | 3 +-- lua/lazyvim/plugins/formatting.lua | 4 +--- lua/lazyvim/plugins/lsp/init.lua | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua index 101903e6..d8ff25c5 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-surround.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -6,8 +6,7 @@ return { "echasnovski/mini.surround", keys = function(_, keys) -- Populate the keys based on the user's options - local plugin = require("lazy.core.config").spec.plugins["mini.surround"] - local opts = require("lazy.core.plugin").values(plugin, "opts", false) + local opts = LazyVim.opts("mini.surround") local mappings = { { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, { opts.mappings.delete, desc = "Delete Surrounding" }, diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 718cb0f9..28dea8ed 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -54,9 +54,7 @@ return { priority = 100, primary = true, format = function(buf) - local plugin = require("lazy.core.config").plugins["conform.nvim"] - local Plugin = require("lazy.core.plugin") - local opts = Plugin.values(plugin, "opts", false) + local opts = LazyVim.opts("conform.nvim") require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf })) end, sources = function(buf) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 41a89724..f66b21a6 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -106,8 +106,7 @@ return { ---@param opts PluginLspOpts config = function(_, opts) if LazyVim.has("neoconf.nvim") then - local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"] - require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false)) + require("neoconf").setup(LazyVim.opts("neoconf.nvim")) end -- setup autoformat From 14872fa816fd770eba0f2b5efc69d5b29d4073fb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 22:14:57 +0200 Subject: [PATCH 52/92] fix(util): get opts from parsing specs instead of plugins --- lua/lazyvim/util/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 2d7be13f..d6907a60 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -72,7 +72,7 @@ end ---@param name string function M.opts(name) - local plugin = require("lazy.core.config").plugins[name] + local plugin = require("lazy.core.config").spec.plugins[name] if not plugin then return {} end From 639dfce0101cc6c0174e116872df91ccb30cb597 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Thu, 16 May 2024 23:28:25 +0300 Subject: [PATCH 53/92] fix(treesitter-rewrite): show error in Extras only when enabled (#3178) --- .../plugins/extras/ui/treesitter-rewrite.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua index d1b60c4c..8459c06e 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua @@ -8,14 +8,16 @@ local function patch() }) end -if vim.fn.executable("tree-sitter") == 0 then - LazyVim.error("**treesitter-rewrite** requires the `tree-sitter` executable to be installed") - return {} -end +if vim.tbl_contains(Config.json.data.extras, "lazyvim.plugins.extras.ui.treesitter-rewrite") then + if vim.fn.executable("tree-sitter") == 0 then + LazyVim.error("**treesitter-rewrite** requires the `tree-sitter` executable to be installed") + return {} + end -if vim.fn.has("nvim-0.10") == 0 then - LazyVim.error("**treesitter-rewrite** requires Neovim >= 0.10") - return {} + if vim.fn.has("nvim-0.10") == 0 then + LazyVim.error("**treesitter-rewrite** requires Neovim >= 0.10") + return {} + end end return { From 07923f3701af23504bb09bf6cc11c4fb0a1894e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 22:30:31 +0200 Subject: [PATCH 54/92] chore(main): release 11.0.1 (#3180) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b773b41..f6032f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [11.0.1](https://github.com/LazyVim/LazyVim/compare/v11.0.0...v11.0.1) (2024-05-16) + + +### Bug Fixes + +* **news.md:** correct phrase to disable `inlay_hints` ([58cf6f9](https://github.com/LazyVim/LazyVim/commit/58cf6f971b78170aef5f26ccb79149213f4a692d)) +* **treesitter-rewrite:** show error in Extras only when enabled ([#3178](https://github.com/LazyVim/LazyVim/issues/3178)) ([639dfce](https://github.com/LazyVim/LazyVim/commit/639dfce0101cc6c0174e116872df91ccb30cb597)) +* **util:** get opts from parsing specs instead of plugins ([14872fa](https://github.com/LazyVim/LazyVim/commit/14872fa816fd770eba0f2b5efc69d5b29d4073fb)) + ## [11.0.0](https://github.com/LazyVim/LazyVim/compare/v10.25.0...v11.0.0) (2024-05-16) From ec673a83ff387e29ca42367b3aab3c311950a024 Mon Sep 17 00:00:00 2001 From: Johnson Hu Date: Fri, 17 May 2024 01:52:25 -0500 Subject: [PATCH 55/92] fix(treesitter-rewrite): add missed local Config (#3188) --- lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua index 8459c06e..ef179d57 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua @@ -1,3 +1,5 @@ +local Config = require("lazyvim.config") + -- backwards compatibility with the old treesitter config for adding custom parsers local function patch() local parsers = require("nvim-treesitter.parsers") From 03653dbe35b12eabc92cf532dbac04c8de6d674b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 17 May 2024 06:52:57 +0000 Subject: [PATCH 56/92] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 6df78613..568a4638 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 16 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 17 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 960ec8079bb5960a510595dff21725ff403b2753 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 09:07:01 +0200 Subject: [PATCH 57/92] fix: deprecation warning on diagnostic.is_disabled --- lua/lazyvim/util/toggle.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index a377064e..9c224059 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -43,7 +43,9 @@ local enabled = true function M.diagnostics() -- if this Neovim version supports checking if diagnostics are enabled -- then use that for the current state - if vim.diagnostic.is_disabled then + if vim.diagnostic.is_enabled then + enabled = vim.diagnostic.is_enabled() + elseif vim.diagnostic.is_disabled then enabled = not vim.diagnostic.is_disabled() end enabled = not enabled From cc99b219ded16ec60120698d6e8f453c2f37132c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 09:12:45 +0200 Subject: [PATCH 58/92] feat(lsp): document highlights now use native lsp. `vim-illuminate` is available as an extra --- NEWS.md | 1 + lua/lazyvim/plugins/editor.lua | 40 ---------- .../plugins/extras/editor/illuminate.lua | 45 +++++++++++ lua/lazyvim/plugins/lsp/init.lua | 6 ++ lua/lazyvim/util/lsp.lua | 74 ++++++++++++++++++- 5 files changed, 125 insertions(+), 41 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/editor/illuminate.lua diff --git a/NEWS.md b/NEWS.md index 34edd6d6..adeab6ea 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,6 +32,7 @@ Additionally, some core plugins have been moved to extras. - `mini.surround` - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` + - `vim-illuminate`: document highlights now use native lsp functionality by default - There's a new extra for the `nvim-treesitter` **rewrite**. Since the rewrite is not backward compatible, some plugins will be disabled diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 61f9cd86..7bcf9973 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -409,46 +409,6 @@ return { }, }, - -- Automatically highlights other instances of the word under your cursor. - -- This works with LSP, Treesitter, and regexp matching to find the other - -- instances. - { - "RRethy/vim-illuminate", - event = "LazyFile", - opts = { - delay = 200, - large_file_cutoff = 2000, - large_file_overrides = { - providers = { "lsp" }, - }, - }, - config = function(_, opts) - require("illuminate").configure(opts) - - local function map(key, dir, buffer) - vim.keymap.set("n", key, function() - require("illuminate")["goto_" .. dir .. "_reference"](false) - end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) - end - - map("]]", "next") - map("[[", "prev") - - -- also set it after loading ftplugins, since a lot overwrite [[ and ]] - vim.api.nvim_create_autocmd("FileType", { - callback = function() - local buffer = vim.api.nvim_get_current_buf() - map("]]", "next", buffer) - map("[[", "prev", buffer) - end, - }) - end, - keys = { - { "]]", desc = "Next Reference" }, - { "[[", desc = "Prev Reference" }, - }, - }, - -- buffer remove { "echasnovski/mini.bufremove", diff --git a/lua/lazyvim/plugins/extras/editor/illuminate.lua b/lua/lazyvim/plugins/extras/editor/illuminate.lua new file mode 100644 index 00000000..6fef79b4 --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/illuminate.lua @@ -0,0 +1,45 @@ +-- Automatically highlights other instances of the word under your cursor. +-- This works with LSP, Treesitter, and regexp matching to find the other +-- instances. +return { + { + "RRethy/vim-illuminate", + event = "LazyFile", + opts = { + delay = 200, + large_file_cutoff = 2000, + large_file_overrides = { + providers = { "lsp" }, + }, + }, + config = function(_, opts) + require("illuminate").configure(opts) + + local function map(key, dir, buffer) + vim.keymap.set("n", key, function() + require("illuminate")["goto_" .. dir .. "_reference"](false) + end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) + end + + map("]]", "next") + map("[[", "prev") + + -- also set it after loading ftplugins, since a lot overwrite [[ and ]] + vim.api.nvim_create_autocmd("FileType", { + callback = function() + local buffer = vim.api.nvim_get_current_buf() + map("]]", "next", buffer) + map("[[", "prev", buffer) + end, + }) + end, + keys = { + { "]]", desc = "Next Reference" }, + { "[[", desc = "Prev Reference" }, + }, + }, + { + "neovim/nvim-lspconfig", + opts = { document_highlight = { enabed = false } }, + }, +} diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index f66b21a6..3a6ae964 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -46,6 +46,10 @@ return { codelens = { enabled = false, }, + -- Enable lsp cursor word highlighting + document_highlight = { + enabled = true, + }, -- add any global capabilities here capabilities = {}, -- options for vim.lsp.buf.format @@ -128,6 +132,8 @@ return { return ret end + LazyVim.lsp.words.setup(opts.document_highlight) + -- diagnostics signs if vim.fn.has("nvim-0.10.0") == 0 then if type(opts.diagnostics.signs) ~= "boolean" then diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index e712120a..c3a72ff6 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -21,7 +21,7 @@ function M.get_clients(opts) return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret end ----@param on_attach fun(client, buffer) +---@param on_attach fun(client:lsp.Client, buffer) function M.on_attach(on_attach) vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) @@ -125,4 +125,76 @@ function M.format(opts) end end +---@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}, current?:boolean} 1-0 indexed +M.words = {} +M.words.ns = vim.api.nvim_create_namespace("vim_lsp_references") + +---@param opts? {enabled?: boolean} +function M.words.setup(opts) + opts = opts or {} + if not opts.enabled then + return + end + M.on_attach(function(client, buf) + if client.supports_method("textDocument/documentHighlight") then + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, { + group = vim.api.nvim_create_augroup("lsp_word_" .. buf, { clear = true }), + buffer = buf, + callback = function(ev) + if not M.words.at() then + if ev.event:find("CursorMoved") then + vim.lsp.buf.clear_references() + else + vim.lsp.buf.document_highlight() + end + end + end, + }) + vim.keymap.set("n", "]]", function() + M.words.jump(vim.v.count1) + end, { buffer = buf }) + vim.keymap.set("n", "[[", function() + M.words.jump(-vim.v.count1) + end, { buffer = buf }) + end + end) +end + +---@return LspWord[] +function M.words.get() + local cursor = vim.api.nvim_win_get_cursor(0) + return vim.tbl_map(function(extmark) + local ret = { + from = { extmark[2] + 1, extmark[3] }, + to = { extmark[4].end_row + 1, extmark[4].end_col }, + } + if cursor[1] >= ret.from[1] and cursor[1] <= ret.to[1] and cursor[2] >= ret.from[2] and cursor[2] <= ret.to[2] then + ret.current = true + end + return ret + end, vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true })) +end + +---@param words? LspWord[] +---@return LspWord?, number? +function M.words.at(words) + for idx, word in ipairs(words or M.words.get()) do + if word.current then + return word, idx + end + end +end + +function M.words.jump(count) + local words = M.words.get() + local _, idx = M.words.at(words) + if not idx then + return + end + local target = words[idx + count] + if target then + vim.api.nvim_win_set_cursor(0, target.from) + end +end + return M From f8de965d3ec5712444a643b507bc9ddc7cb19d01 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 09:19:22 +0200 Subject: [PATCH 59/92] feat(options): new option to disable deprecation warnings. warnings will be hidden bydefault --- lua/lazyvim/config/init.lua | 4 ++++ lua/lazyvim/config/options.lua | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index cea25f8b..de200eda 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -275,6 +275,10 @@ function M.init() -- after installing missing plugins M.load("options") + if vim.g.deprecation_warnings == false then + vim.deprecate = function() end + end + LazyVim.plugin.setup() M.json.load() end diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 80223ad1..a1150151 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -25,6 +25,9 @@ vim.g.lazygit_config = true -- * powershell -- LazyVim.terminal.setup("pwsh") +-- Hide deprecation warnings +vim.g.deprecation_warnings = false + local opt = vim.opt opt.autowrite = true -- Enable auto write From 47c90209f34544b0b83fb16870d24b9f1d04bc33 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Fri, 17 May 2024 17:23:11 +1000 Subject: [PATCH 60/92] docs(news.md): fix typo in native snippets announcement (#3186) --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index adeab6ea..60e07692 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,7 @@ that is fully compatible with all the latest Neovim features. Additionally, some core plugins have been moved to extras. -- `native snippets` are not the default on Neovim 0.10 +- `native snippets` are now the default on Neovim 0.10 Older versions of Neovim will use the new `luasnip` extra. - `native comments` are now the default on Neovim 0.10 From 87493af2378fac7b518fd2c4db903cd3a2c27095 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 10:07:49 +0200 Subject: [PATCH 61/92] fix(lsp): dont try to highlight refs for deleted buffers --- lua/lazyvim/util/lsp.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index c3a72ff6..4df758a4 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -135,6 +135,14 @@ function M.words.setup(opts) if not opts.enabled then return end + local handler = vim.lsp.handlers["textDocument/documentHighlight"] + vim.lsp.handlers["textDocument/documentHighlight"] = function(err, result, ctx, config) + if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then + return + end + return handler(err, result, ctx, config) + end + M.on_attach(function(client, buf) if client.supports_method("textDocument/documentHighlight") then vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, { From 779de263f173f7e6f181d1e8faa475be8b05167d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 10:10:28 +0200 Subject: [PATCH 62/92] feat(util): `mini.bufremove` is no longer needed --- NEWS.md | 7 +++++- lua/lazyvim/config/keymaps.lua | 2 ++ lua/lazyvim/plugins/editor.lua | 27 ----------------------- lua/lazyvim/util/ui.lua | 39 ++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/NEWS.md b/NEWS.md index 60e07692..562e9fe8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,12 @@ ## 11.x +- new option `vim.g.deprecation_warnings` to disable deprecation warnings + Defaults to `false`. To disable, set it to `true` in your `options.lua` + +- `vim-illuminate` move to extras + Document highlights now use native lsp functionality by default + Since Neovim 0.10 has been released, I've been working on a new version of **LazyVim** that is fully compatible with all the latest Neovim features. @@ -32,7 +38,6 @@ Additionally, some core plugins have been moved to extras. - `mini.surround` - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` - - `vim-illuminate`: document highlights now use native lsp functionality by default - There's a new extra for the `nvim-treesitter` **rewrite**. Since the rewrite is not backward compatible, some plugins will be disabled diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 089448d1..7464f33e 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -37,6 +37,8 @@ map("n", "[b", "bprevious", { desc = "Prev Buffer" }) map("n", "]b", "bnext", { desc = "Next Buffer" }) map("n", "bb", "e #", { desc = "Switch to Other Buffer" }) map("n", "`", "e #", { desc = "Switch to Other Buffer" }) +map("n", "bd", LazyVim.ui.bufremove, { desc = "Delete Buffer" }) +map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) -- Clear search with map({ "i", "n" }, "", "noh", { desc = "Escape and Clear hlsearch" }) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 7bcf9973..b09d4f02 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -409,33 +409,6 @@ return { }, }, - -- buffer remove - { - "echasnovski/mini.bufremove", - keys = { - { - "bd", - function() - local bd = require("mini.bufremove").delete - if vim.bo.modified then - local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") - if choice == 1 then -- Yes - vim.cmd.write() - bd(0) - elseif choice == 2 then -- No - bd(0, true) - end - else - bd(0) - end - end, - desc = "Delete Buffer", - }, - -- stylua: ignore - { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, - }, - }, - -- better diagnostics list and others { "folke/trouble.nvim", diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 91339ca7..5e18a25a 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -208,4 +208,43 @@ function M.foldexpr() return "0" end +function M.bufremove() + local buf = vim.api.nvim_get_current_buf() + + if vim.bo.modified then + local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") + if choice == 0 then -- Cancel + return + end + if choice == 1 then -- Yes + vim.cmd.write() + end + end + + for _, win in ipairs(vim.fn.win_findbuf(buf)) do + vim.api.nvim_win_call(win, function() + if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then + return + end + -- Try using alternate buffer + local alt = vim.fn.bufnr("#") + if alt ~= buf and vim.fn.buflisted(alt) == 1 then + vim.api.nvim_win_set_buf(win, alt) + return + end + + -- Try using previous buffer + local has_previous = pcall(vim.cmd, "bprevious") + if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then + return + end + + -- Create new listed buffer + local new_buf = vim.api.nvim_create_buf(true, false) + vim.api.nvim_win_set_buf(win, new_buf) + end) + end + vim.api.nvim_buf_delete(buf, { force = true }) +end + return M From b1ea356e6c676571907ce654ec3878c530c636ad Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 17 May 2024 12:19:34 +0300 Subject: [PATCH 63/92] fix(util.lsp): add `desc` for keymaps reference (#3193) --- lua/lazyvim/util/lsp.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index 4df758a4..a4acdc19 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -160,10 +160,10 @@ function M.words.setup(opts) }) vim.keymap.set("n", "]]", function() M.words.jump(vim.v.count1) - end, { buffer = buf }) + end, { buffer = buf, desc = "Next reference" }) vim.keymap.set("n", "[[", function() M.words.jump(-vim.v.count1) - end, { buffer = buf }) + end, { buffer = buf, desc = "Previous reference" }) end end) end From 6aef1989bd1c08a828eecb7e9044bf8cc1d93700 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 13:15:12 +0200 Subject: [PATCH 64/92] chore(main): release 11.1.0 (#3190) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6032f49..fe7d5557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [11.1.0](https://github.com/LazyVim/LazyVim/compare/v11.0.1...v11.1.0) (2024-05-17) + + +### Features + +* **lsp:** document highlights now use native lsp. `vim-illuminate` is available as an extra ([cc99b21](https://github.com/LazyVim/LazyVim/commit/cc99b219ded16ec60120698d6e8f453c2f37132c)) +* **options:** new option to disable deprecation warnings. warnings will be hidden bydefault ([f8de965](https://github.com/LazyVim/LazyVim/commit/f8de965d3ec5712444a643b507bc9ddc7cb19d01)) +* **util:** `mini.bufremove` is no longer needed ([779de26](https://github.com/LazyVim/LazyVim/commit/779de263f173f7e6f181d1e8faa475be8b05167d)) + + +### Bug Fixes + +* deprecation warning on diagnostic.is_disabled ([960ec80](https://github.com/LazyVim/LazyVim/commit/960ec8079bb5960a510595dff21725ff403b2753)) +* **lsp:** dont try to highlight refs for deleted buffers ([87493af](https://github.com/LazyVim/LazyVim/commit/87493af2378fac7b518fd2c4db903cd3a2c27095)) +* **treesitter-rewrite:** add missed local Config ([#3188](https://github.com/LazyVim/LazyVim/issues/3188)) ([ec673a8](https://github.com/LazyVim/LazyVim/commit/ec673a83ff387e29ca42367b3aab3c311950a024)) +* **util.lsp:** add `desc` for keymaps reference ([#3193](https://github.com/LazyVim/LazyVim/issues/3193)) ([b1ea356](https://github.com/LazyVim/LazyVim/commit/b1ea356e6c676571907ce654ec3878c530c636ad)) + ## [11.0.1](https://github.com/LazyVim/LazyVim/compare/v11.0.0...v11.0.1) (2024-05-16) From 289c2f81c43d39b31a8b46a4a84ab9feb61bb235 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 14:26:25 +0200 Subject: [PATCH 65/92] perf(coding): dont load `vim.snippet` early --- lua/lazyvim/plugins/coding.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index a2a36581..3d2e910a 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -96,7 +96,7 @@ return { }, -- snippets - vim.snippet + vim.fn.has("nvim-0.10") == 1 and { "nvim-cmp", dependencies = { From 2e1c945f61821eec818a1512bc05b45366c0dfeb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 14:26:57 +0200 Subject: [PATCH 66/92] fix(bufferline): correctly configure bufferline to use the new bufremove util --- lua/lazyvim/plugins/ui.lua | 4 ++-- lua/lazyvim/util/ui.lua | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index c24b6e44..fdbe201f 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -71,9 +71,9 @@ return { opts = { options = { -- stylua: ignore - close_command = function(n) require("mini.bufremove").delete(n, false) end, + close_command = function(n) LazyVim.ui.bufremove(n) end, -- stylua: ignore - right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end, + right_mouse_command = function(n) LazyVim.ui.bufremove(n) end, diagnostics = "nvim_lsp", always_show_bufferline = false, diagnostics_indicator = function(_, _, diag) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 5e18a25a..4f454b41 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -208,8 +208,10 @@ function M.foldexpr() return "0" end -function M.bufremove() - local buf = vim.api.nvim_get_current_buf() +---@param buf number? +function M.bufremove(buf) + buf = buf or 0 + buf = buf == 0 and vim.api.nvim_get_current_buf() or buf if vim.bo.modified then local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") From c8b7912eb9efe3fd130e41c2c833c7662e53be1c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 14:35:42 +0200 Subject: [PATCH 67/92] chore(main): release 11.1.1 (#3196) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe7d5557..8e0593af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [11.1.1](https://github.com/LazyVim/LazyVim/compare/v11.1.0...v11.1.1) (2024-05-17) + + +### Bug Fixes + +* **bufferline:** correctly configure bufferline to use the new bufremove util ([2e1c945](https://github.com/LazyVim/LazyVim/commit/2e1c945f61821eec818a1512bc05b45366c0dfeb)) + + +### Performance Improvements + +* **coding:** dont load `vim.snippet` early ([289c2f8](https://github.com/LazyVim/LazyVim/commit/289c2f81c43d39b31a8b46a4a84ab9feb61bb235)) + ## [11.1.0](https://github.com/LazyVim/LazyVim/compare/v11.0.1...v11.1.0) (2024-05-17) From 19674e804787e205c587d153e8e9c4a3988e7f6c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 15:49:48 +0200 Subject: [PATCH 68/92] fix(util): use `bdelete` for buf remove --- lua/lazyvim/util/ui.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 4f454b41..a7bdc700 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -246,7 +246,9 @@ function M.bufremove(buf) vim.api.nvim_win_set_buf(win, new_buf) end) end - vim.api.nvim_buf_delete(buf, { force = true }) + if vim.api.nvim_buf_is_valid(buf) then + pcall(vim.cmd, "bdelete! " .. buf) + end end return M From 735f5905f85fec0dd5210f2c835597caa5a409fb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 15:53:23 +0200 Subject: [PATCH 69/92] chore(main): release 11.1.2 (#3198) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e0593af..a27abe47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [11.1.2](https://github.com/LazyVim/LazyVim/compare/v11.1.1...v11.1.2) (2024-05-17) + + +### Bug Fixes + +* **util:** use `bdelete` for buf remove ([19674e8](https://github.com/LazyVim/LazyVim/commit/19674e804787e205c587d153e8e9c4a3988e7f6c)) + ## [11.1.1](https://github.com/LazyVim/LazyVim/compare/v11.1.0...v11.1.1) (2024-05-17) From 23374f160a5b1b947681d55add56ab6ab15e219e Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 17 May 2024 21:06:17 +0300 Subject: [PATCH 70/92] fix(util.toggle): correctly toggle `inlay_hints` (#3202) `is_enabled` also accepts a `filter` and when we initially toggle `inlay_hints` on [here](https://github.com/LazyVim/LazyVim/blob/735f5905f85fec0dd5210f2c835597caa5a409fb/lua/lazyvim/plugins/lsp/init.lua#L153), we pass a `bufnr` which sets the `inlay_hints` in the `bufstate` (see [here](https://github.com/neovim/neovim/blob/42aa69b076cb338e20b5b4656771f1873e8930d8/runtime/lua/vim/lsp/inlay_hint.lua#L407-L432)), but when we call `is_enabled` without a filter table the returned result if from the `globalstate` (see [here](https://github.com/neovim/neovim/blob/42aa69b076cb338e20b5b4656771f1873e8930d8/runtime/lua/vim/lsp/inlay_hint.lua#L376-L388)). --- lua/lazyvim/util/toggle.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index 9c224059..543d4c13 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -67,7 +67,7 @@ function M.inlay_hints(buf, value) ih(buf, value) elseif type(ih) == "table" and ih.enable then if value == nil then - value = not ih.is_enabled(buf) + value = not ih.is_enabled({ bufnr = buf or 0 }) end ih.enable(value, { bufnr = buf }) end From 39bec71ce9489eee288544dca22015147636ae4d Mon Sep 17 00:00:00 2001 From: EJ Date: Fri, 17 May 2024 14:08:28 -0400 Subject: [PATCH 71/92] fix(refactoring): add label to refactoring key group (#3201) --- lua/lazyvim/plugins/extras/editor/refactoring.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/refactoring.lua b/lua/lazyvim/plugins/extras/editor/refactoring.lua index e5852a3c..cf6988a9 100644 --- a/lua/lazyvim/plugins/extras/editor/refactoring.lua +++ b/lua/lazyvim/plugins/extras/editor/refactoring.lua @@ -122,4 +122,15 @@ return { end end, }, + + -- which key integration + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["r"] = { name = "+refactor" }, + }, + }, + }, } From 87bb76612318f0c0b4fca675500e3afd0a9c6771 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 22:38:45 +0200 Subject: [PATCH 72/92] fix(treesitter): disable treesitter-rewrite extra for now. not ready yet --- lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua | 1 + lua/lazyvim/util/plugin.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua index ef179d57..9a8bab95 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua @@ -101,6 +101,7 @@ return { }, { "RRethy/vim-illuminate", + optional = true, enabled = false, }, } diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index ad13247a..0789b09f 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -11,6 +11,7 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.linting.nvim-lint"] = "`nvim-lint` is now the default **LazyVim** linter.", ["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.", ["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**", + ["lazyvim.plugins.extras.ui.treesitter-rewrite"] = "Disabled `treesitter-rewrite` extra for now. Not ready yet.", } M.deprecated_modules = { From 9176a6bc2214e2a1e3e6ed274b4e0cbd9789e03e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 May 2024 22:45:20 +0200 Subject: [PATCH 73/92] docs: remove mention of treesitter-rewrite from `NEWS.md` --- NEWS.md | 5 ----- lua/lazyvim/plugins/extras/coding/mini-ai.lua | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 562e9fe8..26929abc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -39,11 +39,6 @@ Additionally, some core plugins have been moved to extras. - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` -- There's a new extra for the `nvim-treesitter` **rewrite**. - Since the rewrite is not backward compatible, some plugins will be disabled - when you enable this extra: `vim-illuminate`, `nvim-ts-autotag`, and `nvim-ts-autotag`. - I would **NOT** recommend enabling this extra for now. - ## 10.x - added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md) diff --git a/lua/lazyvim/plugins/extras/coding/mini-ai.lua b/lua/lazyvim/plugins/extras/coding/mini-ai.lua index b97c248e..1408b841 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-ai.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-ai.lua @@ -1,6 +1,7 @@ -- Better text-objects return { "echasnovski/mini.ai", + desc = "Enhanced text objects", -- keys = { -- { "a", mode = { "x", "o" } }, -- { "i", mode = { "x", "o" } }, From dc66887b57ecdee8d33b5e07ca031288260e2971 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Sat, 18 May 2024 11:07:33 +0300 Subject: [PATCH 74/92] =?UTF-8?q?fix(mini.starter):=20buf=5Fid=20in=20refr?= =?UTF-8?q?esh()=20is=20not=20an=20identifier=20of=20valid=20=E2=80=A6=20(?= =?UTF-8?q?#3209)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(mini.starter): buf_id in refresh() is not an identifier of valid Starter buffer Fixes #3207. * fix(mini.starter): just do `do VimResized` for simpler approach --- lua/lazyvim/plugins/extras/ui/mini-starter.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 5f5ec9c5..ae5b3720 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -68,7 +68,9 @@ return { local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) local pad_footer = string.rep(" ", 8) starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" - pcall(starter.refresh) + -- INFO: Use `VimResized` to avoid the `buf_id in refresh() is not an identifier of valid Starter buffer`, + -- since `starter.refresh` executes on every `VimResized` see https://github.com/echasnovski/mini.starter/blob/f0c491032dcda485ee740716217cd4d5c25b6014/lua/mini/starter.lua#L352-L353 + vim.cmd([[do VimResized]]) end, }) end, From cf328429b14578ec7c254cc72ea40b7c56b17ea2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 18 May 2024 08:08:21 +0000 Subject: [PATCH 75/92] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 568a4638..b4aa3516 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 17 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 18 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 9c212d655a05c42331443f5d0d6dcc982108ed0e Mon Sep 17 00:00:00 2001 From: Stefan Boca <45266795+stefanboca@users.noreply.github.com> Date: Sat, 18 May 2024 01:11:05 -0700 Subject: [PATCH 76/92] fix(leap): add label to renamed surround mappings key group (#3211) --- lua/lazyvim/plugins/extras/editor/leap.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua index afcdc4b7..6145d641 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -51,6 +51,15 @@ return { }, }, }, + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["gz"] = { name = "+surround" }, + }, + }, + }, -- makes some plugins dot-repeatable like leap { "tpope/vim-repeat", event = "VeryLazy" }, From 08925421e840ac21f3feac28ee8b57319f0a4e59 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 11:27:41 +0200 Subject: [PATCH 77/92] fix(trouble-v3): add neovim version check --- lua/lazyvim/plugins/extras/editor/trouble-v3.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/trouble-v3.lua b/lua/lazyvim/plugins/extras/editor/trouble-v3.lua index 41a773d1..7995de8d 100644 --- a/lua/lazyvim/plugins/extras/editor/trouble-v3.lua +++ b/lua/lazyvim/plugins/extras/editor/trouble-v3.lua @@ -12,6 +12,13 @@ if vim.tbl_contains(Config.json.data.extras, "lazyvim.plugins.extras.editor.trou }) end end + if vim.fn.has("nvim-0.9.2") == 0 then + LazyVim.error({ + "Trouble v3 requires Neovim >= 0.9.2", + "Please update your Neovim version.", + }) + return {} + end end return { From 3a193d3aa89c8ff0327abb3e60600eab154af93a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 11:28:03 +0200 Subject: [PATCH 78/92] fix(indent-blankline): temp fix for `tbl_flatten` on `0.9.x` --- lua/lazyvim/plugins/ui.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index fdbe201f..55db2e6d 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -237,6 +237,13 @@ return { }, }, main = "ibl", + config = function(_, opts) + if vim.fn.has("nvim-0.10.0") == 0 then + local utils = require("ibl.utils") + utils.tbl_join = vim.tbl_flatten + end + require("ibl").setup(opts) + end, }, -- Displays a popup with possible key bindings of the command you started typing From 72abb893acc866ce574c66af7d9de861440a3a1f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 11:32:50 +0200 Subject: [PATCH 79/92] fix(bufferline): force update bufferline after `BufDelete`. Closes #3197 --- lua/lazyvim/plugins/ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 55db2e6d..1846ba0a 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -95,7 +95,7 @@ return { config = function(_, opts) require("bufferline").setup(opts) -- Fix bufferline when restoring a session - vim.api.nvim_create_autocmd("BufAdd", { + vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete" }, { callback = function() vim.schedule(function() pcall(nvim_bufferline) From 1d23c98da138494fafdad6735d70c3d3375bb7b2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 12:05:19 +0200 Subject: [PATCH 80/92] fix(comments): better way of using ts-context-commentstring with native comments --- lua/lazyvim/plugins/coding.lua | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 3d2e910a..74caa45d 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -188,24 +188,18 @@ return { opts = { enable_autocmd = false, }, - }, - { - import = "lazyvim.plugins.extras.coding.mini-comment", - enabled = function() + init = function() if vim.fn.has("nvim-0.10") == 1 then - -- Majestically override the native `get_commentstring` function. - vim.schedule(function() - LazyVim.inject.set_upvalue( - LazyVim.inject.get_upvalue(require("vim._comment").textobject, "get_comment_parts"), - "get_commentstring", - function() - return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring - end - ) - end) - else - return true + local get_option = vim.filetype.get_option + vim.filetype.get_option = function(filetype, option) + return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring() + or get_option(filetype, option) + end end end, }, + { + import = "lazyvim.plugins.extras.coding.mini-comment", + enabled = vim.fn.has("nvim-0.10") == 0, + }, } From c653c4a9a5c0a3cd5101ce86a3640ee12067ffcd Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 12:09:07 +0200 Subject: [PATCH 81/92] perf(comments): `vim.schedule` ts-context-commentstring integration --- lua/lazyvim/plugins/coding.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 74caa45d..0cbdd7b6 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -190,11 +190,13 @@ return { }, init = function() if vim.fn.has("nvim-0.10") == 1 then - local get_option = vim.filetype.get_option - vim.filetype.get_option = function(filetype, option) - return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring() - or get_option(filetype, option) - end + vim.schedule(function() + local get_option = vim.filetype.get_option + vim.filetype.get_option = function(filetype, option) + return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring() + or get_option(filetype, option) + end + end) end end, }, From 180d9516fd68ca8b881cf1028eeb65aa9c2e25b7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 12:10:32 +0200 Subject: [PATCH 82/92] fix(extras): remove treesitter-rewrite extra for now --- .../plugins/extras/ui/treesitter-rewrite.lua | 107 ------------------ 1 file changed, 107 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua b/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua deleted file mode 100644 index 9a8bab95..00000000 --- a/lua/lazyvim/plugins/extras/ui/treesitter-rewrite.lua +++ /dev/null @@ -1,107 +0,0 @@ -local Config = require("lazyvim.config") - --- backwards compatibility with the old treesitter config for adding custom parsers -local function patch() - local parsers = require("nvim-treesitter.parsers") - parsers.get_parser_configs = setmetatable({}, { - __call = function() - return parsers - end, - }) -end - -if vim.tbl_contains(Config.json.data.extras, "lazyvim.plugins.extras.ui.treesitter-rewrite") then - if vim.fn.executable("tree-sitter") == 0 then - LazyVim.error("**treesitter-rewrite** requires the `tree-sitter` executable to be installed") - return {} - end - - if vim.fn.has("nvim-0.10") == 0 then - LazyVim.error("**treesitter-rewrite** requires Neovim >= 0.10") - return {} - end -end - -return { - { - "nvim-treesitter/nvim-treesitter", - version = false, -- last release is way too old and doesn't work on Windows - branch = "main", - build = ":TSUpdate", - lazy = false, - cmd = {}, - opts = function() - patch() - return { - highlight = { enable = true }, - indent = { enable = true }, - ensure_install = { - "bash", - "c", - "diff", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", - }, - } - end, - init = function() end, - ---@param opts TSConfig - config = function(_, opts) - ---@return string[] - local function norm(ensure) - return ensure == nil and {} or type(ensure) == "string" and { ensure } or ensure - end - - -- ensure_installed is deprecated, but still supported - opts.ensure_install = LazyVim.dedup(vim.list_extend(norm(opts.ensure_install), norm(opts.ensure_installed))) - - require("nvim-treesitter").setup(opts) - patch() - - -- backwards compatibility with the old treesitter config for indent - if vim.tbl_get(opts, "indent", "enable") then - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - end - - -- backwards compatibility with the old treesitter config for highlight - if vim.tbl_get(opts, "highlight", "enable") then - vim.api.nvim_create_autocmd("FileType", { - callback = function() - pcall(vim.treesitter.start) - end, - }) - end - end, - }, - { - "nvim-treesitter/nvim-treesitter-textobjects", - enabled = false, - }, - { - "windwp/nvim-ts-autotag", - enabled = false, - }, - { - "RRethy/vim-illuminate", - optional = true, - enabled = false, - }, -} From 434883632cd6bc884f36da0282073307d585d6a1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 12:46:03 +0200 Subject: [PATCH 83/92] perf(yanky): switch to shada backend. It seems much faster than sqlite --- lua/lazyvim/plugins/extras/coding/yanky.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 3e3a3bbc..154951a0 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -2,10 +2,8 @@ return { -- better yank/paste { "gbprod/yanky.nvim", - dependencies = not LazyVim.is_win() and { "kkharji/sqlite.lua" } or {}, opts = { highlight = { timer = 150 }, - ring = { storage = LazyVim.is_win() and "shada" or "sqlite" }, }, keys = { -- stylua: ignore From 16eb3d947321992ebcddff6b997d403b41bd7411 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:11:50 +0200 Subject: [PATCH 84/92] feat(extras): added a recommended plugin/language section to `:LazyExtras` --- lua/lazyvim/util/extras.lua | 52 ++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 74ab4b4c..410466d9 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -16,12 +16,15 @@ local Text = require("lazy.view.text") ---@field desc? string ---@field enabled boolean ---@field managed boolean +---@field recommended? boolean ---@field row? number +---@field section? string ---@field plugins string[] ---@field optional string[] ---@class lazyvim.util.extras local M = {} +M.buf = 0 ---@type LazyExtraSource[] M.sources = { @@ -33,6 +36,24 @@ M.ns = vim.api.nvim_create_namespace("lazyvim.extras") ---@type string[] M.state = nil +---@param opts {ft?: string|string[], root?: string|string[]} +---@return boolean +function M.wants(opts) + if opts.ft then + opts.ft = type(opts.ft) == "string" and { opts.ft } or opts.ft + for _, f in ipairs(opts.ft) do + if vim.bo[M.buf].filetype == f then + return true + end + end + end + if opts.root then + opts.root = type(opts.root) == "string" and { opts.root } or opts.root + return #LazyVim.root.detectors.pattern(M.buf, opts.root) > 0 + end + return false +end + ---@return LazyExtra[] function M.get() M.state = M.state or LazyConfig.spec.modules @@ -74,6 +95,12 @@ function M.get_extra(source, modname) table.sort(plugins) table.sort(optional) + ---@type boolean|(fun():boolean?)|nil + local recommended = require(modname).recommended or false + if type(recommended) == "function" then + recommended = recommended() or false + end + ---@type LazyExtra return { source = source, @@ -81,6 +108,7 @@ function M.get_extra(source, modname) module = modname, enabled = enabled, desc = require(modname).desc, + recommended = recommended, managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled, plugins = plugins, optional = optional, @@ -97,6 +125,7 @@ local X = {} ---@return LazyExtraView function X.new() local self = setmetatable({}, { __index = X }) + M.buf = vim.api.nvim_get_current_buf() self.float = Float.new({ title = "LazyVim Extras" }) self.float:on_key("x", function() self:toggle() @@ -186,8 +215,14 @@ function X:render() :append("", "LazySpecial") :append(" key", "LazyComment") :nl() + for _, extra in ipairs(self.extras) do + extra.section = nil + end self:section({ enabled = true, title = "Enabled" }) - self:section({ enabled = false, title = "Disabled" }) + self:section({ recommended = true, filter = "^lang%.", title = "Recommended Languages", empty = false }) + self:section({ recommended = true, title = "Recommended Plugins", empty = false }) + self:section({ title = "Languages", filter = "^lang%." }) + self:section({ title = "Plugins" }) end ---@param extra LazyExtra @@ -206,6 +241,9 @@ function X:extra(extra) self.text:append(" " .. LazyConfig.options.ui.icons.not_loaded .. " ", hl) end self.text:append(extra.name) + if extra.recommended then + self.text:append(" "):append(LazyConfig.options.ui.icons.favorite or " ", "LazyCommit") + end if extra.source.name ~= "LazyVim" then self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent") end @@ -221,16 +259,24 @@ function X:extra(extra) self.text:nl() end ----@param opts {enabled?:boolean, title?:string} +---@param opts {enabled?:boolean, title:string, recommended?:boolean, filter?:string, empty?:boolean} function X:section(opts) opts = opts or {} ---@type LazyExtra[] local extras = vim.tbl_filter(function(extra) - return opts.enabled == nil or extra.enabled == opts.enabled + return extra.section == nil + and (opts.enabled == nil or extra.enabled == opts.enabled) + and (opts.recommended == nil or extra.recommended == opts.recommended) + and (opts.filter == nil or extra.name:find(opts.filter)) end, self.extras) + if opts.empty == false and #extras == 0 then + return + end + self.text:nl():append(opts.title .. ":", "LazyH2"):append(" (" .. #extras .. ")", "LazyComment"):nl() for _, extra in ipairs(extras) do + extra.section = opts.title self:extra(extra) end end From ef3bd3bd027209812c41b1d772e766c0ef18c503 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:12:21 +0200 Subject: [PATCH 85/92] feat(extras): tags some extras as recommended --- lua/lazyvim/plugins/extras/coding/copilot.lua | 2 +- lua/lazyvim/plugins/extras/coding/mini-ai.lua | 1 + .../plugins/extras/coding/mini-surround.lua | 1 + lua/lazyvim/plugins/extras/coding/yanky.lua | 50 +++++++------- lua/lazyvim/plugins/extras/dap/core.lua | 2 + lua/lazyvim/plugins/extras/editor/dial.lua | 2 + lua/lazyvim/plugins/extras/lang/python.lua | 13 ++++ .../plugins/extras/lang/typescript.lua | 13 ++++ lua/lazyvim/plugins/extras/test/core.lua | 2 + .../plugins/extras/ui/mini-animate.lua | 67 +++++++++---------- 10 files changed, 93 insertions(+), 60 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 86c54a6e..afe14f61 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -1,5 +1,5 @@ return { - + recommended = true, -- copilot { "zbirenbaum/copilot.lua", diff --git a/lua/lazyvim/plugins/extras/coding/mini-ai.lua b/lua/lazyvim/plugins/extras/coding/mini-ai.lua index 1408b841..7c4fdf70 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-ai.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-ai.lua @@ -2,6 +2,7 @@ return { "echasnovski/mini.ai", desc = "Enhanced text objects", + recommended = true, -- keys = { -- { "a", mode = { "x", "o" } }, -- { "i", mode = { "x", "o" } }, diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua index d8ff25c5..56d16a60 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-surround.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -4,6 +4,7 @@ -- and more. return { "echasnovski/mini.surround", + recommended = true, keys = function(_, keys) -- Populate the keys based on the user's options local opts = LazyVim.opts("mini.surround") diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 154951a0..b915bc7b 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -1,30 +1,30 @@ +-- better yank/paste return { - -- better yank/paste - { - "gbprod/yanky.nvim", - opts = { - highlight = { timer = 150 }, - }, - keys = { + "gbprod/yanky.nvim", + recommended = true, + desc = "Better Yank/Paste", + opts = { + highlight = { timer = 150 }, + }, + keys = { -- stylua: ignore { "p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, - { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, - { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Cursor" }, - { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Cursor" }, - { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Selection" }, - { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Selection" }, - { "[y", "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, - { "]y", "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, - { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, - { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, - { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, - { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, - { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, - { "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, - { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, - { "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, - { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, - { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, - }, + { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, + { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Cursor" }, + { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Cursor" }, + { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Selection" }, + { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Selection" }, + { "[y", "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, + { "]y", "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, + { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, + { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, + { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, + { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, + { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, + { "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, + { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, + { "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, + { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, + { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, }, } diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index fa6724b3..77864460 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -12,6 +12,8 @@ end return { "mfussenegger/nvim-dap", + recommended = true, + desc = "Debugging support. Requires language specific adapters to be configured. (see lang extras)", dependencies = { diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 72ecc926..cc262a33 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -15,6 +15,8 @@ end return { "monaqa/dial.nvim", + recommended = true, + desc = "Increment and decrement numbers, dates, and more", -- stylua: ignore keys = { { "", function() return M.dial(true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 3e7f5d59..f1e70548 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -9,6 +9,19 @@ local lsp = vim.g.lazyvim_python_lsp or "pyright" local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp" return { + recommended = function() + return LazyVim.extras.wants({ + ft = "python", + root = { + "pyproject.toml", + "setup.py", + "setup.cfg", + "requirements.txt", + "Pipfile", + "pyrightconfig.json", + }, + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index a1c6aba1..373775ce 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -10,6 +10,19 @@ local inlay_hints_settings = { } return { + recommended = function() + return LazyVim.extras.wants({ + ft = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + }, + root = { "tsconfig.json", "package.json", "jsconfig.json" }, + }) + end, -- add typescript to treesitter { diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index e7dbd792..9a91ccc3 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -1,4 +1,6 @@ return { + recommended = true, + desc = "Neotest support. Requires language specific adapters to be configured. (see lang extras)", { "folke/which-key.nvim", optional = true, diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index dd2f8cd7..cca34135 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -1,37 +1,36 @@ +-- animations return { - -- animations - { - "echasnovski/mini.animate", - event = "VeryLazy", - opts = function() - -- don't use animate when scrolling with the mouse - local mouse_scrolled = false - for _, scroll in ipairs({ "Up", "Down" }) do - local key = "" - vim.keymap.set({ "", "i" }, key, function() - mouse_scrolled = true - return key - end, { expr = true }) - end + "echasnovski/mini.animate", + recommended = true, + event = "VeryLazy", + opts = function() + -- don't use animate when scrolling with the mouse + local mouse_scrolled = false + for _, scroll in ipairs({ "Up", "Down" }) do + local key = "" + vim.keymap.set({ "", "i" }, key, function() + mouse_scrolled = true + return key + end, { expr = true }) + end - local animate = require("mini.animate") - return { - resize = { - timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), - }, - scroll = { - timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), - subscroll = animate.gen_subscroll.equal({ - predicate = function(total_scroll) - if mouse_scrolled then - mouse_scrolled = false - return false - end - return total_scroll > 1 - end, - }), - }, - } - end, - }, + local animate = require("mini.animate") + return { + resize = { + timing = animate.gen_timing.linear({ duration = 100, unit = "total" }), + }, + scroll = { + timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), + subscroll = animate.gen_subscroll.equal({ + predicate = function(total_scroll) + if mouse_scrolled then + mouse_scrolled = false + return false + end + return total_scroll > 1 + end, + }), + }, + } + end, } From 03ea7f6f98a874e26d258dbfe5b196c2d7c6971f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:38:53 +0200 Subject: [PATCH 86/92] feat(root): added support for `*.xxx` root patterns --- lua/lazyvim/util/root.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index c8de430d..f1167337 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -47,7 +47,17 @@ end function M.detectors.pattern(buf, patterns) patterns = type(patterns) == "string" and { patterns } or patterns local path = M.bufpath(buf) or vim.uv.cwd() - local pattern = vim.fs.find(patterns, { path = path, upward = true })[1] + local pattern = vim.fs.find(function(name) + for _, p in ipairs(patterns) do + if name == p then + return true + end + if p:sub(1, 1) == "*" and name:find(p:sub(2) .. "$") then + return true + end + end + return false + end, { path = path, upward = true })[1] return pattern and { vim.fs.dirname(pattern) } or {} end From c29213416b5e29fc56c465234dfd717f78a9e09f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:39:20 +0200 Subject: [PATCH 87/92] feat(extras): added recommended detectors for all languages --- lua/lazyvim/plugins/extras/lang/ansible.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/clangd.lua | 13 +++++++++++++ lua/lazyvim/plugins/extras/lang/cmake.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/docker.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/elixir.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/go.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/java.lua | 14 ++++++++++++++ lua/lazyvim/plugins/extras/lang/json.lua | 5 +++++ lua/lazyvim/plugins/extras/lang/markdown.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/omnisharp.lua | 7 +++++++ lua/lazyvim/plugins/extras/lang/ruby.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/rust.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/scala.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/tailwind.lua | 14 ++++++++++++++ lua/lazyvim/plugins/extras/lang/terraform.lua | 7 +++++++ lua/lazyvim/plugins/extras/lang/tex.lua | 6 ++++++ lua/lazyvim/plugins/extras/lang/vue.lua | 7 +++++++ lua/lazyvim/plugins/extras/lang/yaml.lua | 5 +++++ 18 files changed, 132 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/ansible.lua b/lua/lazyvim/plugins/extras/lang/ansible.lua index d1112115..5f080395 100644 --- a/lua/lazyvim/plugins/extras/lang/ansible.lua +++ b/lua/lazyvim/plugins/extras/lang/ansible.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "yaml.ansible", + root = { "ansible.cfg", ".ansible-lint" }, + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index b5d707d7..44e2f64c 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -1,4 +1,17 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, + root = { + ".clangd", + ".clang-tidy", + ".clang-format", + "compile_commands.json", + "compile_flags.txt", + "configure.ac", -- AutoTools + }, + }) + end, -- Add C/C++ to treesitter { diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 401669a3..a5bc804c 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "cmake", + root = { "CMakePresets.json", "CTestConfig.cmake", "cmake" }, + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index da9605ec..98a9be44 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "dockerfile", + root = { "Dockerfile", "docker-compose.yml", "compose.yml", "docker-compose.yaml", "compose.yaml" }, + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index f60dc18e..a6b9c260 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "elixir", "eelixir", "heex", "surface" }, + root = "mix.exs", + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 036eab6f..2ec43e22 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "go", "gomod", "gowork", "gotmpl" }, + root = { "go.work", "go.mod" }, + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 75b0805b..2d99a6cd 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -16,6 +16,20 @@ local function extend_or_override(config, custom, ...) end return { + recommended = function() + return LazyVim.extras.wants({ + ft = "java", + root = { + "build.gradle", + "build.gradle.kts", + "build.xml", -- Ant + "pom.xml", -- Maven + "settings.gradle", -- Gradle + "settings.gradle.kts", -- Gradle + }, + }) + end, + -- Add java to treesitter. { "nvim-treesitter/nvim-treesitter", diff --git a/lua/lazyvim/plugins/extras/lang/json.lua b/lua/lazyvim/plugins/extras/lang/json.lua index ff41ba4f..5f94caf7 100644 --- a/lua/lazyvim/plugins/extras/lang/json.lua +++ b/lua/lazyvim/plugins/extras/lang/json.lua @@ -1,4 +1,9 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "json", "jsonc", "json5" }, + }) + end, -- add json to treesitter { diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index e56e6de2..e290f174 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "markdown", + root = "README.md", + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index 3885dd08..74fd2bd2 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -1,4 +1,11 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "cs", "vb" }, + root = { "*.sln", "*.csproj", "omnisharp.json", "function.json" }, + }) + end, + { "Hoffs/omnisharp-extended-lsp.nvim", lazy = true }, { "nvim-treesitter/nvim-treesitter", diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index a7894692..40ff8005 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "ruby", + root = "Gemfile", + }) + end, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 6fe9e88e..98a166f5 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "rust", + root = { "Cargo.toml", "rust-project.json" }, + }) + end, -- Extend auto completion { diff --git a/lua/lazyvim/plugins/extras/lang/scala.lua b/lua/lazyvim/plugins/extras/lang/scala.lua index eca2db45..47c87b87 100644 --- a/lua/lazyvim/plugins/extras/lang/scala.lua +++ b/lua/lazyvim/plugins/extras/lang/scala.lua @@ -3,6 +3,12 @@ -- If you like you can setup your own key bindings. -- For minimalistic setup have a look at https://github.com/scalameta/nvim-metals/discussions/39 return { + recommended = function() + return LazyVim.extras.wants({ + ft = "scala", + root = { "build.sbt", "build.sc", "build.gradle", "pom.xml" }, + }) + end, { "hrsh7th/nvim-cmp", requires = { diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index 795449ee..17ed92ef 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -1,4 +1,18 @@ return { + recommended = function() + return LazyVim.extras.wants({ + root = { + "tailwind.config.js", + "tailwind.config.cjs", + "tailwind.config.mjs", + "tailwind.config.ts", + "postcss.config.js", + "postcss.config.cjs", + "postcss.config.mjs", + "postcss.config.ts", + }, + }) + end, { "neovim/nvim-lspconfig", opts = { diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 02c05793..e75a0eca 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -1,4 +1,11 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "terraform", "hcl" }, + root = ".terraform", + }) + end, + { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua index f8dacfb4..2d1bca56 100644 --- a/lua/lazyvim/plugins/extras/lang/tex.lua +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "tex", "plaintex", "bib" }, + root = { ".latexmkrc", ".texlabroot", "texlabroot", "Tectonic.toml" }, + }) + end, { "folke/which-key.nvim", optional = true, diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index a943874b..2ce87c03 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -1,4 +1,11 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "vue", + root = { "vue.config.js" }, + }) + end, + { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 9fd88a3b..0aa23a2b 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -1,4 +1,9 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = "yaml", + }) + end, -- add yaml specific modules to treesitter { From d514e2fa93a449329c2de64d569846102f24de0e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:47:31 +0200 Subject: [PATCH 88/92] feat(extras): added trouble-v3 and mini-hipatterns to recommended --- lua/lazyvim/plugins/extras/editor/trouble-v3.lua | 2 ++ lua/lazyvim/plugins/extras/util/mini-hipatterns.lua | 2 ++ lua/lazyvim/util/extras.lua | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/trouble-v3.lua b/lua/lazyvim/plugins/extras/editor/trouble-v3.lua index 7995de8d..9b6b8528 100644 --- a/lua/lazyvim/plugins/extras/editor/trouble-v3.lua +++ b/lua/lazyvim/plugins/extras/editor/trouble-v3.lua @@ -22,6 +22,8 @@ if vim.tbl_contains(Config.json.data.extras, "lazyvim.plugins.extras.editor.trou end return { + desc = "Trouble rewrite including document symbols and a lualine component", + recommended = true, { "folke/trouble.nvim", branch = "dev", diff --git a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua index 66e34c30..7c887088 100644 --- a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua +++ b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua @@ -5,6 +5,8 @@ M.hl = {} M.plugin = { "echasnovski/mini.hipatterns", + recommended = true, + desc = "Highlight colors in your code. Also includes Tailwind CSS support.", event = "LazyFile", opts = function() local hi = require("mini.hipatterns") diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 410466d9..773f6b9e 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -219,10 +219,10 @@ function X:render() extra.section = nil end self:section({ enabled = true, title = "Enabled" }) - self:section({ recommended = true, filter = "^lang%.", title = "Recommended Languages", empty = false }) + self:section({ recommended = true, include = "^lang%.", title = "Recommended Languages", empty = false }) self:section({ recommended = true, title = "Recommended Plugins", empty = false }) - self:section({ title = "Languages", filter = "^lang%." }) - self:section({ title = "Plugins" }) + self:section({ title = "Plugins", exclude = "^lang%." }) + self:section({ title = "Languages" }) end ---@param extra LazyExtra @@ -259,7 +259,7 @@ function X:extra(extra) self.text:nl() end ----@param opts {enabled?:boolean, title:string, recommended?:boolean, filter?:string, empty?:boolean} +---@param opts {enabled?:boolean, title:string, recommended?:boolean, include?:string, exclude?:string, empty?:boolean} function X:section(opts) opts = opts or {} ---@type LazyExtra[] @@ -267,7 +267,8 @@ function X:section(opts) return extra.section == nil and (opts.enabled == nil or extra.enabled == opts.enabled) and (opts.recommended == nil or extra.recommended == opts.recommended) - and (opts.filter == nil or extra.name:find(opts.filter)) + and (opts.include == nil or extra.name:find(opts.include)) + and (opts.exclude == nil or not extra.name:find(opts.exclude)) end, self.extras) if opts.empty == false and #extras == 0 then From 30b8169cb2e4836422b128d527d88550e04521d0 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 14:53:20 +0200 Subject: [PATCH 89/92] docs: updated news on new recommended extras --- NEWS.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index 26929abc..65503bc8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,14 @@ ## 11.x +- `:LazyExtras` now has multiple new sections: + + - **Enabled**: extras that are currently enabled + - **Recommended Languages**: language extras recommended for the current buffer / directory + - **Recommended Plugins**: extras that are recommended for most users + - **Plugins**: other plugin extras + - **Languages**: other language extras + - new option `vim.g.deprecation_warnings` to disable deprecation warnings Defaults to `false`. To disable, set it to `true` in your `options.lua` From 90809599810a46fb7b7e6e9eb8c2591f317aeacd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 15:07:54 +0200 Subject: [PATCH 90/92] chore(main): release 11.2.0 (#3206) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a27abe47..dd192b07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## [11.2.0](https://github.com/LazyVim/LazyVim/compare/v11.1.2...v11.2.0) (2024-05-18) + + +### Features + +* **extras:** added a recommended plugin/language section to `:LazyExtras` ([16eb3d9](https://github.com/LazyVim/LazyVim/commit/16eb3d947321992ebcddff6b997d403b41bd7411)) +* **extras:** added recommended detectors for all languages ([c292134](https://github.com/LazyVim/LazyVim/commit/c29213416b5e29fc56c465234dfd717f78a9e09f)) +* **extras:** added trouble-v3 and mini-hipatterns to recommended ([d514e2f](https://github.com/LazyVim/LazyVim/commit/d514e2fa93a449329c2de64d569846102f24de0e)) +* **extras:** tags some extras as recommended ([ef3bd3b](https://github.com/LazyVim/LazyVim/commit/ef3bd3bd027209812c41b1d772e766c0ef18c503)) +* **root:** added support for `*.xxx` root patterns ([03ea7f6](https://github.com/LazyVim/LazyVim/commit/03ea7f6f98a874e26d258dbfe5b196c2d7c6971f)) + + +### Bug Fixes + +* **bufferline:** force update bufferline after `BufDelete`. Closes [#3197](https://github.com/LazyVim/LazyVim/issues/3197) ([72abb89](https://github.com/LazyVim/LazyVim/commit/72abb893acc866ce574c66af7d9de861440a3a1f)) +* **comments:** better way of using ts-context-commentstring with native comments ([1d23c98](https://github.com/LazyVim/LazyVim/commit/1d23c98da138494fafdad6735d70c3d3375bb7b2)) +* **extras:** remove treesitter-rewrite extra for now ([180d951](https://github.com/LazyVim/LazyVim/commit/180d9516fd68ca8b881cf1028eeb65aa9c2e25b7)) +* **indent-blankline:** temp fix for `tbl_flatten` on `0.9.x` ([3a193d3](https://github.com/LazyVim/LazyVim/commit/3a193d3aa89c8ff0327abb3e60600eab154af93a)) +* **leap:** add label to renamed surround mappings key group ([#3211](https://github.com/LazyVim/LazyVim/issues/3211)) ([9c212d6](https://github.com/LazyVim/LazyVim/commit/9c212d655a05c42331443f5d0d6dcc982108ed0e)) +* **mini.starter:** buf_id in refresh() is not an identifier of valid … ([#3209](https://github.com/LazyVim/LazyVim/issues/3209)) ([dc66887](https://github.com/LazyVim/LazyVim/commit/dc66887b57ecdee8d33b5e07ca031288260e2971)) +* **refactoring:** add label to refactoring key group ([#3201](https://github.com/LazyVim/LazyVim/issues/3201)) ([39bec71](https://github.com/LazyVim/LazyVim/commit/39bec71ce9489eee288544dca22015147636ae4d)) +* **treesitter:** disable treesitter-rewrite extra for now. not ready yet ([87bb766](https://github.com/LazyVim/LazyVim/commit/87bb76612318f0c0b4fca675500e3afd0a9c6771)) +* **trouble-v3:** add neovim version check ([0892542](https://github.com/LazyVim/LazyVim/commit/08925421e840ac21f3feac28ee8b57319f0a4e59)) +* **util.toggle:** correctly toggle `inlay_hints` ([#3202](https://github.com/LazyVim/LazyVim/issues/3202)) ([23374f1](https://github.com/LazyVim/LazyVim/commit/23374f160a5b1b947681d55add56ab6ab15e219e)) + + +### Performance Improvements + +* **comments:** `vim.schedule` ts-context-commentstring integration ([c653c4a](https://github.com/LazyVim/LazyVim/commit/c653c4a9a5c0a3cd5101ce86a3640ee12067ffcd)) +* **yanky:** switch to shada backend. It seems much faster than sqlite ([4348836](https://github.com/LazyVim/LazyVim/commit/434883632cd6bc884f36da0282073307d585d6a1)) + ## [11.1.2](https://github.com/LazyVim/LazyVim/compare/v11.1.1...v11.1.2) (2024-05-17) From a4d83524a7179274c17414ebeb0a4e4b8d9a8706 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 15:46:28 +0200 Subject: [PATCH 91/92] fix(lsp): move next/prev reference keymaps to lsp keymaps. See #3220 --- lua/lazyvim/plugins/lsp/keymaps.lua | 4 +++- lua/lazyvim/util/lsp.lua | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 0f5aecb7..14626afd 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -39,7 +39,9 @@ function M.get() end, desc = "Source Action", has = "codeAction", - } + }, + { "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" }, + { "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" }, } if LazyVim.has("inc-rename.nvim") then M._keys[#M._keys + 1] = { diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index a4acdc19..e2eb82de 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -158,12 +158,6 @@ function M.words.setup(opts) end end, }) - vim.keymap.set("n", "]]", function() - M.words.jump(vim.v.count1) - end, { buffer = buf, desc = "Next reference" }) - vim.keymap.set("n", "[[", function() - M.words.jump(-vim.v.count1) - end, { buffer = buf, desc = "Previous reference" }) end end) end From eb6c9fb5784a8001c876203de174cd79e96bb637 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Sat, 18 May 2024 19:14:35 +0300 Subject: [PATCH 92/92] fix(mini.starter): changes based on echasnovski's recommendation (#3223) --- lua/lazyvim/plugins/extras/ui/mini-starter.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index ae5b3720..e6078d60 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -63,14 +63,15 @@ return { vim.api.nvim_create_autocmd("User", { pattern = "LazyVimStarted", - callback = function() + callback = function(ev) local stats = require("lazy").stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) local pad_footer = string.rep(" ", 8) starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" - -- INFO: Use `VimResized` to avoid the `buf_id in refresh() is not an identifier of valid Starter buffer`, - -- since `starter.refresh` executes on every `VimResized` see https://github.com/echasnovski/mini.starter/blob/f0c491032dcda485ee740716217cd4d5c25b6014/lua/mini/starter.lua#L352-L353 - vim.cmd([[do VimResized]]) + -- INFO: based on @echasnovski's recommendation (thanks a lot!!!) + if vim.bo[ev.buf].filetype == "starter" then + pcall(starter.refresh) + end end, }) end,