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 01/45] 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 02/45] 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 03/45] 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 04/45] 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 05/45] 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 06/45] 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 07/45] 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 08/45] 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 09/45] 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 10/45] 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 11/45] =?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 12/45] 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 13/45] 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 14/45] 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 15/45] 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 16/45] 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 17/45] 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 18/45] 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 19/45] 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 20/45] 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 21/45] 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 22/45] 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 23/45] 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 24/45] 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 25/45] 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 26/45] 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 27/45] 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 28/45] 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 29/45] 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, From 4bc9389bb5347bb6af119daa6dd16ee646436453 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 21:32:53 +0200 Subject: [PATCH 30/45] refactor(snippets): refactored snippet code --- lua/lazyvim/plugins/coding.lua | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 0cbdd7b6..19c7785b 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -115,38 +115,16 @@ return { { "", function() - if vim.snippet.active({ direction = 1 }) then - vim.schedule(function() - vim.snippet.jump(1) - end) - return - end - return "" + return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" end, expr = true, silent = true, - mode = "i", - }, - { - "", - function() - vim.schedule(function() - vim.snippet.jump(1) - end) - end, - silent = true, - mode = "s", + mode = { "i", "s" }, }, { "", function() - if vim.snippet.active({ direction = -1 }) then - vim.schedule(function() - vim.snippet.jump(-1) - end) - return - end - return "" + return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" end, expr = true, silent = true, From fe552853f5c065df2d79092c0cbac6745f8ea8fc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 21:37:25 +0200 Subject: [PATCH 31/45] fix(treesitter): refactored treesitter code and fixed nvim-treesitter-textobjects --- lua/lazyvim/plugins/treesitter.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 19aef89b..7d3b5e89 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -74,27 +74,23 @@ return { ---@param opts TSConfig config = function(_, opts) if type(opts.ensure_installed) == "table" then - ---@type table - local added = {} - opts.ensure_installed = vim.tbl_filter(function(lang) - if added[lang] then - return false - end - added[lang] = true - return true - end, opts.ensure_installed) + opts.ensure_installed = LazyVim.dedup(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, + event = "VeryLazy", + enabled = true, config = function() + -- If treesitter is already loaded, we need to run config again for textobjects + if LazyVim.is_loaded("nvim-treesitter") then + local opts = LazyVim.opts("nvim-treesitter") + require("nvim-treesitter.configs").setup({ textobjects = opts.textobjects }) + end + -- 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 From 4105c0ad3a441da3a31cc7d8e53305a6117f6ee5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 21:37:42 +0200 Subject: [PATCH 32/45] feat(util): added Util.is_loaded --- lua/lazyvim/util/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index d6907a60..bc13b730 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -16,6 +16,7 @@ local LazyUtil = require("lazy.core.util") ---@field news lazyvim.util.news ---@field json lazyvim.util.json ---@field lualine lazyvim.util.lualine +---@field mini lazyvim.util.mini local M = {} ---@type table @@ -126,11 +127,15 @@ function M.lazy_notify() timer:start(500, 0, replay) end +function M.is_loaded(name) + local Config = require("lazy.core.config") + return Config.plugins[name] and Config.plugins[name]._.loaded +end + ---@param name string ---@param fn fun(name:string) function M.on_load(name, fn) - local Config = require("lazy.core.config") - if Config.plugins[name] and Config.plugins[name]._.loaded then + if M.is_loaded(name) then fn(name) else vim.api.nvim_create_autocmd("User", { From d8644c47158fd28b88f5e3a90af6e5e6a0df2eba Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 21:52:16 +0200 Subject: [PATCH 33/45] feat(mini.ai): `mini.ai` is back in core with some improved features. Removing it was a mistake. --- NEWS.md | 4 +- lua/lazyvim/config/init.lua | 2 +- lua/lazyvim/plugins/coding.lua | 33 ++++++ lua/lazyvim/plugins/extras/coding/mini-ai.lua | 97 --------------- lua/lazyvim/plugins/xtras.lua | 10 +- lua/lazyvim/util/json.lua | 7 ++ lua/lazyvim/util/mini.lua | 112 ++++++++++++++++++ lua/lazyvim/util/plugin.lua | 1 + 8 files changed, 158 insertions(+), 108 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/coding/mini-ai.lua create mode 100644 lua/lazyvim/util/mini.lua diff --git a/NEWS.md b/NEWS.md index 65503bc8..754615b9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ ## 11.x +- `mini.ai` is back as a default plugin! Removing it was a mistake. + It's a great plugin that enhances the native text objects. + - `:LazyExtras` now has multiple new sections: - **Enabled**: extras that are currently enabled @@ -42,7 +45,6 @@ Additionally, some core plugins have been moved to extras. - 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` diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index de200eda..d990f94d 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -132,7 +132,7 @@ local defaults = { } M.json = { - version = 3, + version = 4, data = { version = nil, ---@type string? news = {}, ---@type table diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 19c7785b..4c023141 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -182,4 +182,37 @@ return { import = "lazyvim.plugins.extras.coding.mini-comment", enabled = vim.fn.has("nvim-0.10") == 0, }, + + -- Better text-objects + { + "echasnovski/mini.ai", + event = "VeryLazy", + opts = function() + LazyVim.on_load("which-key.nvim", function() + vim.schedule(LazyVim.mini.ai_whichkey) + end) + local ai = require("mini.ai") + return { + n_lines = 500, + custom_textobjects = { + o = ai.gen_spec.treesitter({ -- code block + 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" }), -- function + c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }), -- class + t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, -- tags + 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]" }, + "^().*()$", + }, + i = LazyVim.mini.ai_indent, -- indent + g = LazyVim.mini.ai_buffer, -- buffer + u = ai.gen_spec.function_call(), -- u for "Usage" + U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name + }, + } + end, + }, } diff --git a/lua/lazyvim/plugins/extras/coding/mini-ai.lua b/lua/lazyvim/plugins/extras/coding/mini-ai.lua deleted file mode 100644 index 7c4fdf70..00000000 --- a/lua/lazyvim/plugins/extras/coding/mini-ai.lua +++ /dev/null @@ -1,97 +0,0 @@ --- Better text-objects -return { - "echasnovski/mini.ai", - desc = "Enhanced text objects", - recommended = true, - -- 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/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 39a561a1..6f50ec5b 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -9,16 +9,8 @@ local prios = { ["lazyvim.plugins.extras.dap.core"] = 1, } -local used = {} ---@type table - ---@type string[] -Config.json.data.extras = vim.tbl_filter(function(extra) - if used[extra] then - return false - end - used[extra] = true - return true -end, Config.json.data.extras) +Config.json.data.extras = LazyVim.dedup(Config.json.data.extras) table.sort(Config.json.data.extras, function(a, b) local pa = prios[a] or 10 diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua index 3df7aecd..4196847e 100644 --- a/lua/lazyvim/util/json.lua +++ b/lua/lazyvim/util/json.lua @@ -78,6 +78,13 @@ function M.migrate() return extra == "lazyvim.plugins.extras.editor.symbols-outline" and "lazyvim.plugins.extras.editor.outline" or extra end, json.data.extras or {}) + elseif json.data.version == 3 then + json.data.extras = vim.tbl_filter(function(extra) + return not ( + extra == "lazyvim.plugins.extras.coding.mini-ai" + or extra == "lazyvim.plugins.extras.ui.treesitter-rewrite" + ) + end, json.data.extras or {}) end M.save() diff --git a/lua/lazyvim/util/mini.lua b/lua/lazyvim/util/mini.lua new file mode 100644 index 00000000..986a1887 --- /dev/null +++ b/lua/lazyvim/util/mini.lua @@ -0,0 +1,112 @@ +---@class lazyvim.util.mini +local M = {} + +---@alias Mini.ai.loc {line:number, col:number} +---@alias Mini.ai.region {from:Mini.ai.loc, to:Mini.ai.loc} + +-- Mini.ai indent text object +-- For "a", it will include the non-whitespace line surrounding the indent block. +-- "a" is line-wise, "i" is character-wise. +function M.ai_indent(ai_type) + local spaces = (" "):rep(vim.o.tabstop) + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) + local indents = {} ---@type {line: number, indent: number, text: string}[] + + for l, line in ipairs(lines) do + if not line:find("^%s*$") then + indents[#indents + 1] = { line = l, indent = #line:gsub("\t", spaces):match("^%s*"), text = line } + end + end + + local ret = {} ---@type (Mini.ai.region | {indent: number})[] + + for i = 1, #indents do + if i == 1 or indents[i - 1].indent < indents[i].indent then + local from, to = i, i + for j = i + 1, #indents do + if indents[j].indent < indents[i].indent then + break + end + to = j + end + from = ai_type == "a" and from > 1 and from - 1 or from + to = ai_type == "a" and to < #indents and to + 1 or to + ret[#ret + 1] = { + indent = indents[i].indent, + from = { line = indents[from].line, col = ai_type == "a" and 1 or indents[from].indent + 1 }, + to = { line = indents[to].line, col = #indents[to].text }, + } + end + end + + return ret +end + +-- taken from MiniExtra.gen_ai_spec.buffer +function M.ai_buffer(ai_type) + local start_line, end_line = 1, vim.fn.line("$") + if ai_type == "i" then + -- Skip first and last blank lines for `i` textobject + local first_nonblank, last_nonblank = vim.fn.nextnonblank(start_line), vim.fn.prevnonblank(end_line) + -- Do nothing for buffer with all blanks + if first_nonblank == 0 or last_nonblank == 0 then + return { from = { line = start_line, col = 1 } } + end + start_line, end_line = first_nonblank, last_nonblank + end + + local to_col = math.max(vim.fn.getline(end_line):len(), 1) + return { from = { line = start_line, col = 1 }, to = { line = end_line, col = to_col } } +end + +-- register all text objects with which-key +function M.ai_whichkey() + ---@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", + i = "Indent", + 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 + +return M diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 0789b09f..99e66ae5 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -12,6 +12,7 @@ M.deprecated_extras = { ["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.", + ["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a code LazyVim plugin (again)", } M.deprecated_modules = { From 4614666d1ee5864e95a08eb5b85808d7834ce85f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 21:53:19 +0200 Subject: [PATCH 34/45] fix(ibl): remove ibl fix since it's been fixed upstream --- lua/lazyvim/plugins/ui.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 1846ba0a..0d401f23 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -237,13 +237,6 @@ 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 649fa9d52188e0c28733402f2f65014fa73308bc Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Sun, 19 May 2024 01:40:54 +0545 Subject: [PATCH 35/45] fix(keymaps): delete lazygit keymap when using gitui (#2986) * fix(keymaps): delete lazygit keymap when using gitui * Update gitui.lua --- lua/lazyvim/plugins/extras/util/gitui.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/gitui.lua b/lua/lazyvim/plugins/extras/util/gitui.lua index 588cdbfd..ad044cd8 100644 --- a/lua/lazyvim/plugins/extras/util/gitui.lua +++ b/lua/lazyvim/plugins/extras/util/gitui.lua @@ -18,6 +18,8 @@ return { opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "gitui" }) + -- delete lazygit keymap for file history + vim.keymap.del("n", "gf") end, }, } From 96aa4b8877faa2fea30d2d4e2d3d117d9d3851f8 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 18 May 2024 16:31:13 -0400 Subject: [PATCH 36/45] fix(plugin): typo (#3225) --- lua/lazyvim/util/plugin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 99e66ae5..a1cb8f46 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -12,7 +12,7 @@ M.deprecated_extras = { ["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.", - ["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a code LazyVim plugin (again)", + ["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a core LazyVim plugin (again)", } M.deprecated_modules = { From 673975ebbe9870ded302bf3621e249bb4cd5f4f8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 23:28:35 +0200 Subject: [PATCH 37/45] feat(cmp): create undo point right before confirming a completion --- lua/lazyvim/plugins/coding.lua | 10 +++++++++- lua/lazyvim/util/init.lua | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 4c023141..db83a9f8 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -36,7 +36,15 @@ return { [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + if cmp.visible() then + LazyVim.create_undo() + if cmp.confirm({ select = true }) then + return + end + end + return fallback() + end, [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index bc13b730..3f30f517 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -190,4 +190,12 @@ function M.dedup(list) return ret end +M.CREATE_UNDO = vim.api.nvim_replace_termcodes("u", true, true, true) +function M.create_undo() + if vim.api.nvim_get_mode().mode == "i" then + dd("undo") + vim.api.nvim_feedkeys(M.CREATE_UNDO, "n", false) + end +end + return M From 32cdfa5e2681cd57510bf3c23a75f77d643cafb1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 23:30:40 +0200 Subject: [PATCH 38/45] chore(main): release 11.3.0 (#3221) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd192b07..d9249d8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [11.3.0](https://github.com/LazyVim/LazyVim/compare/v11.2.0...v11.3.0) (2024-05-18) + + +### Features + +* **cmp:** create undo point right before confirming a completion ([673975e](https://github.com/LazyVim/LazyVim/commit/673975ebbe9870ded302bf3621e249bb4cd5f4f8)) +* **mini.ai:** `mini.ai` is back in core with some improved features. Removing it was a mistake. ([d8644c4](https://github.com/LazyVim/LazyVim/commit/d8644c47158fd28b88f5e3a90af6e5e6a0df2eba)) +* **util:** added Util.is_loaded ([4105c0a](https://github.com/LazyVim/LazyVim/commit/4105c0ad3a441da3a31cc7d8e53305a6117f6ee5)) + + +### Bug Fixes + +* **ibl:** remove ibl fix since it's been fixed upstream ([4614666](https://github.com/LazyVim/LazyVim/commit/4614666d1ee5864e95a08eb5b85808d7834ce85f)) +* **keymaps:** delete lazygit keymap when using gitui ([#2986](https://github.com/LazyVim/LazyVim/issues/2986)) ([649fa9d](https://github.com/LazyVim/LazyVim/commit/649fa9d52188e0c28733402f2f65014fa73308bc)) +* **lsp:** move next/prev reference keymaps to lsp keymaps. See [#3220](https://github.com/LazyVim/LazyVim/issues/3220) ([a4d8352](https://github.com/LazyVim/LazyVim/commit/a4d83524a7179274c17414ebeb0a4e4b8d9a8706)) +* **mini.starter:** changes based on echasnovski's recommendation ([#3223](https://github.com/LazyVim/LazyVim/issues/3223)) ([eb6c9fb](https://github.com/LazyVim/LazyVim/commit/eb6c9fb5784a8001c876203de174cd79e96bb637)) +* **plugin:** typo ([#3225](https://github.com/LazyVim/LazyVim/issues/3225)) ([96aa4b8](https://github.com/LazyVim/LazyVim/commit/96aa4b8877faa2fea30d2d4e2d3d117d9d3851f8)) +* **treesitter:** refactored treesitter code and fixed nvim-treesitter-textobjects ([fe55285](https://github.com/LazyVim/LazyVim/commit/fe552853f5c065df2d79092c0cbac6745f8ea8fc)) + ## [11.2.0](https://github.com/LazyVim/LazyVim/compare/v11.1.2...v11.2.0) (2024-05-18) From 3a4672de3f8b6410de9fbd5b7134d5108d86f46c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 23:54:15 +0200 Subject: [PATCH 39/45] fix(util): fixup --- lua/lazyvim/util/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 3f30f517..433efda8 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -193,7 +193,6 @@ end M.CREATE_UNDO = vim.api.nvim_replace_termcodes("u", true, true, true) function M.create_undo() if vim.api.nvim_get_mode().mode == "i" then - dd("undo") vim.api.nvim_feedkeys(M.CREATE_UNDO, "n", false) end end From b0128b60bffd0d6a97ddd99af6179ebcd8a5096f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 23:55:59 +0200 Subject: [PATCH 40/45] chore(main): release 11.3.1 (#3226) 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 d9249d8a..b0606dd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [11.3.1](https://github.com/LazyVim/LazyVim/compare/v11.3.0...v11.3.1) (2024-05-18) + + +### Bug Fixes + +* **util:** fixup ([3a4672d](https://github.com/LazyVim/LazyVim/commit/3a4672de3f8b6410de9fbd5b7134d5108d86f46c)) + ## [11.3.0](https://github.com/LazyVim/LazyVim/compare/v11.2.0...v11.3.0) (2024-05-18) From 22c4eadef5920e0a77d537727868d4fa87f1c384 Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Sun, 19 May 2024 00:23:37 -0700 Subject: [PATCH 41/45] docs: Clarify vim.g.deprecation_warnings behavior (#3229) The previous wording was a little clunky (disable disabling). This removes the double negative. --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 754615b9..72882791 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,7 +14,7 @@ - **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` + Defaults to `false`. To enable deprecation warnings, set it to `true` in your `options.lua` - `vim-illuminate` move to extras Document highlights now use native lsp functionality by default From 74b7c9110e501f29fb4cc3fd025935984abadda8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 19 May 2024 07:24:09 +0000 Subject: [PATCH 42/45] 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 b4aa3516..774f7969 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 18 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 19 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e346d17812de516ad0789ede49b49a8b7ba213fe Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 19 May 2024 09:29:15 +0200 Subject: [PATCH 43/45] fix(gitui): properly delete lazygit keymap at the correct time. Fixes #3227 --- lua/lazyvim/plugins/extras/util/gitui.lua | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/gitui.lua b/lua/lazyvim/plugins/extras/util/gitui.lua index ad044cd8..d78c4f81 100644 --- a/lua/lazyvim/plugins/extras/util/gitui.lua +++ b/lua/lazyvim/plugins/extras/util/gitui.lua @@ -4,22 +4,34 @@ return { { "williamboman/mason.nvim", keys = { - { "gG", + { + "gG", function() LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false }) end, - desc = "GitUi (cwd)" }, - { "gg", + desc = "GitUi (cwd)", + }, + { + "gg", function() LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false }) end, - desc = "GitUi (Root Dir)" } + desc = "GitUi (Root Dir)", + }, }, + init = function() + -- delete lazygit keymap for file history + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimKeymaps", + once = true, + callback = function() + pcall(vim.keymap.del, "n", "gf") + end, + }) + end, opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "gitui" }) - -- delete lazygit keymap for file history - vim.keymap.del("n", "gf") end, }, } From 4208a09df8cd20fe491a5fdcc722c12fb07588dc Mon Sep 17 00:00:00 2001 From: Felipe Cury <26260549+flpcury@users.noreply.github.com> Date: Sun, 19 May 2024 16:30:03 +0900 Subject: [PATCH 44/45] fix(git): off-by-one issue in lazygit blame line (#3230) --- lua/lazyvim/util/lazygit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/lazygit.lua b/lua/lazyvim/util/lazygit.lua index 1b0d3922..a56e98c0 100644 --- a/lua/lazyvim/util/lazygit.lua +++ b/lua/lazyvim/util/lazygit.lua @@ -152,7 +152,7 @@ function M.blame_line(opts) border = "rounded", }, opts or {}) local cursor = vim.api.nvim_win_get_cursor(0) - local line = cursor[1] - 1 + local line = cursor[1] local file = vim.api.nvim_buf_get_name(0) local cmd = { "git", "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file } return require("lazy.util").float_cmd(cmd, opts) From ad22adab7d446018875de2dc96168295cad9298e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 19 May 2024 09:58:28 +0200 Subject: [PATCH 45/45] fix(cmp): only complete on `` when cmp is really visible. Dont wait till it might be visible. Faster and more correct imho --- 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 db83a9f8..9a3f674a 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -37,7 +37,7 @@ return { [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = function(fallback) - if cmp.visible() then + if cmp.core.view:visible() or vim.fn.pumvisible() == 1 then LazyVim.create_undo() if cmp.confirm({ select = true }) then return