From d5a9c54faf2a41355d4e2e14b050af188a49365a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 25 Jun 2023 07:21:19 +0200 Subject: [PATCH 001/513] fix(edgy): corrected filetype for symbols outline --- lua/lazyvim/plugins/extras/ui/edgy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 262d5500b2..fdc0d33082 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -109,7 +109,7 @@ return { if Util.has("symbols-outline.nvim") then table.insert(opts.left, { title = "Outline", - ft = "outline", + ft = "Outline", pinned = true, open = "SymbolsOutline", }) From e018d07cce1c92eb839e2661f96770785628bc98 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 25 Jun 2023 05:22:14 +0000 Subject: [PATCH 002/513] 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 b58ba31442..a7fcf67f73 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 24 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 25 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e9358d977a379e54d73dd29691d60f7a51ed6923 Mon Sep 17 00:00:00 2001 From: jyuan0 Date: Sun, 25 Jun 2023 04:05:07 -0400 Subject: [PATCH 003/513] fix(keymaps): remove redundant ':' on lazy keymap (#977) --- lua/lazyvim/config/keymaps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index feaba08519..93bc5b0c57 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -89,7 +89,7 @@ map("v", "<", "", ">gv") -- lazy -map("n", "l", ":Lazy", { desc = "Lazy" }) +map("n", "l", "Lazy", { desc = "Lazy" }) -- new file map("n", "fn", "enew", { desc = "New File" }) From f6f8436fe8696a8934a28a1fd21bf28409fee7ab Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 25 Jun 2023 19:50:30 +0200 Subject: [PATCH 004/513] feat(flash): enable flash in vscode --- lua/lazyvim/plugins/extras/editor/flash.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 1a64383a1f..c9169c146c 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -4,6 +4,7 @@ return { { "folke/flash.nvim", event = "VeryLazy", + vscode = true, ---@type Flash.Config opts = {}, keys = { From a40f257c797d5839bb07f0e48a312eaf5951aaf4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 25 Jun 2023 19:53:17 +0200 Subject: [PATCH 005/513] chore(main): release 4.18.0 (#976) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f148d39473..b67b1bed6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [4.18.0](https://github.com/LazyVim/LazyVim/compare/v4.17.0...v4.18.0) (2023-06-25) + + +### Features + +* **flash:** enable flash in vscode ([f6f8436](https://github.com/LazyVim/LazyVim/commit/f6f8436fe8696a8934a28a1fd21bf28409fee7ab)) + + +### Bug Fixes + +* **edgy:** corrected filetype for symbols outline ([d5a9c54](https://github.com/LazyVim/LazyVim/commit/d5a9c54faf2a41355d4e2e14b050af188a49365a)) +* **keymaps:** remove redundant ':' on lazy keymap ([#977](https://github.com/LazyVim/LazyVim/issues/977)) ([e9358d9](https://github.com/LazyVim/LazyVim/commit/e9358d977a379e54d73dd29691d60f7a51ed6923)) + ## [4.17.0](https://github.com/LazyVim/LazyVim/compare/v4.16.0...v4.17.0) (2023-06-24) From 5e6a07200c0cc0a21167a341c1f29bf27dc35f02 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 26 Jun 2023 21:35:03 +0200 Subject: [PATCH 006/513] feat(flash): added treesiter search to show ts node labels around search matches --- lua/lazyvim/plugins/extras/editor/flash.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index c9169c146c..0d55fd6fdf 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -32,6 +32,14 @@ return { end, desc = "Remote Flash", }, + { + "R", + mode = { "n", "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "Treesitter Search", + }, }, }, { From 5f89e4a142fae447568238ce3af477c03b67377b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 26 Jun 2023 19:35:53 +0000 Subject: [PATCH 007/513] 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 a7fcf67f73..419c9d9a12 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 25 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 26 ============================================================================== Table of Contents *LazyVim-table-of-contents* From c998be8fa4bd67bf130fdbc05f7c2198aa00441c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:58:57 +0200 Subject: [PATCH 008/513] chore(main): release 4.19.0 (#989) 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 b67b1bed6b..6df259ec9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.19.0](https://github.com/LazyVim/LazyVim/compare/v4.18.0...v4.19.0) (2023-06-26) + + +### Features + +* **flash:** added treesiter search to show ts node labels around search matches ([5e6a072](https://github.com/LazyVim/LazyVim/commit/5e6a07200c0cc0a21167a341c1f29bf27dc35f02)) + ## [4.18.0](https://github.com/LazyVim/LazyVim/compare/v4.17.0...v4.18.0) (2023-06-25) From c5759a451f8a5635b5c2d19c82636c8b66676a3b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 27 Jun 2023 22:02:27 +0200 Subject: [PATCH 009/513] fix(flash): don't override `R` in normal mode --- lua/lazyvim/plugins/extras/editor/flash.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 0d55fd6fdf..1b5ce5951c 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -34,7 +34,7 @@ return { }, { "R", - mode = { "n", "o", "x" }, + mode = { "o", "x" }, function() require("flash").treesitter_search() end, From d1eb9c89d3d2959d6d106b0c11c12b21fb3bbf50 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 27 Jun 2023 22:02:48 +0200 Subject: [PATCH 010/513] fix(mini.files): changed some window widths --- lua/lazyvim/plugins/extras/editor/mini-files.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index 0c2333a6a4..a9b318d8b7 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -3,6 +3,8 @@ return { opts = { windows = { preview = true, + width_focus = 30, + width_preview = 30, }, options = { -- Whether to use for editing directories @@ -30,8 +32,12 @@ return { require("mini.files").setup(opts) local show_dotfiles = true - local filter_show = function(fs_entry) return true end - local filter_hide = function(fs_entry) return not vim.startswith(fs_entry.name, ".") end + local filter_show = function(fs_entry) + return true + end + local filter_hide = function(fs_entry) + return not vim.startswith(fs_entry.name, ".") + end local toggle_dotfiles = function() show_dotfiles = not show_dotfiles From 240fa7631b8154ed47585e69417d40ceb084f713 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 27 Jun 2023 20:03:32 +0000 Subject: [PATCH 011/513] 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 419c9d9a12..b09e6d416d 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 26 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 27 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 296d79cfbcfe1dbf01ffa913d26d61f0f772b5e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 00:07:06 +0200 Subject: [PATCH 012/513] chore(main): release 4.19.1 (#995) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df259ec9b..4b511ab5b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [4.19.1](https://github.com/LazyVim/LazyVim/compare/v4.19.0...v4.19.1) (2023-06-27) + + +### Bug Fixes + +* **flash:** don't override `R` in normal mode ([c5759a4](https://github.com/LazyVim/LazyVim/commit/c5759a451f8a5635b5c2d19c82636c8b66676a3b)) +* **mini.files:** changed some window widths ([d1eb9c8](https://github.com/LazyVim/LazyVim/commit/d1eb9c89d3d2959d6d106b0c11c12b21fb3bbf50)) + ## [4.19.0](https://github.com/LazyVim/LazyVim/compare/v4.18.0...v4.19.0) (2023-06-26) From 27d3e45df61d6695357219dc72a71d41aac385e6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 28 Jun 2023 11:24:54 +0200 Subject: [PATCH 013/513] refactor(cmp): move comparator config to cmp spec --- lua/lazyvim/plugins/coding.lua | 2 ++ lua/lazyvim/plugins/extras/coding/copilot.lua | 23 ++----------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 41085ad2ba..ca43111d0c 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -44,6 +44,7 @@ return { opts = function() vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") + local defaults = require("cmp.config.default")() return { completion = { completeopt = "menu,menuone,noinsert", @@ -86,6 +87,7 @@ return { hl_group = "CmpGhostText", }, }, + sorting = defaults.sorting, } end, }, diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 764537f492..bed0d4e9c3 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -70,28 +70,9 @@ return { }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - local cmp = require("cmp") - table.insert(opts.sources, 1, { name = "copilot", group_index = 2 }) - - opts.sorting = { - priority_weight = 2, - comparators = { - require("copilot_cmp.comparators").prioritize, - - -- Below is the default comparitor list and order for nvim-cmp - cmp.config.compare.offset, - -- cmp.config.compare.scopes, --this is commented in nvim-cmp too - cmp.config.compare.exact, - cmp.config.compare.score, - cmp.config.compare.recently_used, - cmp.config.compare.locality, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - } + opts.sorting = opts.sorting or require("cmp.config.default")().sorting + table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize) end, }, } From a1820c1b428fc7f72fc31ea8465260b1816349ab Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 28 Jun 2023 11:25:20 +0200 Subject: [PATCH 014/513] feat(extras): added yanky extra (yank-ring) --- lua/lazyvim/plugins/extras/coding/yanky.lua | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/coding/yanky.lua diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua new file mode 100644 index 0000000000..2a0cc7465b --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -0,0 +1,32 @@ +return { + -- better yank/paste + { + "gbprod/yanky.nvim", + dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } }, + opts = { + highlight = { timer = 250 }, + ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, + }, + 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" }, + }, + }, +} From 5818e01f27c8b274f8c923937326a7cda60a00d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 28 Jun 2023 09:27:32 +0000 Subject: [PATCH 015/513] 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 b09e6d416d..2977906145 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 27 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 28 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e83d2c814f336470fa212cef2f03ceb8ac173012 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 28 Jun 2023 12:59:06 +0200 Subject: [PATCH 016/513] fix(yanky): use leader-p for telescope integration --- lua/lazyvim/plugins/extras/coding/yanky.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 2a0cc7465b..00b675e9f4 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -9,7 +9,7 @@ return { }, keys = { -- stylua: ignore - { "P", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, + { "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" }, From c03b9a3ff1fa1e6acc1db8d7db0c89c562637f7d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:06:32 +0200 Subject: [PATCH 017/513] chore(main): release 4.20.0 (#996) 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 4b511ab5b4..05e6fc4b53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [4.20.0](https://github.com/LazyVim/LazyVim/compare/v4.19.1...v4.20.0) (2023-06-28) + + +### Features + +* **extras:** added yanky extra (yank-ring) ([a1820c1](https://github.com/LazyVim/LazyVim/commit/a1820c1b428fc7f72fc31ea8465260b1816349ab)) + + +### Bug Fixes + +* **yanky:** use leader-p for telescope integration ([e83d2c8](https://github.com/LazyVim/LazyVim/commit/e83d2c814f336470fa212cef2f03ceb8ac173012)) + ## [4.19.1](https://github.com/LazyVim/LazyVim/compare/v4.19.0...v4.19.1) (2023-06-27) From 2f2c7a32a4115d06c3bb2b12e6d55f163d701bb3 Mon Sep 17 00:00:00 2001 From: JohnBish Date: Thu, 29 Jun 2023 02:03:05 -0400 Subject: [PATCH 018/513] fix(catppuccin): change nvim-tree integration to neo-tree for catppuccin/nvim plugin (#1003) --- lua/lazyvim/plugins/colorscheme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index a9d97b41f0..114fcfd4be 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -34,7 +34,7 @@ return { neotest = true, noice = true, notify = true, - nvimtree = true, + neotree = true, semantic_tokens = true, telescope = true, treesitter = true, From 0e33010937d9f759d5f6de04c2ef6f2340ff1483 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 29 Jun 2023 06:03:51 +0000 Subject: [PATCH 019/513] 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 2977906145..419ae11afd 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 28 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 29 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 8b1e7976a004d7e0cbaec37546d2889ddab48bbb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 29 Jun 2023 20:50:04 +0200 Subject: [PATCH 020/513] fix(yanky): don't override c-p insert mode telescope mapping. Fixes #1007 --- lua/lazyvim/plugins/extras/coding/yanky.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 00b675e9f4..f0bd966b08 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -3,10 +3,21 @@ return { { "gbprod/yanky.nvim", dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } }, - opts = { - highlight = { timer = 250 }, - ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, - }, + opts = function() + local mapping = require("yanky.telescope.mapping") + local mappings = mapping.get_defaults() + mappings.i[""] = nil + return { + highlight = { timer = 200 }, + ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, + picker = { + telescope = { + use_default_mappings = false, + mappings = mappings, + }, + }, + } + end, keys = { -- stylua: ignore { "p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, From 75d029c35b1349af78d4cb207b27e21683f17f92 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Jun 2023 21:07:35 +0200 Subject: [PATCH 021/513] chore(main): release 4.20.1 (#1004) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e6fc4b53..2b6a1c5c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [4.20.1](https://github.com/LazyVim/LazyVim/compare/v4.20.0...v4.20.1) (2023-06-29) + + +### Bug Fixes + +* **catppuccin:** change nvim-tree integration to neo-tree for catppuccin/nvim plugin ([#1003](https://github.com/LazyVim/LazyVim/issues/1003)) ([2f2c7a3](https://github.com/LazyVim/LazyVim/commit/2f2c7a32a4115d06c3bb2b12e6d55f163d701bb3)) +* **yanky:** don't override c-p insert mode telescope mapping. Fixes [#1007](https://github.com/LazyVim/LazyVim/issues/1007) ([8b1e797](https://github.com/LazyVim/LazyVim/commit/8b1e7976a004d7e0cbaec37546d2889ddab48bbb)) + ## [4.20.0](https://github.com/LazyVim/LazyVim/compare/v4.19.1...v4.20.0) (2023-06-28) From 65c70f6ad7e386b54d2aa6dbe137c37ee1d3cb88 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 30 Jun 2023 08:35:26 +0200 Subject: [PATCH 022/513] fix(autocmds): dont jump to last loc in gitcommit buffers --- lua/lazyvim/config/autocmds.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index ecbd18a3d4..132b6cdf49 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -30,10 +30,15 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { vim.api.nvim_create_autocmd("BufReadPost", { group = augroup("last_loc"), callback = function() - local mark = vim.api.nvim_buf_get_mark(0, '"') - local lcount = vim.api.nvim_buf_line_count(0) + local exclude = { "gitcommit" } + local buf = vim.api.nvim_get_current_buf() + if vim.tbl_contains(exclude, vim.bo[buf].filetype) then + return + end + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) + pcall(vim.api.nvim_win_set_cursor, buf, mark) end end, }) From 146bc4f172ce96ccc7f462cf7951cb26a9a41e5b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 30 Jun 2023 06:36:06 +0000 Subject: [PATCH 023/513] 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 419ae11afd..5bc74a89c6 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 29 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 30 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 3d0de235eca0ea6987947e4a7c47f1393e42dfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Fri, 30 Jun 2023 03:41:48 -0300 Subject: [PATCH 024/513] feat(extra): Add Elixir support and config (#993) --- lua/lazyvim/plugins/extras/lang/elixir.lua | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/elixir.lua diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua new file mode 100644 index 0000000000..757afb073f --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -0,0 +1,32 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + "elixir", + "heex", + "eex", + }) + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + "elixir-ls", + }) + end, + }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "jfpedroza/neotest-elixir", + }, + opts = { + adapters = { + ["neotest-elixir"] = {}, + }, + }, + }, +} From 5a441f897247b130c1ffb78bb37fd3a16d2250de Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 30 Jun 2023 02:55:18 -0400 Subject: [PATCH 025/513] feat(lang): Add Rust config (#1012) --- lua/lazyvim/plugins/extras/lang/rust.lua | 132 +++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/rust.lua diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua new file mode 100644 index 0000000000..4ac5896b63 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -0,0 +1,132 @@ +return { + + -- Extend auto completion + { + "hrsh7th/nvim-cmp", + dependencies = { + { + "Saecki/crates.nvim", + event = { "BufRead Cargo.toml" }, + config = true, + }, + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { + { name = "crates" }, + })) + end, + }, + + -- Add Rust & related to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" }) + end + end, + }, + + -- Ensure Rust debugger is installed + { + "williamboman/mason.nvim", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "codelldb" }) + end + end, + }, + + -- Correctly setup lspconfig for Rust 🚀 + { + "neovim/nvim-lspconfig", + dependencies = { "simrat39/rust-tools.nvim" }, + opts = { + servers = { + -- Ensure mason installs the server + rust_analyzer = {}, + taplo = {}, + }, + setup = { + rust_analyzer = function(_, opts) + require("lazyvim.util").on_attach(function(client, buffer) + -- stylua: ignore + if client.name == "rust_analyzer" then + vim.keymap.set("n", "K", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" }) + vim.keymap.set("n", "cR", "RustCodeAction", { buffer = buffer, desc = "Code Action (Rust)" }) + vim.keymap.set("n", "dr", "RustDebuggables", { buffer = buffer, desc = "Run Debuggables (Rust)" }) + end + end) + local mason_registry = require("mason-registry") + -- rust tools configuration for debugging support + local codelldb = mason_registry.get_package("codelldb") + local extension_path = codelldb:get_install_path() .. "/extension/" + local codelldb_path = extension_path .. "adapter/codelldb" + local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib" + or extension_path .. "lldb/lib/liblldb.so" + local rust_tools_opts = vim.tbl_deep_extend("force", opts, { + dap = { + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + }, + tools = { + on_initialized = function() + vim.cmd([[ + augroup RustLSP + autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() + autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() + autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() + augroup END + ]]) + end, + }, + server = { + settings = { + ["rust-analyzer"] = { + cargo = { + allFeatures = true, + loadOutDirsFromCheck = true, + runBuildScripts = true, + }, + -- Add clippy lints for Rust. + checkOnSave = { + allFeatures = true, + command = "clippy", + extraArgs = { "--no-deps" }, + }, + procMacro = { + enable = true, + ignored = { + ["async-trait"] = { "async_trait" }, + ["napi-derive"] = { "napi" }, + ["async-recursion"] = { "async_recursion" }, + }, + }, + }, + }, + }, + }) + require("rust-tools").setup(rust_tools_opts) + return true + end, + taplo = function(_, _) + local function show_documentation() + if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then + require("crates").show_popup() + else + vim.lsp.buf.hover() + end + end + require("lazyvim.util").on_attach(function(client, buffer) + -- stylua: ignore + if client.name == "taplo" then + vim.keymap.set("n", "K", show_documentation, { buffer = buffer, desc = "Show Crate Documentation" }) + end + end) + return false -- make sure the base implementation calls taplo.setup + end, + }, + }, + }, +} From 37d7ccdea18a854274b6e6d1e871dd73863ebe4c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 09:03:44 +0200 Subject: [PATCH 026/513] chore(main): release 4.21.0 (#1011) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b6a1c5c30..af5ee22c96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [4.21.0](https://github.com/LazyVim/LazyVim/compare/v4.20.1...v4.21.0) (2023-06-30) + + +### Features + +* **extra:** Add Elixir support and config ([#993](https://github.com/LazyVim/LazyVim/issues/993)) ([3d0de23](https://github.com/LazyVim/LazyVim/commit/3d0de235eca0ea6987947e4a7c47f1393e42dfb2)) +* **lang:** Add Rust config ([#1012](https://github.com/LazyVim/LazyVim/issues/1012)) ([5a441f8](https://github.com/LazyVim/LazyVim/commit/5a441f897247b130c1ffb78bb37fd3a16d2250de)) + + +### Bug Fixes + +* **autocmds:** dont jump to last loc in gitcommit buffers ([65c70f6](https://github.com/LazyVim/LazyVim/commit/65c70f6ad7e386b54d2aa6dbe137c37ee1d3cb88)) + ## [4.20.1](https://github.com/LazyVim/LazyVim/compare/v4.20.0...v4.20.1) (2023-06-29) From c992ebec468b2e60f1138fd85055118016c62165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Freitas?= Date: Fri, 30 Jun 2023 15:03:22 +0100 Subject: [PATCH 027/513] fix(lang): indentation in rust lang extra (#1017) --- lua/lazyvim/plugins/extras/lang/rust.lua | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 4ac5896b63..24c4f02b16 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -53,11 +53,11 @@ return { rust_analyzer = function(_, opts) require("lazyvim.util").on_attach(function(client, buffer) -- stylua: ignore - if client.name == "rust_analyzer" then - vim.keymap.set("n", "K", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" }) - vim.keymap.set("n", "cR", "RustCodeAction", { buffer = buffer, desc = "Code Action (Rust)" }) - vim.keymap.set("n", "dr", "RustDebuggables", { buffer = buffer, desc = "Run Debuggables (Rust)" }) - end + if client.name == "rust_analyzer" then + vim.keymap.set("n", "K", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" }) + vim.keymap.set( "n", "cR", "RustCodeAction", { buffer = buffer, desc = "Code Action (Rust)" }) + vim.keymap.set( "n", "dr", "RustDebuggables", { buffer = buffer, desc = "Run Debuggables (Rust)" }) + end end) local mason_registry = require("mason-registry") -- rust tools configuration for debugging support @@ -73,12 +73,12 @@ return { tools = { on_initialized = function() vim.cmd([[ - augroup RustLSP - autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() - autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() - autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() - augroup END - ]]) + augroup RustLSP + autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() + autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() + autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() + augroup END + ]]) end, }, server = { @@ -119,10 +119,9 @@ return { end end require("lazyvim.util").on_attach(function(client, buffer) - -- stylua: ignore - if client.name == "taplo" then - vim.keymap.set("n", "K", show_documentation, { buffer = buffer, desc = "Show Crate Documentation" }) - end + if client.name == "taplo" then + vim.keymap.set("n", "K", show_documentation, { buffer = buffer, desc = "Show Crate Documentation" }) + end end) return false -- make sure the base implementation calls taplo.setup end, From 79b1c92dd22020b2a5ed1dbd6e6bb86242207785 Mon Sep 17 00:00:00 2001 From: loqusion Date: Fri, 30 Jun 2023 09:19:00 -0500 Subject: [PATCH 028/513] feat(rust): rust improvements (#1015) * fix(rust): move lspconfig opts to correct location lspconfig's `opts` goes in rust-tools's `opts.server`; see https://github.com/simrat39/rust-tools.nvim#configuration * feat(rust): add neotest-rust * feat(rust): allow user to extend rust-tools with `opts` Also avoids calling rust-tools's `setup()` twice. * style(rust): fix indentation for stylua comment --- lua/lazyvim/plugins/extras/lang/rust.lua | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 24c4f02b16..4e9dff8083 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -42,7 +42,11 @@ return { -- Correctly setup lspconfig for Rust 🚀 { "neovim/nvim-lspconfig", - dependencies = { "simrat39/rust-tools.nvim" }, + dependencies = { + "simrat39/rust-tools.nvim", + -- Avoid calling setup twice if user supplies `opts` + config = function() end, + }, opts = { servers = { -- Ensure mason installs the server @@ -52,7 +56,7 @@ return { setup = { rust_analyzer = function(_, opts) require("lazyvim.util").on_attach(function(client, buffer) - -- stylua: ignore + -- stylua: ignore if client.name == "rust_analyzer" then vim.keymap.set("n", "K", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" }) vim.keymap.set( "n", "cR", "RustCodeAction", { buffer = buffer, desc = "Code Action (Rust)" }) @@ -66,7 +70,8 @@ return { local codelldb_path = extension_path .. "adapter/codelldb" local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib" or extension_path .. "lldb/lib/liblldb.so" - local rust_tools_opts = vim.tbl_deep_extend("force", opts, { + local user_rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim") + local rust_tools_opts = vim.tbl_deep_extend("force", user_rust_tools_opts, { dap = { adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), }, @@ -81,7 +86,7 @@ return { ]]) end, }, - server = { + server = vim.tbl_deep_extend("force", opts, { settings = { ["rust-analyzer"] = { cargo = { @@ -105,7 +110,7 @@ return { }, }, }, - }, + }), }) require("rust-tools").setup(rust_tools_opts) return true @@ -128,4 +133,17 @@ return { }, }, }, + + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "rouge8/neotest-rust", + }, + opts = { + adapters = { + ["neotest-rust"] = {}, + }, + }, + }, } From 6d8be7ae46b8c750d68e218819415524460bd424 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:25:13 +0200 Subject: [PATCH 029/513] chore(main): release 4.22.0 (#1019) 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 af5ee22c96..2d3b080bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [4.22.0](https://github.com/LazyVim/LazyVim/compare/v4.21.0...v4.22.0) (2023-06-30) + + +### Features + +* **rust:** rust improvements ([#1015](https://github.com/LazyVim/LazyVim/issues/1015)) ([79b1c92](https://github.com/LazyVim/LazyVim/commit/79b1c92dd22020b2a5ed1dbd6e6bb86242207785)) + + +### Bug Fixes + +* **lang:** indentation in rust lang extra ([#1017](https://github.com/LazyVim/LazyVim/issues/1017)) ([c992ebe](https://github.com/LazyVim/LazyVim/commit/c992ebec468b2e60f1138fd85055118016c62165)) + ## [4.21.0](https://github.com/LazyVim/LazyVim/compare/v4.20.1...v4.21.0) (2023-06-30) From 089606b48dc6bb94bac36d1c30e50899a8d6f81f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 30 Jun 2023 20:44:39 +0200 Subject: [PATCH 030/513] fix(lsp): upstream inlay_hint rename --- lua/lazyvim/config/keymaps.lua | 4 ++-- lua/lazyvim/plugins/lsp/init.lua | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 93bc5b0c57..eb037bd97d 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -112,8 +112,8 @@ map("n", "ul", function() Util.toggle("relativenumber", true) Util.toggl map("n", "ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" }) local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) -if vim.lsp.buf.inlay_hint then - map("n", "uh", function() vim.lsp.buf.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" }) +if vim.lsp.inlay_hint then + map("n", "uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" }) end -- lazygit diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 260abcaecc..b3f9d00ccc 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -98,10 +98,12 @@ return { vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end - if opts.inlay_hints.enabled and vim.lsp.buf.inlay_hint then + local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint + + if opts.inlay_hints.enabled and inlay_hint then Util.on_attach(function(client, buffer) if client.server_capabilities.inlayHintProvider then - vim.lsp.buf.inlay_hint(buffer, true) + inlay_hint(buffer, true) end end) end From 4ba5086b3d9f9690e8fd7d93102db66173b02638 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 30 Jun 2023 17:14:58 -0400 Subject: [PATCH 031/513] feat(go): add fine-tuned LSP options, add some null-ls sources (#1024) --- lua/lazyvim/plugins/extras/lang/go.lua | 55 +++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index e4036185e2..55b20ad4c5 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -23,8 +23,8 @@ return { }, }, setup = { - gopls = function() - -- workaround for gopls not supporting semantictokensprovider + gopls = function(_, opts) + -- workaround for gopls not supporting semanticTokensProvider -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 require("lazyvim.util").on_attach(function(client, _) if client.name == "gopls" then @@ -42,10 +42,61 @@ return { end end) -- end workaround + opts.settings = { + gopls = { + gofumpt = true, + codelenses = { + gc_details = false, + generate = true, + regenerate_cgo = true, + run_govulncheck = true, + test = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + analyses = { + fieldalignment = true, + nilness = true, + unusedparams = true, + unusedwrite = true, + useany = true, + }, + usePlaceholders = true, + completeUnimported = true, + staticcheck = true, + directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, + semanticTokens = true, + }, + } end, }, }, }, + -- Ensure Go tools are installed + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + if type(opts.sources) == "table" then + local nls = require("null-ls") + vim.list_extend(opts.sources, { + nls.builtins.code_actions.gomodifytags, + nls.builtins.code_actions.impl, + nls.builtins.formatting.gofumpt, + nls.builtins.formatting.goimports_reviser, + }) + end + end, + }, { "mfussenegger/nvim-dap", optional = true, From ea21cad7ed5d7c699b013fb3d66f4b6650d2efdd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 08:52:51 +0200 Subject: [PATCH 032/513] chore(main): release 4.23.0 (#1023) 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 2d3b080bfe..1a1122be24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [4.23.0](https://github.com/LazyVim/LazyVim/compare/v4.22.0...v4.23.0) (2023-06-30) + + +### Features + +* **go:** add fine-tuned LSP options, add some null-ls sources ([#1024](https://github.com/LazyVim/LazyVim/issues/1024)) ([4ba5086](https://github.com/LazyVim/LazyVim/commit/4ba5086b3d9f9690e8fd7d93102db66173b02638)) + + +### Bug Fixes + +* **lsp:** upstream inlay_hint rename ([089606b](https://github.com/LazyVim/LazyVim/commit/089606b48dc6bb94bac36d1c30e50899a8d6f81f)) + ## [4.22.0](https://github.com/LazyVim/LazyVim/compare/v4.21.0...v4.22.0) (2023-06-30) From fca09b12e8188fb0a9b7bda040890c096e6cc9be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 1 Jul 2023 06:53:32 +0000 Subject: [PATCH 033/513] 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 5bc74a89c6..cfd539606e 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 30 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 01 ============================================================================== Table of Contents *LazyVim-table-of-contents* From d0bc8b7dcea44b7bc46580ce21001c4509d046c3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:42:35 +0200 Subject: [PATCH 034/513] feat(lsp): added support to lsp keymaps for dynamic capabilities --- 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 b3f9d00ccc..ffa48d3c94 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -92,6 +92,17 @@ return { require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) end) + local register_capability = vim.lsp.handlers["client/registerCapability"] + + vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) + local client_id = ctx.client_id + ---@type lsp.Client + local client = vim.lsp.get_client_by_id(client_id) + local buffer = vim.api.nvim_get_current_buf() + require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) + return register_capability(err, res, ctx) + end + -- diagnostics for name, icon in pairs(require("lazyvim.config").icons.diagnostics) do name = "DiagnosticSign" .. name From 36774c605848dc3bee8b9e0e4673e684b47bd89c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:43:16 +0200 Subject: [PATCH 035/513] fix(lsp): resolve keymap capabilities over all buffer clients --- lua/lazyvim/plugins/lsp/keymaps.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index de97d08d70..1a21c3985e 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -66,6 +66,17 @@ function M.get() end function M.on_attach(client, buffer) +---@param method string +function M.has(buffer, method) + method = method:find("/") and method or "textDocument/" .. method + local clients = vim.lsp.get_active_clients({ bufnr = buffer }) + for _, client in ipairs(clients) do + if client.supports_method(method) then + return true + end + end + return false +end local Keys = require("lazy.core.handler.keys") local keymaps = {} ---@type table From 61e3ce8cdc1159d59e11d92478ca76ea19e44c2a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:43:51 +0200 Subject: [PATCH 036/513] feat(lsp): custom lsp keymaps --- lua/lazyvim/plugins/lsp/init.lua | 4 ++++ lua/lazyvim/plugins/lsp/keymaps.lua | 28 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index ffa48d3c94..570ec35483 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -57,6 +57,10 @@ return { jsonls = {}, lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason + -- Use this to add any additional keymaps + -- for specific lsp servers + ---@type LazyKeys[] + -- keys = {}, settings = { Lua = { workspace = { diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 1a21c3985e..de691941de 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -28,8 +28,8 @@ function M.get() { "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" }, { "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" }, { "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" }, - { "cf", format, desc = "Format Document", has = "documentFormatting" }, - { "cf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" }, + { "cf", format, desc = "Format Document", has = "formatting" }, + { "cf", format, desc = "Format Range", mode = "v", has = "rangeFormatting" }, { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cA", @@ -65,7 +65,6 @@ function M.get() return M._keys end -function M.on_attach(client, buffer) ---@param method string function M.has(buffer, method) method = method:find("/") and method or "textDocument/" .. method @@ -77,11 +76,13 @@ function M.has(buffer, method) end return false end + +function M.resolve(buffer) local Keys = require("lazy.core.handler.keys") local keymaps = {} ---@type table - for _, value in ipairs(M.get()) do - local keys = Keys.parse(value) + local function add(keymap) + local keys = Keys.parse(keymap) if keys[2] == vim.NIL or keys[2] == false then keymaps[keys.id] = nil else @@ -89,8 +90,23 @@ end end end + local opts = require("lazyvim.util").opts("nvim-lspconfig") + local clients = vim.lsp.get_active_clients({ bufnr = buffer }) + for _, client in ipairs(clients) do + local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} + for _, keymap in ipairs(maps) do + add(keymap) + end + end + return keymaps +end + +function M.on_attach(client, buffer) + local Keys = require("lazy.core.handler.keys") + local keymaps = M.resolve(buffer) + for _, keys in pairs(keymaps) do - if not keys.has or client.server_capabilities[keys.has .. "Provider"] then + if not keys.has or M.has(buffer, keys.has) then local opts = Keys.opts(keys) ---@diagnostic disable-next-line: no-unknown opts.has = nil From a46d47653e092f7689203ee39c9f964b1bd2d5f4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:45:21 +0200 Subject: [PATCH 037/513] feat(rust): refactor to allow easy user customization and keymaps --- lua/lazyvim/plugins/extras/lang/rust.lua | 118 +++++++++++++---------- lua/lazyvim/plugins/lsp/keymaps.lua | 2 +- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 4e9dff8083..c59cd13a25 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -39,6 +39,41 @@ return { end, }, + { + "simrat39/rust-tools.nvim", + lazy = true, + opts = function() + local ok, mason_registry = pcall(require, "mason-registry") + local adapter ---@type any + if ok then + -- rust tools configuration for debugging support + local codelldb = mason_registry.get_package("codelldb") + local extension_path = codelldb:get_install_path() .. "/extension/" + local codelldb_path = extension_path .. "adapter/codelldb" + local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib" + or extension_path .. "lldb/lib/liblldb.so" + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) + end + return { + dap = { + adapter = adapter, + }, + tools = { + on_initialized = function() + vim.cmd([[ + augroup RustLSP + autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() + autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() + autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() + augroup END + ]]) + end, + }, + } + end, + config = function() end, + }, + -- Correctly setup lspconfig for Rust 🚀 { "neovim/nvim-lspconfig", @@ -50,7 +85,36 @@ return { opts = { servers = { -- Ensure mason installs the server - rust_analyzer = {}, + rust_analyzer = { + keys = { + { "K", "RustHoverActions", desc = "Hover Actions (Rust)" }, + { "cR", "RustCodeAction", desc = "Code Action (Rust)" }, + { "dr", "RustDebuggables", desc = "Run Debuggables (Rust)" }, + }, + settings = { + ["rust-analyzer"] = { + cargo = { + allFeatures = true, + loadOutDirsFromCheck = true, + runBuildScripts = true, + }, + -- Add clippy lints for Rust. + checkOnSave = { + allFeatures = true, + command = "clippy", + extraArgs = { "--no-deps" }, + }, + procMacro = { + enable = true, + ignored = { + ["async-trait"] = { "async_trait" }, + ["napi-derive"] = { "napi" }, + ["async-recursion"] = { "async_recursion" }, + }, + }, + }, + }, + }, taplo = {}, }, setup = { @@ -63,56 +127,8 @@ return { vim.keymap.set( "n", "dr", "RustDebuggables", { buffer = buffer, desc = "Run Debuggables (Rust)" }) end end) - local mason_registry = require("mason-registry") - -- rust tools configuration for debugging support - local codelldb = mason_registry.get_package("codelldb") - local extension_path = codelldb:get_install_path() .. "/extension/" - local codelldb_path = extension_path .. "adapter/codelldb" - local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib" - or extension_path .. "lldb/lib/liblldb.so" - local user_rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim") - local rust_tools_opts = vim.tbl_deep_extend("force", user_rust_tools_opts, { - dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), - }, - tools = { - on_initialized = function() - vim.cmd([[ - augroup RustLSP - autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight() - autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references() - autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh() - augroup END - ]]) - end, - }, - server = vim.tbl_deep_extend("force", opts, { - settings = { - ["rust-analyzer"] = { - cargo = { - allFeatures = true, - loadOutDirsFromCheck = true, - runBuildScripts = true, - }, - -- Add clippy lints for Rust. - checkOnSave = { - allFeatures = true, - command = "clippy", - extraArgs = { "--no-deps" }, - }, - procMacro = { - enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, - }, - }, - }, - }, - }), - }) - require("rust-tools").setup(rust_tools_opts) + local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim") + require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts })) return true end, taplo = function(_, _) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index de691941de..ea075c0747 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -83,7 +83,7 @@ function M.resolve(buffer) local function add(keymap) local keys = Keys.parse(keymap) - if keys[2] == vim.NIL or keys[2] == false then + if keys[2] == false then keymaps[keys.id] = nil else keymaps[keys.id] = keys From 29ba21274dbbf2786e1efd54aff0ca194d1380b2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 2 Jul 2023 10:48:00 +0000 Subject: [PATCH 038/513] 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 cfd539606e..d5256cec73 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 01 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 272f6af842eb66b6e6cbdea211b17a1196acdff5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:57:47 +0200 Subject: [PATCH 039/513] feat(rust): make mason optional --- lua/lazyvim/plugins/extras/lang/rust.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index c59cd13a25..3761325fbd 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -32,6 +32,7 @@ return { -- Ensure Rust debugger is installed { "williamboman/mason.nvim", + optional = true, opts = function(_, opts) if type(opts.ensure_installed) == "table" then vim.list_extend(opts.ensure_installed, { "codelldb" }) From eaa0118dd2c91911f1457ea31b976a7c8f93164a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 12:58:07 +0200 Subject: [PATCH 040/513] feat(rust): make taplo configurable --- lua/lazyvim/plugins/extras/lang/rust.lua | 39 +++++++++--------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 3761325fbd..b0b7b98e4e 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -116,37 +116,28 @@ return { }, }, }, - taplo = {}, + taplo = { + keys = { + { + "K", + function() + if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then + require("crates").show_popup() + else + vim.lsp.buf.hover() + end + end, + desc = "Show Crate Documentation", + }, + }, + }, }, setup = { rust_analyzer = function(_, opts) - require("lazyvim.util").on_attach(function(client, buffer) - -- stylua: ignore - if client.name == "rust_analyzer" then - vim.keymap.set("n", "K", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" }) - vim.keymap.set( "n", "cR", "RustCodeAction", { buffer = buffer, desc = "Code Action (Rust)" }) - vim.keymap.set( "n", "dr", "RustDebuggables", { buffer = buffer, desc = "Run Debuggables (Rust)" }) - end - end) local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim") require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts })) return true end, - taplo = function(_, _) - local function show_documentation() - if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then - require("crates").show_popup() - else - vim.lsp.buf.hover() - end - end - require("lazyvim.util").on_attach(function(client, buffer) - if client.name == "taplo" then - vim.keymap.set("n", "K", show_documentation, { buffer = buffer, desc = "Show Crate Documentation" }) - end - end) - return false -- make sure the base implementation calls taplo.setup - end, }, }, }, From 1e1fc3c6a06fb98f305d8753939c6b871ae26e33 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 13:01:59 +0200 Subject: [PATCH 041/513] fix(go): make settings configurable for go --- lua/lazyvim/plugins/extras/lang/go.lua | 51 ++++++++++++-------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 55b20ad4c5..0d7f507115 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -16,33 +16,6 @@ return { servers = { gopls = { settings = { - gopls = { - semanticTokens = true, - }, - }, - }, - }, - setup = { - gopls = function(_, opts) - -- workaround for gopls not supporting semanticTokensProvider - -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 - require("lazyvim.util").on_attach(function(client, _) - if client.name == "gopls" then - if not client.server_capabilities.semanticTokensProvider then - local semantic = client.config.capabilities.textDocument.semanticTokens - client.server_capabilities.semanticTokensProvider = { - full = true, - legend = { - tokenTypes = semantic.tokenTypes, - tokenModifiers = semantic.tokenModifiers, - }, - range = true, - } - end - end - end) - -- end workaround - opts.settings = { gopls = { gofumpt = true, codelenses = { @@ -77,7 +50,29 @@ return { directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, semanticTokens = true, }, - } + }, + }, + }, + setup = { + gopls = function(_, opts) + -- workaround for gopls not supporting semanticTokensProvider + -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 + require("lazyvim.util").on_attach(function(client, _) + if client.name == "gopls" then + if not client.server_capabilities.semanticTokensProvider then + local semantic = client.config.capabilities.textDocument.semanticTokens + client.server_capabilities.semanticTokensProvider = { + full = true, + legend = { + tokenTypes = semantic.tokenTypes, + tokenModifiers = semantic.tokenModifiers, + }, + range = true, + } + end + end + end) + -- end workaround end, }, }, From 39627cab42cdaaab3d70c3013ce82b9caae7c623 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 13:02:51 +0200 Subject: [PATCH 042/513] fix(rust): remove rust-tools dep from lspconfig --- lua/lazyvim/plugins/extras/lang/rust.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index b0b7b98e4e..4e8272708f 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -78,11 +78,6 @@ return { -- Correctly setup lspconfig for Rust 🚀 { "neovim/nvim-lspconfig", - dependencies = { - "simrat39/rust-tools.nvim", - -- Avoid calling setup twice if user supplies `opts` - config = function() end, - }, opts = { servers = { -- Ensure mason installs the server From 4009620651c7422b3ce11484916865073e95574d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 13:04:49 +0200 Subject: [PATCH 043/513] fix(typescript): use new lsp keymaps config for typescript --- lua/lazyvim/plugins/extras/lang/typescript.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 4aeaf5f93f..32f4079ec9 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -19,6 +19,10 @@ return { servers = { ---@type lspconfig.options.tsserver tsserver = { + keys = { + { "co", "TypescriptOrganizeImports", desc = "Organize Imports" }, + { "cR", "TypescriptRenameFile", desc = "Rename File" }, + }, settings = { typescript = { format = { @@ -42,14 +46,6 @@ return { }, setup = { tsserver = function(_, opts) - require("lazyvim.util").on_attach(function(client, buffer) - if client.name == "tsserver" then - -- stylua: ignore - vim.keymap.set("n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) - -- stylua: ignore - vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) - end - end) require("typescript").setup({ server = opts }) return true end, From a9c73bc7c3da0d0ab169fa8791a0c707a36f07bc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Jul 2023 13:18:47 +0200 Subject: [PATCH 044/513] chore(main): release 4.24.0 (#1036) 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 1a1122be24..421dc607a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [4.24.0](https://github.com/LazyVim/LazyVim/compare/v4.23.0...v4.24.0) (2023-07-02) + + +### Features + +* **lsp:** added support to lsp keymaps for dynamic capabilities ([d0bc8b7](https://github.com/LazyVim/LazyVim/commit/d0bc8b7dcea44b7bc46580ce21001c4509d046c3)) +* **lsp:** custom lsp keymaps ([61e3ce8](https://github.com/LazyVim/LazyVim/commit/61e3ce8cdc1159d59e11d92478ca76ea19e44c2a)) +* **rust:** make mason optional ([272f6af](https://github.com/LazyVim/LazyVim/commit/272f6af842eb66b6e6cbdea211b17a1196acdff5)) +* **rust:** make taplo configurable ([eaa0118](https://github.com/LazyVim/LazyVim/commit/eaa0118dd2c91911f1457ea31b976a7c8f93164a)) +* **rust:** refactor to allow easy user customization and keymaps ([a46d476](https://github.com/LazyVim/LazyVim/commit/a46d47653e092f7689203ee39c9f964b1bd2d5f4)) + + +### Bug Fixes + +* **go:** make settings configurable for go ([1e1fc3c](https://github.com/LazyVim/LazyVim/commit/1e1fc3c6a06fb98f305d8753939c6b871ae26e33)) +* **lsp:** resolve keymap capabilities over all buffer clients ([36774c6](https://github.com/LazyVim/LazyVim/commit/36774c605848dc3bee8b9e0e4673e684b47bd89c)) +* **rust:** remove rust-tools dep from lspconfig ([39627ca](https://github.com/LazyVim/LazyVim/commit/39627cab42cdaaab3d70c3013ce82b9caae7c623)) +* **typescript:** use new lsp keymaps config for typescript ([4009620](https://github.com/LazyVim/LazyVim/commit/4009620651c7422b3ce11484916865073e95574d)) + ## [4.23.0](https://github.com/LazyVim/LazyVim/compare/v4.22.0...v4.23.0) (2023-06-30) From 8ccc109e920bcbe041c89f7e022bbfb2dbf4a09b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 14:34:34 +0200 Subject: [PATCH 045/513] fix(lsp): fixup lsp keymaps --- lua/lazyvim/plugins/lsp/keymaps.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index ea075c0747..b29661c741 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -89,6 +89,9 @@ function M.resolve(buffer) keymaps[keys.id] = keys end end + for _, keymap in ipairs(M.get()) do + add(keymap) + end local opts = require("lazyvim.util").opts("nvim-lspconfig") local clients = vim.lsp.get_active_clients({ bufnr = buffer }) From bbaf47028f7111cc24f995d3619091c9aab85741 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:44:14 +0200 Subject: [PATCH 046/513] chore(main): release 4.24.1 (#1037) 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 421dc607a6..c2658d2c7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.24.1](https://github.com/LazyVim/LazyVim/compare/v4.24.0...v4.24.1) (2023-07-02) + + +### Bug Fixes + +* **lsp:** fixup lsp keymaps ([8ccc109](https://github.com/LazyVim/LazyVim/commit/8ccc109e920bcbe041c89f7e022bbfb2dbf4a09b)) + ## [4.24.0](https://github.com/LazyVim/LazyVim/compare/v4.23.0...v4.24.0) (2023-07-02) From a981682603480e34b23615433e4ebefe07276dc2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 17:33:44 +0200 Subject: [PATCH 047/513] fix(lsp): update keymaps *after* registering capabilities --- lua/lazyvim/plugins/lsp/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 570ec35483..e7b7801d87 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -99,12 +99,13 @@ return { local register_capability = vim.lsp.handlers["client/registerCapability"] vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) + local ret = register_capability(err, res, ctx) local client_id = ctx.client_id ---@type lsp.Client local client = vim.lsp.get_client_by_id(client_id) local buffer = vim.api.nvim_get_current_buf() require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) - return register_capability(err, res, ctx) + return ret end -- diagnostics From 6d58f1dacf1652ba49ff97631e59fc4ec9ee4faa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jul 2023 22:25:43 +0200 Subject: [PATCH 048/513] fix(hipatterns): remove assert. Fixes #1045 --- lua/lazyvim/plugins/extras/util/mini-hipatterns.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua index 18f1e1aa6e..1367f908e1 100644 --- a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua +++ b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua @@ -54,7 +54,7 @@ M.plugin = { local match = m.full_match ---@type string, number local color, shade = match:match("[%w-]+%-([a-z%-]+)%-(%d+)") - shade = assert(tonumber(shade)) + shade = tonumber(shade) local bg = vim.tbl_get(M.colors, color, shade) if bg then local hl = "MiniHipatternsTailwind" .. color .. shade From dee8dc318efac8883fe149503ea92924ff4a4de2 Mon Sep 17 00:00:00 2001 From: Radvil <36059968+radvil@users.noreply.github.com> Date: Mon, 3 Jul 2023 21:41:16 +0800 Subject: [PATCH 049/513] fix: leap nvim required by flit (#1046) step to reproduce - disable leap.nvim - add custom config for flash (not using one from the extras) - open file type "f", error shown "module leap is missing" Co-authored-by: Radvil --- lua/lazyvim/plugins/editor.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 119bf6c1dd..d2d48140ad 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -216,6 +216,9 @@ return { -- easily jump to any location and enhanced f/t motions for Leap { "ggandor/flit.nvim", + enabled = function() + return require("lazyvim.util").has("leap") + end, keys = function() ---@type LazyKeys[] local ret = {} From 64ca399c56b775dad012c9fa294a35834f806b97 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 3 Jul 2023 13:42:01 +0000 Subject: [PATCH 050/513] 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 d5256cec73..9f46a802e1 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 02 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 03 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e5200e6358766f2ba71eb229cb335c4c811902bb Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 3 Jul 2023 09:48:51 -0400 Subject: [PATCH 051/513] feat(lang): add C/C++ support (#1025) --- lua/lazyvim/plugins/extras/lang/clangd.lua | 152 +++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/clangd.lua diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua new file mode 100644 index 0000000000..339a8b8f91 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -0,0 +1,152 @@ +return { + + -- Add C/C++ to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "c", "cpp" }) + end + end, + }, + + { + "p00f/clangd_extensions.nvim", + lazy = true, + config = function() end, + opts = { + extensions = { + inlay_hints = { + inline = false, + }, + ast = { + --These require codicons (https://github.com/microsoft/vscode-codicons) + role_icons = { + type = "", + declaration = "", + expression = "", + specifier = "", + statement = "", + ["template argument"] = "", + }, + kind_icons = { + Compound = "", + Recovery = "", + TranslationUnit = "", + PackExpansion = "", + TemplateTypeParm = "", + TemplateTemplateParm = "", + TemplateParamObject = "", + }, + }, + }, + }, + }, + + -- Correctly setup lspconfig for clangd 🚀 + { + "neovim/nvim-lspconfig", + opts = { + servers = { + -- Ensure mason installs the server + clangd = { + keys = { + { "cR", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + }, + root_dir = function(...) + -- using a root .clang-format or .clang-tidy file messes up projects, so remove them + return require("lspconfig.util").root_pattern( + "compile_commands.json", + "compile_flags.txt", + "configure.ac", + ".git" + )(...) + end, + capabilities = { + offsetEncoding = { "utf-16" }, + }, + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=llvm", + }, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, + }, + }, + setup = { + clangd = function(_, opts) + local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim") + require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts })) + return true + end, + }, + }, + }, + + { + "nvim-cmp", + opts = function(_, opts) + table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores")) + end, + }, + + { + "mfussenegger/nvim-dap", + optional = true, + dependencies = { + -- Ensure C/C++ debugger is installed + "williamboman/mason.nvim", + optional = true, + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "codelldb" }) + end + end, + }, + opts = function() + local dap = require("dap") + if not dap.adapters["codelldb"] then + require("dap").adapters["codelldb"] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "codelldb", + args = { + "--port", + "${port}", + }, + }, + } + end + for _, lang in ipairs({ "c", "cpp" }) do + dap.configurations[lang] = { + { + type = "codelldb", + request = "launch", + name = "Launch file", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + }, + { + type = "codelldb", + request = "attach", + name = "Attach to process", + processId = require("dap.utils").pick_process, + cwd = "${workspaceFolder}", + }, + } + end + end, + }, +} From 27eb4610bd0ffd48243f793054c7c9ab5ba08cb1 Mon Sep 17 00:00:00 2001 From: David Ward Date: Mon, 3 Jul 2023 15:45:40 -0400 Subject: [PATCH 052/513] feat(catppuccin): enable mason integration (#1048) Signed-off-by: David Ward --- lua/lazyvim/plugins/colorscheme.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 114fcfd4be..6312c870b4 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -20,6 +20,7 @@ return { illuminate = true, indent_blankline = { enabled = true }, lsp_trouble = true, + mason = true, mini = true, native_lsp = { enabled = true, From d33be73b8d0a1f6b1dbabfc30bbac02d88d177b9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 21:47:59 +0200 Subject: [PATCH 053/513] chore(main): release 4.25.0 (#1041) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2658d2c7d..261eb731c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [4.25.0](https://github.com/LazyVim/LazyVim/compare/v4.24.1...v4.25.0) (2023-07-03) + + +### Features + +* **catppuccin:** enable mason integration ([#1048](https://github.com/LazyVim/LazyVim/issues/1048)) ([27eb461](https://github.com/LazyVim/LazyVim/commit/27eb4610bd0ffd48243f793054c7c9ab5ba08cb1)) +* **lang:** add C/C++ support ([#1025](https://github.com/LazyVim/LazyVim/issues/1025)) ([e5200e6](https://github.com/LazyVim/LazyVim/commit/e5200e6358766f2ba71eb229cb335c4c811902bb)) + + +### Bug Fixes + +* **hipatterns:** remove assert. Fixes [#1045](https://github.com/LazyVim/LazyVim/issues/1045) ([6d58f1d](https://github.com/LazyVim/LazyVim/commit/6d58f1dacf1652ba49ff97631e59fc4ec9ee4faa)) +* leap nvim required by flit ([#1046](https://github.com/LazyVim/LazyVim/issues/1046)) ([dee8dc3](https://github.com/LazyVim/LazyVim/commit/dee8dc318efac8883fe149503ea92924ff4a4de2)) +* **lsp:** update keymaps *after* registering capabilities ([a981682](https://github.com/LazyVim/LazyVim/commit/a981682603480e34b23615433e4ebefe07276dc2)) + ## [4.24.1](https://github.com/LazyVim/LazyVim/compare/v4.24.0...v4.24.1) (2023-07-02) From 9c120b5ef7dfaba0079ed632859a778b8f103991 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 4 Jul 2023 08:25:38 +0200 Subject: [PATCH 054/513] Revert "fix: leap nvim required by flit (#1046)" This reverts commit dee8dc318efac8883fe149503ea92924ff4a4de2. --- lua/lazyvim/plugins/editor.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index d2d48140ad..119bf6c1dd 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -216,9 +216,6 @@ return { -- easily jump to any location and enhanced f/t motions for Leap { "ggandor/flit.nvim", - enabled = function() - return require("lazyvim.util").has("leap") - end, keys = function() ---@type LazyKeys[] local ret = {} From ddb819cb9ae3a9b573be1f7d57c537dfa8399c41 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 4 Jul 2023 06:26:34 +0000 Subject: [PATCH 055/513] 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 9f46a802e1..b35307cb74 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 03 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 04 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 755419f39cf0ca0407a3a6a16dad35942c653572 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 4 Jul 2023 19:06:13 +0200 Subject: [PATCH 056/513] fix: trigger ci --- lua/lazyvim/config/autocmds.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 132b6cdf49..2e26e283d2 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -1,4 +1,4 @@ --- This file is automatically loaded by lazyvim.config.init +-- This file is automatically loaded by lazyvim.config.init. local function augroup(name) return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true }) From 0b020dc37b30fd93a199f1124a95028cb544eac7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 19:08:01 +0200 Subject: [PATCH 057/513] chore(main): release 4.25.1 (#1056) 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 261eb731c1..83afe4f9bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.25.1](https://github.com/LazyVim/LazyVim/compare/v4.25.0...v4.25.1) (2023-07-04) + + +### Bug Fixes + +* trigger ci ([755419f](https://github.com/LazyVim/LazyVim/commit/755419f39cf0ca0407a3a6a16dad35942c653572)) + ## [4.25.0](https://github.com/LazyVim/LazyVim/compare/v4.24.1...v4.25.0) (2023-07-03) From 299aae3545aa7b7a67a6907e089d80cd63938bf6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 6 Jul 2023 15:21:45 +0200 Subject: [PATCH 058/513] fix(flash): depraction warning --- lua/lazyvim/plugins/extras/editor/flash.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 1b5ce5951c..730d540285 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -49,7 +49,7 @@ return { local function flash(prompt_bufnr) require("flash").jump({ pattern = "^", - highlight = { label = { after = { 0, 0 } } }, + label = { after = { 0, 0 } }, search = { mode = "search", exclude = { From bcff5a19379e32a85049500de420aa24b271fb72 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 6 Jul 2023 15:35:34 +0200 Subject: [PATCH 059/513] fix(util): use spec to check if a plugin is enabled --- 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 5db01fef1b..782de9e046 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -17,7 +17,7 @@ end ---@param plugin string function M.has(plugin) - return require("lazy.core.config").plugins[plugin] ~= nil + return require("lazy.core.config").spec.plugins[plugin] ~= nil end function M.fg(name) From ae054ec13c987ff5ce39cfc88917f8243abae72e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 6 Jul 2023 15:36:03 +0200 Subject: [PATCH 060/513] feat(vscode): easier way to enable/disable plugins --- lua/lazyvim/plugins/extras/vscode.lua | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index c8adc0368b..6a457cf15b 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -21,23 +21,8 @@ local Config = require("lazy.core.config") local Plugin = require("lazy.core.plugin") Config.options.checker.enabled = false Config.options.change_detection.enabled = false - --- HACK: disable all plugins except the ones we want -local fix_disabled = Plugin.Spec.fix_disabled -function Plugin.Spec.fix_disabled(self) - for _, plugin in pairs(self.plugins) do - if not (vim.tbl_contains(enabled, plugin.name) or plugin.vscode) then - plugin.enabled = false - end - end - fix_disabled(self) -end - --- HACK: don't clean plugins in vscode -local update_state = Plugin.update_state -function Plugin.update_state() - update_state() - Config.to_clean = {} +Config.options.defaults.cond = function(plugin) + return vim.tbl_contains(enabled, plugin.name) or plugin.vscode end -- Add some vscode specific keymaps From 99f30f9a3737ab24ac8e0a31eb2c95830a3c7013 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 6 Jul 2023 13:36:51 +0000 Subject: [PATCH 061/513] 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 b35307cb74..ec4ad4a040 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 04 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 06 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b660b51718387a1c10d8edf1fe9807b6c7a9f0e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:40:33 +0200 Subject: [PATCH 062/513] chore(main): release 4.26.0 (#1068) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83afe4f9bb..312b42a4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [4.26.0](https://github.com/LazyVim/LazyVim/compare/v4.25.1...v4.26.0) (2023-07-06) + + +### Features + +* **vscode:** easier way to enable/disable plugins ([ae054ec](https://github.com/LazyVim/LazyVim/commit/ae054ec13c987ff5ce39cfc88917f8243abae72e)) + + +### Bug Fixes + +* **flash:** depraction warning ([299aae3](https://github.com/LazyVim/LazyVim/commit/299aae3545aa7b7a67a6907e089d80cd63938bf6)) +* **util:** use spec to check if a plugin is enabled ([bcff5a1](https://github.com/LazyVim/LazyVim/commit/bcff5a19379e32a85049500de420aa24b271fb72)) + ## [4.25.1](https://github.com/LazyVim/LazyVim/compare/v4.25.0...v4.25.1) (2023-07-04) From baa96140227a3727b2ea2053f37aa2b7253bb45a Mon Sep 17 00:00:00 2001 From: Sam Amis <30879203+SameAsMuli@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:43:15 -0500 Subject: [PATCH 063/513] fix(autocmds): jump to last loc in buffer (#1061) vim.api.nvim_win_set_cursor is expecting a window handle but was being passed the current buffer's handle instead --- lua/lazyvim/config/autocmds.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 2e26e283d2..ec1b98df45 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -38,7 +38,7 @@ vim.api.nvim_create_autocmd("BufReadPost", { local mark = vim.api.nvim_buf_get_mark(buf, '"') local lcount = vim.api.nvim_buf_line_count(buf) if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, buf, mark) + pcall(vim.api.nvim_win_set_cursor, 0, mark) end end, }) From 22c9477b9642b1a8abc303ffcb44c6989c7a5ca2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 6 Jul 2023 15:51:29 +0200 Subject: [PATCH 064/513] feat(flash): use c-s in the cmdline to toggle flash --- lua/lazyvim/plugins/extras/editor/flash.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 730d540285..4b3244562c 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -40,6 +40,14 @@ return { end, desc = "Treesitter Search", }, + { + "", + mode = { "c" }, + function() + require("flash").toggle() + end, + desc = "Toggle Flash Search", + }, }, }, { From 0db31c2840af662c856d5b9a09d87bc266e7fa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20=C5=BDdanov?= Date: Thu, 6 Jul 2023 20:46:34 +0300 Subject: [PATCH 065/513] feat(extras): add terraform extra (#1030) --- lua/lazyvim/plugins/extras/lang/terraform.lua | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/terraform.lua diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua new file mode 100644 index 0000000000..2ad8835279 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -0,0 +1,33 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { + "terraform", + "hcl", + }) + end + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + terraformls = {}, + }, + }, + }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + if type(opts.sources) == "table" then + local null_ls = require("null-ls") + vim.list_extend(opts.sources, { + null_ls.builtins.formatting.terraform_fmt, + null_ls.builtins.diagnostics.terraform_validate, + }) + end + end, + }, +} From 44cdb5eac556733db53afeebcdc6ef91408de0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owicz?= Date: Thu, 6 Jul 2023 20:43:19 +0200 Subject: [PATCH 066/513] feat(lang): add python support (#1031) --- lua/lazyvim/plugins/extras/lang/python.lua | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/python.lua diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua new file mode 100644 index 0000000000..746435cc3c --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -0,0 +1,67 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" }) + end + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + pyright = {}, + ruff_lsp = {}, + }, + }, + setup = { + ruff_lsp = function() + require("lazyvim.util").on_attach(function(client, _) + if client.name == "ruff_lsp" then + -- Disable hover in favor of Pyright + client.server_capabilities.hoverProvider = false + end + end) + end, + }, + }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "nvim-neotest/neotest-python", + }, + opts = { + adapters = { + ["neotest-python"] = { + -- Here you can specify the settings for the adapter, i.e. + -- runner = "pytest", + -- python = ".venv/bin/python", + }, + }, + }, + }, + { + "mfussenegger/nvim-dap", + optional = true, + dependencies = { + "mfussenegger/nvim-dap-python", + -- stylua: ignore + keys = { + { "dPt", function() require('dap-python').test_method() end, desc = "Debug Method" }, + { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class" }, + }, + config = function() + local path = require("mason-registry").get_package("debugpy"):get_install_path() + require("dap-python").setup(path .. "/venv/bin/python") + end, + }, + }, + { + "linux-cultist/venv-selector.nvim", + cmd = "VenvSelect", + opts = {}, + keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv" } }, + }, +} From abea2807ce13c994d5697f0ff19d80f85f678b1b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 20:46:37 +0200 Subject: [PATCH 067/513] chore(main): release 4.27.0 (#1069) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 312b42a4eb..63d58fdf46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [4.27.0](https://github.com/LazyVim/LazyVim/compare/v4.26.0...v4.27.0) (2023-07-06) + + +### Features + +* **extras:** add terraform extra ([#1030](https://github.com/LazyVim/LazyVim/issues/1030)) ([0db31c2](https://github.com/LazyVim/LazyVim/commit/0db31c2840af662c856d5b9a09d87bc266e7fa40)) +* **flash:** use c-s in the cmdline to toggle flash ([22c9477](https://github.com/LazyVim/LazyVim/commit/22c9477b9642b1a8abc303ffcb44c6989c7a5ca2)) +* **lang:** add python support ([#1031](https://github.com/LazyVim/LazyVim/issues/1031)) ([44cdb5e](https://github.com/LazyVim/LazyVim/commit/44cdb5eac556733db53afeebcdc6ef91408de0c3)) + + +### Bug Fixes + +* **autocmds:** jump to last loc in buffer ([#1061](https://github.com/LazyVim/LazyVim/issues/1061)) ([baa9614](https://github.com/LazyVim/LazyVim/commit/baa96140227a3727b2ea2053f37aa2b7253bb45a)) + ## [4.26.0](https://github.com/LazyVim/LazyVim/compare/v4.25.1...v4.26.0) (2023-07-06) From 67d1cbfb01e84083649027a4b6356401f74d2d60 Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:50:53 +0700 Subject: [PATCH 068/513] feat(catppuccin): match navic bg with lualine (#1085) --- lua/lazyvim/plugins/colorscheme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 6312c870b4..278e9bca9d 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -31,7 +31,7 @@ return { information = { "undercurl" }, }, }, - navic = { enabled = true }, + navic = { enabled = true, custom_bg = "lualine" }, neotest = true, noice = true, notify = true, From a38bf3001dc5576110cb0bbcacc262526ddf7bb9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 10 Jul 2023 15:51:36 +0000 Subject: [PATCH 069/513] 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 ec4ad4a040..572ae6d0f4 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 06 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 10 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 3f68f44d725747339933298cdac02589b37ea76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=AE=E6=99=A8?= Date: Wed, 12 Jul 2023 22:34:07 +0800 Subject: [PATCH 070/513] fix(lsp-config): lsp-config error when nvim-cmp not enabled. (#1095) * fix(lsp-config): lsp-config error when nvim-cmp not enabled. * Update lua/lazyvim/plugins/lsp/init.lua Co-authored-by: Jonas Holst Damtoft --------- Co-authored-by: Jonas Holst Damtoft --- lua/lazyvim/plugins/lsp/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index e7b7801d87..13f42ef347 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -139,11 +139,12 @@ return { vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) local servers = opts.servers + local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") local capabilities = vim.tbl_deep_extend( "force", {}, vim.lsp.protocol.make_client_capabilities(), - require("cmp_nvim_lsp").default_capabilities(), + has_cmp and cmp_nvim_lsp.default_capabilities() or {}, opts.capabilities or {} ) From b1721bc20a65ea6f9f2ea51d4fab4591e2d13cc0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 12 Jul 2023 14:34:54 +0000 Subject: [PATCH 071/513] 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 572ae6d0f4..06c080e761 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 10 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 12 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 9fd89701da8bd3a5d9ffeae84fb2174a3f650797 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 12 Jul 2023 17:24:38 +0200 Subject: [PATCH 072/513] feat(util): added util.on_load to execute code when a plugin loads --- lua/lazyvim/util/init.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 782de9e046..bd8a6fa98e 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -256,4 +256,25 @@ function M.lsp_disable(server, cond) end) 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 + vim.schedule(function() + fn(name) + end) + else + vim.api.nvim_create_autocmd("User", { + pattern = "LazyLoad", + callback = function(event) + if event.data == name then + fn(name) + return true + end + end, + }) + end +end + return M From e212c166b4ce91bbd65a9f7fda17403ee91ed19c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 12 Jul 2023 17:25:31 +0200 Subject: [PATCH 073/513] feat(mini.ai): decouple mini.ai from which-key. Closes #1076 --- lua/lazyvim/plugins/coding.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index ca43111d0c..23b874830c 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -173,7 +173,7 @@ return { config = function(_, opts) require("mini.ai").setup(opts) -- register all text objects with which-key - if require("lazyvim.util").has("which-key.nvim") then + require("lazyvim.util").on_load("which-key.nvim", function() ---@type table local i = { [" "] = "Whitespace", @@ -214,7 +214,7 @@ return { i = i, a = a, }) - end + end) end, }, } From c882544224d9e985e3981dead5ac0c0fd81377ff Mon Sep 17 00:00:00 2001 From: ueaner Date: Wed, 12 Jul 2023 23:36:30 +0800 Subject: [PATCH 074/513] docs: added c compiler to requirements (#1082) See: https://github.com/LazyVim/LazyVim/commit/2ef0c437b27a70d62a466ceea37b01301d314cf8 --- README-CN.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README-CN.md b/README-CN.md index a506d0e35f..a879148d75 100644 --- a/README-CN.md +++ b/README-CN.md @@ -57,6 +57,7 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性, - Neovim >= **0.8.0** (需要用 **LuaJIT** 构建) - Git >= **2.19.0** (用于部分克隆支持) - 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_** +- 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements) ## 🚀 入门 From a0c2014b1045243d216b244235c6a545e92471a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owicz?= Date: Wed, 12 Jul 2023 17:42:05 +0200 Subject: [PATCH 075/513] feat(lang): add docker support (#1078) --- lua/lazyvim/plugins/extras/lang/docker.lua | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/docker.lua diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua new file mode 100644 index 0000000000..5cadf86499 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -0,0 +1,36 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "dockerfile" }) + end + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + vim.list_extend(opts.sources, { + nls.builtins.diagnostics.hadolint, + }) + end, + dependencies = { + "mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "hadolint" }) + end, + }, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + dockerls = {}, + docker_compose_language_service = {}, + }, + }, + }, +} From 5204aacf8df52bd0e8f1c97fa4b9cc527dfaf5b8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:48:49 +0200 Subject: [PATCH 076/513] chore(main): release 4.28.0 (#1086) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d58fdf46..a90e4c6a71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [4.28.0](https://github.com/LazyVim/LazyVim/compare/v4.27.0...v4.28.0) (2023-07-12) + + +### Features + +* **catppuccin:** match navic bg with lualine ([#1085](https://github.com/LazyVim/LazyVim/issues/1085)) ([67d1cbf](https://github.com/LazyVim/LazyVim/commit/67d1cbfb01e84083649027a4b6356401f74d2d60)) +* **lang:** add docker support ([#1078](https://github.com/LazyVim/LazyVim/issues/1078)) ([a0c2014](https://github.com/LazyVim/LazyVim/commit/a0c2014b1045243d216b244235c6a545e92471a9)) +* **mini.ai:** decouple mini.ai from which-key. Closes [#1076](https://github.com/LazyVim/LazyVim/issues/1076) ([e212c16](https://github.com/LazyVim/LazyVim/commit/e212c166b4ce91bbd65a9f7fda17403ee91ed19c)) +* **util:** added util.on_load to execute code when a plugin loads ([9fd8970](https://github.com/LazyVim/LazyVim/commit/9fd89701da8bd3a5d9ffeae84fb2174a3f650797)) + + +### Bug Fixes + +* **lsp-config:** lsp-config error when nvim-cmp not enabled. ([#1095](https://github.com/LazyVim/LazyVim/issues/1095)) ([3f68f44](https://github.com/LazyVim/LazyVim/commit/3f68f44d725747339933298cdac02589b37ea76c)) + ## [4.27.0](https://github.com/LazyVim/LazyVim/compare/v4.26.0...v4.27.0) (2023-07-06) From 9e8ce289d12eb65146be3cb1b3800440e208496d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 12 Jul 2023 20:01:41 +0200 Subject: [PATCH 077/513] fix(neoconf): do neoconf setup in lspconfig setup. Fixes #1070 --- lua/lazyvim/plugins/lsp/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 13f42ef347..c63a89e9b3 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -4,7 +4,7 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, dependencies = { - { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, + { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, { "folke/neodev.nvim", opts = {} }, "mason.nvim", "williamboman/mason-lspconfig.nvim", @@ -89,6 +89,11 @@ return { ---@param opts PluginLspOpts config = function(_, opts) local Util = require("lazyvim.util") + + if Util.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)) + end -- setup autoformat require("lazyvim.plugins.lsp.format").setup(opts) -- setup formatting and keymaps From 8f9f76a96f54a03009056e3c820ef5e4b16d8d97 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:04:33 +0200 Subject: [PATCH 078/513] chore(main): release 4.28.1 (#1101) 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 a90e4c6a71..ac41bf3097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.28.1](https://github.com/LazyVim/LazyVim/compare/v4.28.0...v4.28.1) (2023-07-12) + + +### Bug Fixes + +* **neoconf:** do neoconf setup in lspconfig setup. Fixes [#1070](https://github.com/LazyVim/LazyVim/issues/1070) ([9e8ce28](https://github.com/LazyVim/LazyVim/commit/9e8ce289d12eb65146be3cb1b3800440e208496d)) + ## [4.28.0](https://github.com/LazyVim/LazyVim/compare/v4.27.0...v4.28.0) (2023-07-12) From 9387ab388ec43cae0689405fcb21bb4ecf67322c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 13 Jul 2023 08:01:15 +0200 Subject: [PATCH 079/513] feat: added `leader-L` to show the LazyVim changelog --- lua/lazyvim/config/keymaps.lua | 3 +++ lua/lazyvim/util/init.lua | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index eb037bd97d..d2a2b74ece 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -128,6 +128,9 @@ if vim.fn.has("nvim-0.9.0") == 1 then map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) end +-- LazyVim Changelog +map("n", "L", Util.changelog, {desc = "LazyVim Changelog"}) + -- floating terminal local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end map("n", "ft", lazyterm, { desc = "Terminal (root dir)" }) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index bd8a6fa98e..10c82c135f 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -277,4 +277,12 @@ function M.on_load(name, fn) end end +function M.changelog() + local lv = require("lazy.core.config").plugins.LazyVim + local float = require("lazy.util").open(lv.dir .. "/CHANGELOG.md") + vim.wo[float.win].spell = false + vim.wo[float.win].wrap = false + vim.diagnostic.disable(float.buf) +end + return M From ae759b947b1ef16d9814fcddfcafe2cdd767bc6a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 13 Jul 2023 08:17:36 +0200 Subject: [PATCH 080/513] feat(flash)!: Make flash.nvim the default jump plugin for LazyVim Use the `editor.leap` extra if you rather want to use leap/flit --- lua/lazyvim/plugins/editor.lua | 84 ++++++++++++++----- lua/lazyvim/plugins/extras/editor/flash.lua | 89 ++------------------- lua/lazyvim/plugins/extras/editor/leap.lua | 40 +++++++++ lua/lazyvim/plugins/util.lua | 3 - 4 files changed, 109 insertions(+), 107 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/editor/leap.lua diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 119bf6c1dd..6febf81463 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -213,34 +213,76 @@ return { }, }, - -- easily jump to any location and enhanced f/t motions for Leap + -- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins { - "ggandor/flit.nvim", - keys = function() - ---@type LazyKeys[] - local ret = {} - for _, key in ipairs({ "f", "F", "t", "T" }) do - ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key } - end - return ret + "ggandor/leap.nvim", + enabled = function() + vim.schedule(function() + local Config = require("lazy.core.config") + if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then + require("lazy.core.util").warn( + [[`flash.nvim` is now the default **LazyVim** jump plugin. +**leap.nvim** and **flit.nvim** have been disabled. +Please remove the plugins from your config. +If you rather use leap/flit instead, you can add the leap extra: +`lazyvim.plugins.extras.editor.leap` +]], + { title = "LazyVim" } + ) + end + end) + return false end, - opts = { labeled_modes = "nx" }, + optional = true, }, + { "ggandor/flit.nvim", enabled = false, optional = true }, + + -- Add Flash { - "ggandor/leap.nvim", + "folke/flash.nvim", + event = "VeryLazy", + vscode = true, + ---@type Flash.Config + opts = {}, + -- stylua: ignore keys = { - { "s", mode = { "n", "x", "o" }, desc = "Leap forward to" }, - { "S", mode = { "n", "x", "o" }, desc = "Leap backward to" }, - { "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" }, + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, }, - config = function(_, opts) - local leap = require("leap") - for k, v in pairs(opts) do - leap.opts[k] = v + }, + + -- Flash Telescope config + { + "nvim-telescope/telescope.nvim", + optional = true, + opts = function(_, opts) + if not require("lazyvim.util").has("flash.nvim") then + return end - leap.add_default_mappings(true) - vim.keymap.del({ "x", "o" }, "x") - vim.keymap.del({ "x", "o" }, "X") + local function flash(prompt_bufnr) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults" + end, + }, + }, + action = function(match) + local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr) + picker:set_selection(match.pos[1] - 1) + end, + }) + end + opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, { + mappings = { n = { s = flash }, i = { [""] = flash } }, + }) end, }, diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 4b3244562c..d60c23875a 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -1,83 +1,6 @@ -return { - { "ggandor/leap.nvim", enabled = false }, - { "ggandor/flit.nvim", enabled = false }, - { - "folke/flash.nvim", - event = "VeryLazy", - vscode = true, - ---@type Flash.Config - opts = {}, - keys = { - { - "s", - mode = { "n", "x", "o" }, - function() - require("flash").jump() - end, - desc = "Flash", - }, - { - "S", - mode = { "n", "o", "x" }, - function() - require("flash").treesitter() - end, - desc = "Flash Treesitter", - }, - { - "r", - mode = "o", - function() - require("flash").remote() - end, - desc = "Remote Flash", - }, - { - "R", - mode = { "o", "x" }, - function() - require("flash").treesitter_search() - end, - desc = "Treesitter Search", - }, - { - "", - mode = { "c" }, - function() - require("flash").toggle() - end, - desc = "Toggle Flash Search", - }, - }, - }, - { - "nvim-telescope/telescope.nvim", - optional = true, - opts = function(_, opts) - local function flash(prompt_bufnr) - require("flash").jump({ - pattern = "^", - label = { after = { 0, 0 } }, - search = { - mode = "search", - exclude = { - function(win) - return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults" - end, - }, - }, - action = function(match) - local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr) - picker:set_selection(match.pos[1] - 1) - end, - }) - end - opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, { - mappings = { - n = { s = flash }, - i = { [""] = flash }, - }, - }) - end, - }, -} +require("lazy.core.util").warn( + "`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.", + { title = "LazyVim" } +) + +return {} diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua new file mode 100644 index 0000000000..a104b98ef4 --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -0,0 +1,40 @@ +return { + -- disable flash + { "folke/flash.nvim", enabled = false, optional = true }, + + -- easily jump to any location and enhanced f/t motions for Leap + { + "ggandor/flit.nvim", + enabled = true, + keys = function() + ---@type LazyKeys[] + local ret = {} + for _, key in ipairs({ "f", "F", "t", "T" }) do + ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key } + end + return ret + end, + opts = { labeled_modes = "nx" }, + }, + { + "ggandor/leap.nvim", + enabled = true, + keys = { + { "s", mode = { "n", "x", "o" }, desc = "Leap forward to" }, + { "S", mode = { "n", "x", "o" }, desc = "Leap backward to" }, + { "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" }, + }, + config = function(_, opts) + local leap = require("leap") + for k, v in pairs(opts) do + leap.opts[k] = v + end + leap.add_default_mappings(true) + vim.keymap.del({ "x", "o" }, "x") + vim.keymap.del({ "x", "o" }, "X") + end, + }, + + -- makes some plugins dot-repeatable like leap + { "tpope/vim-repeat", event = "VeryLazy" }, +} diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index e2de18d83a..89847d66ca 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -24,7 +24,4 @@ return { -- library used by other plugins { "nvim-lua/plenary.nvim", lazy = true }, - - -- makes some plugins dot-repeatable like leap - { "tpope/vim-repeat", event = "VeryLazy" }, } From bb2608ecd1dd58ec36387c42dd547a01a5649753 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 13 Jul 2023 06:18:44 +0000 Subject: [PATCH 081/513] 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 06c080e761..44344234cc 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 12 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 13 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 8c0e39c826f697d668aae336ea26a83be806a543 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:21:44 +0200 Subject: [PATCH 082/513] chore(main): release 5.0.0 (#1108) 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 ac41bf3097..f249b4d5c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [5.0.0](https://github.com/LazyVim/LazyVim/compare/v4.28.1...v5.0.0) (2023-07-13) + + +### ⚠ BREAKING CHANGES + +* **flash:** Make flash.nvim the default jump plugin for LazyVim + +### Features + +* added `leader-L` to show the LazyVim changelog ([9387ab3](https://github.com/LazyVim/LazyVim/commit/9387ab388ec43cae0689405fcb21bb4ecf67322c)) +* **flash:** Make flash.nvim the default jump plugin for LazyVim ([ae759b9](https://github.com/LazyVim/LazyVim/commit/ae759b947b1ef16d9814fcddfcafe2cdd767bc6a)) + ## [4.28.1](https://github.com/LazyVim/LazyVim/compare/v4.28.0...v4.28.1) (2023-07-12) From 1b0b6eb0e13018196f0110b06149f00f2df5162f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=AE=E6=99=A8?= Date: Sat, 15 Jul 2023 15:30:34 +0800 Subject: [PATCH 083/513] feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap (#1131) * feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap * fix: inline telescope require --- lua/lazyvim/plugins/lsp/keymaps.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index b29661c741..b88d305621 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -14,11 +14,11 @@ function M.get() M._keys = { { "cd", vim.diagnostic.open_float, desc = "Line Diagnostics" }, { "cl", "LspInfo", desc = "Lsp Info" }, - { "gd", "Telescope lsp_definitions", desc = "Goto Definition", has = "definition" }, + { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, { "gr", "Telescope lsp_references", desc = "References" }, { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, - { "gI", "Telescope lsp_implementations", desc = "Goto Implementation" }, - { "gy", "Telescope lsp_type_definitions", desc = "Goto T[y]pe Definition" }, + { "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, + { "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, { "K", vim.lsp.buf.hover, desc = "Hover" }, { "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, From 0801e52118ef5f48d4ae389d0cefd79814d28a42 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 15 Jul 2023 07:31:17 +0000 Subject: [PATCH 084/513] 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 44344234cc..18cab2fc1a 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 13 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 15 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 69bb89184f9297f1377f77a8b6bee2487df6ac00 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis Date: Sun, 16 Jul 2023 09:41:45 +0300 Subject: [PATCH 085/513] =?UTF-8?q?feat(neo-tree):=20update=20to=20v3.x=20?= =?UTF-8?q?and=20change=20`follow=5Fcurrent=5Ffile`=20to=20a=20=E2=80=A6?= =?UTF-8?q?=20(#1143)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(neo-tree): update to v3.x and change `follow_current_file` to a table and enable it * fix(neo-tree): remove nerd font v3 icons * fix(neo-tree): remove legaccy commands --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/editor.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 6febf81463..6d8db3ecfb 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -5,6 +5,7 @@ return { -- file explorer { "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", cmd = "Neotree", keys = { { @@ -28,7 +29,6 @@ return { vim.cmd([[Neotree close]]) end, init = function() - vim.g.neo_tree_remove_legacy_commands = 1 if vim.fn.argc() == 1 then local stat = vim.loop.fs_stat(vim.fn.argv(0)) if stat and stat.type == "directory" then @@ -41,7 +41,7 @@ return { open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" }, filesystem = { bind_to_cwd = false, - follow_current_file = true, + follow_current_file = { enabled = true }, use_libuv_file_watcher = true, }, window = { @@ -56,16 +56,6 @@ return { expander_expanded = "", expander_highlight = "NeoTreeExpander", }, - icon = { - folder_empty = "󰜌", - folder_empty_open = "󰜌", - }, - git_status = { - symbols = { - renamed = "󰁕", - unstaged = "󰄱", - }, - }, }, }, config = function(_, opts) From 3a07bd8d2eeef0bea114ecc437f72019e9518c01 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 16 Jul 2023 06:42:27 +0000 Subject: [PATCH 086/513] 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 18cab2fc1a..b5d2510ca1 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 15 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 16 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 63e898599a00d8b1832de650ed67f63a44bf22e0 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sun, 16 Jul 2023 08:47:06 +0200 Subject: [PATCH 087/513] feat(lang): add null-ls tools to mason's ensure_installed (#1133) --- lua/lazyvim/plugins/extras/lang/go.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 0d7f507115..38aabc908d 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -100,7 +100,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - table.insert(opts.ensure_installed, "delve") + vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" }) end, }, }, From f46316af00caea298eb97f6872d32e9326b3c7ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 16 Jul 2023 10:38:07 +0200 Subject: [PATCH 088/513] chore(main): release 5.1.0 (#1138) 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 f249b4d5c4..23a5c058db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [5.1.0](https://github.com/LazyVim/LazyVim/compare/v5.0.0...v5.1.0) (2023-07-16) + + +### Features + +* **lang:** add null-ls tools to mason's ensure_installed ([#1133](https://github.com/LazyVim/LazyVim/issues/1133)) ([63e8985](https://github.com/LazyVim/LazyVim/commit/63e898599a00d8b1832de650ed67f63a44bf22e0)) +* **lsp:** add 'reuse_win' for reuse window in lsp definition keymap ([#1131](https://github.com/LazyVim/LazyVim/issues/1131)) ([1b0b6eb](https://github.com/LazyVim/LazyVim/commit/1b0b6eb0e13018196f0110b06149f00f2df5162f)) +* **neo-tree:** update to v3.x and change `follow_current_file` to a … ([#1143](https://github.com/LazyVim/LazyVim/issues/1143)) ([69bb891](https://github.com/LazyVim/LazyVim/commit/69bb89184f9297f1377f77a8b6bee2487df6ac00)) + ## [5.0.0](https://github.com/LazyVim/LazyVim/compare/v4.28.1...v5.0.0) (2023-07-13) From b4b27e867c4d2ba2bddd1df4c144ccdf1b4bfabc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 16 Jul 2023 10:42:12 +0200 Subject: [PATCH 089/513] fix(mason): add MasonUpdate to build --- lua/lazyvim/plugins/lsp/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index c63a89e9b3..d49dbbfd4f 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -230,6 +230,7 @@ return { "williamboman/mason.nvim", cmd = "Mason", keys = { { "cm", "Mason", desc = "Mason" } }, + build = ":MasonUpdate", opts = { ensure_installed = { "stylua", From fb1f29c32c516601b4074d113202482769ef030e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 16 Jul 2023 10:44:20 +0200 Subject: [PATCH 090/513] chore(main): release 5.1.1 (#1147) 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 23a5c058db..7ed56f3ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [5.1.1](https://github.com/LazyVim/LazyVim/compare/v5.1.0...v5.1.1) (2023-07-16) + + +### Bug Fixes + +* **mason:** add MasonUpdate to build ([b4b27e8](https://github.com/LazyVim/LazyVim/commit/b4b27e867c4d2ba2bddd1df4c144ccdf1b4bfabc)) + ## [5.1.0](https://github.com/LazyVim/LazyVim/compare/v5.0.0...v5.1.0) (2023-07-16) From a28acf0ce7d00af11e7268c9edff579bd06abf56 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 18 Jul 2023 08:46:52 +0200 Subject: [PATCH 091/513] feat(keymaps): added leader-K to run keywordprg --- lua/lazyvim/config/keymaps.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index d2a2b74ece..e96c9d922f 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -84,6 +84,9 @@ map("i", ";", ";u") -- save file map({ "i", "v", "n", "s" }, "", "w", { desc = "Save file" }) +--keywordprg +map("n", "K", "norm! K", { desc = "Keywordprg" }) + -- better indenting map("v", "<", "", ">gv") From 489221f741da1aac9599a174e7df8e7a74cce04f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 18 Jul 2023 06:47:32 +0000 Subject: [PATCH 092/513] 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 b5d2510ca1..2725c51b90 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 16 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 18 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e797e13bcee980227e20c287c561a75d97f9a2e4 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Wed, 19 Jul 2023 03:45:24 +0900 Subject: [PATCH 093/513] docs: Update CHANGELOG.md (#1160) availble -> available --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed56f3ff6..7ab9268172 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -586,7 +586,7 @@ ### Features -* **noice:** enable the inc_rename preset when inc_rename is availble ([a43d1b7](https://github.com/LazyVim/LazyVim/commit/a43d1b79f29deecc694bd409ab497f8a62091b11)) +* **noice:** enable the inc_rename preset when inc_rename is available ([a43d1b7](https://github.com/LazyVim/LazyVim/commit/a43d1b79f29deecc694bd409ab497f8a62091b11)) ### Bug Fixes @@ -643,7 +643,7 @@ ### Bug Fixes -* **format:** only do null-ls formatting logic when null-ls is availble. Fixes [#684](https://github.com/LazyVim/LazyVim/issues/684) ([eb143eb](https://github.com/LazyVim/LazyVim/commit/eb143ebe110995fb208fc480958a55858944c5f9)) +* **format:** only do null-ls formatting logic when null-ls is available. Fixes [#684](https://github.com/LazyVim/LazyVim/issues/684) ([eb143eb](https://github.com/LazyVim/LazyVim/commit/eb143ebe110995fb208fc480958a55858944c5f9)) ## [2.12.0](https://github.com/LazyVim/LazyVim/compare/v2.11.0...v2.12.0) (2023-04-24) From f2459bd70ee303ee1031a4959a5feda7de5524d1 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 19 Jul 2023 07:14:07 -0400 Subject: [PATCH 094/513] docs: Improve summary documentation of deps (#1159) --- lua/lazyvim/plugins/coding.lua | 7 +++++-- lua/lazyvim/plugins/editor.lua | 18 +++++++++++++----- lua/lazyvim/plugins/ui.lua | 11 ++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 23b874830c..cbf94e7734 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -99,7 +99,10 @@ return { opts = {}, }, - -- surround + -- 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) @@ -147,7 +150,7 @@ return { }, }, - -- better text-objects + -- Better text-objects { "echasnovski/mini.ai", -- keys = { diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 6d8db3ecfb..eeaa4649ea 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -227,7 +227,9 @@ If you rather use leap/flit instead, you can add the leap extra: }, { "ggandor/flit.nvim", enabled = false, optional = true }, - -- Add Flash + -- Flash enhances the built-in search functionality by showing labels + -- at the end of each match, letting you quickly jump to a specific + -- location. { "folke/flash.nvim", event = "VeryLazy", @@ -276,7 +278,8 @@ If you rather use leap/flit instead, you can add the leap extra: end, }, - -- which-key + -- which-key helps you remember key bindings by showing a popup + -- with the active keybindings of the command you started typing. { "folke/which-key.nvim", event = "VeryLazy", @@ -308,7 +311,9 @@ If you rather use leap/flit instead, you can add the leap extra: end, }, - -- git signs + -- git signs highlights text that has changed since the list + -- git commit, and also lets you interactively stage & unstage + -- hunks in a commit. { "lewis6991/gitsigns.nvim", event = { "BufReadPre", "BufNewFile" }, @@ -345,7 +350,9 @@ If you rather use leap/flit instead, you can add the leap extra: }, }, - -- references + -- 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 = { "BufReadPost", "BufNewFile" }, @@ -434,7 +441,8 @@ If you rather use leap/flit instead, you can add the leap extra: }, }, - -- todo comments + -- Finds and lists all of the TODO, HACK, BUG, etc comment + -- in your project and loads them into a browsable list. { "folke/todo-comments.nvim", cmd = { "TodoTrouble", "TodoTelescope" }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index b978b02892..2ba6c03380 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -49,7 +49,8 @@ return { end, }, - -- bufferline + -- This is what powers LazyVim's fancy-looking + -- tabs, which include filetype icons and close buttons. { "akinsho/bufferline.nvim", event = "VeryLazy", @@ -186,7 +187,9 @@ return { }, }, - -- active indent guide and indent text objects + -- 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 @@ -331,7 +334,9 @@ return { end, }, - -- lsp symbol navigation for lualine + -- lsp symbol navigation for lualine. This shows where + -- in the code structure you are - within functions, classes, + -- etc - in the statusline. { "SmiteshP/nvim-navic", lazy = true, From 4d0427e131477bc988ac7ca2ffe0ea6adceea989 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Jul 2023 11:14:51 +0000 Subject: [PATCH 095/513] 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 2725c51b90..545154eb61 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 18 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 19 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 258f339bcf8197ece54d66bf6ed6f351cb6e98cb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 20 Jul 2023 09:20:21 +0200 Subject: [PATCH 096/513] feat(options)!: set default localleader to \ --- lua/lazyvim/config/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index c5823302a6..f3d944844d 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -1,6 +1,6 @@ -- This file is automatically loaded by plugins.core vim.g.mapleader = " " -vim.g.maplocalleader = " " +vim.g.maplocalleader = "\\" local opt = vim.opt From f70f87335548a69d375901e4743f6b3dcbc5b938 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 20 Jul 2023 07:21:08 +0000 Subject: [PATCH 097/513] 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 545154eb61..4cdf4b3b91 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 19 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 20 ============================================================================== Table of Contents *LazyVim-table-of-contents* From abaa6d90e4fe2c658b869e81a140a74f624d9299 Mon Sep 17 00:00:00 2001 From: Mayrixon Date: Thu, 20 Jul 2023 11:26:05 +0100 Subject: [PATCH 098/513] feat(lang): add tex support (#1156) * feat(lang): add tex support * Reword comments * Remove personalise configs. * Disable lazy-loading. * Remove chktex in LSP server texlab. * Update local conceallevel setup. * Add keymap for vimtex-doc-package. * Enable vimtex omni-completion. * Update vimtex's keymap. * refactor: move vimtex K to texlab --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/tex.lua | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/tex.lua diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua new file mode 100644 index 0000000000..e8d4fefffe --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -0,0 +1,58 @@ +return { + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["l"] = { name = "+vimtex" }, + }, + }, + }, + + -- Add BibTeX/LaTeX to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "bibtex", "latex" }) + end + if type(opts.highlight.disable) == "table" then + vim.list_extend(opts.highlight.disable, { "latex" }) + else + opts.highlight.disable = { "latex" } + end + end, + }, + + { + "lervag/vimtex", + lazy = false, -- lazy-loading will disable inverse search + config = function() + vim.api.nvim_create_autocmd({ "FileType" }, { + group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }), + pattern = { "bib", "tex" }, + callback = function() + vim.wo.conceallevel = 2 + end, + }) + + vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover + vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" + end, + }, + + -- Correctly setup lspconfig for LaTeX 🚀 + { + "neovim/nvim-lspconfig", + optional = true, + opts = { + servers = { + texlab = { + keys = { + { "K", "(vimtex-doc-package)", desc = "Vimtex Docs", silent = true }, + }, + }, + }, + }, + }, +} From 6323b419fd73372723eab8d3ec2bca6a2f4b6b19 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 20 Jul 2023 17:16:13 -0400 Subject: [PATCH 099/513] docs: Add more documentation (#1174) --- lua/lazyvim/plugins/treesitter.lua | 3 +++ lua/lazyvim/plugins/ui.lua | 3 ++- lua/lazyvim/plugins/util.lua | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index c37de8dddb..d2f5b77505 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -1,5 +1,8 @@ local load_textobjects = false return { + -- Treesitter is a new parser generator tool that we can + -- use in Neovim to power faster and more accurate + -- syntax highlighting. { "nvim-treesitter/nvim-treesitter", version = false, -- last release is way too old and doesn't work on Windows diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 2ba6c03380..3976c97419 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -272,7 +272,8 @@ return { }, }, - -- dashboard + -- Dashboard. This runs when neovim starts, and is what displays + -- the "LAZYVIM" banner. { "goolord/alpha-nvim", event = "VimEnter", diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 89847d66ca..7baa387e71 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -9,7 +9,9 @@ return { end, }, - -- session management + -- 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. { "folke/persistence.nvim", event = "BufReadPre", From df0818880e66086f10982827ea11332b46c3b74f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 20 Jul 2023 23:38:40 +0200 Subject: [PATCH 100/513] fix(util): fixed line number toggling. Closes #1173 --- lua/lazyvim/config/keymaps.lua | 2 +- lua/lazyvim/util/init.lua | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index e96c9d922f..c86e6944a2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -111,7 +111,7 @@ end map("n", "uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" }) map("n", "us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) map("n", "uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) -map("n", "ul", function() Util.toggle("relativenumber", true) Util.toggle("number") end, { desc = "Toggle Line Numbers" }) +map("n", "ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" }) map("n", "ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" }) local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 10c82c135f..dba6aaadb5 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -186,6 +186,20 @@ function M.toggle(option, silent, values) end end +local nu = { number = true, relativenumber = true } +function M.toggle_number() + if vim.opt_local.number:get() or vim.opt_local.relativenumber:get() then + nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() } + vim.opt_local.number = false + vim.opt_local.relativenumber = false + Util.warn("Disabled line numbers", { title = "Option" }) + else + vim.opt_local.number = nu.number + vim.opt_local.relativenumber = nu.relativenumber + Util.info("Enabled line numbers", { title = "Option" }) + end +end + local enabled = true function M.toggle_diagnostics() enabled = not enabled From fc50c055c3db561043e23b53afc270de2231fbb2 Mon Sep 17 00:00:00 2001 From: qizidog <451559450@qq.com> Date: Fri, 21 Jul 2023 05:40:23 +0800 Subject: [PATCH 101/513] feat: add a keybind to search register (#1170) use `"` to search register through telescope --- lua/lazyvim/plugins/editor.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index eeaa4649ea..1fad510ca2 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -103,6 +103,7 @@ return { { "gc", "Telescope git_commits", desc = "commits" }, { "gs", "Telescope git_status", desc = "status" }, -- search + { 's"', "Telescope registers", desc = "Registers" }, { "sa", "Telescope autocommands", desc = "Auto Commands" }, { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, { "sc", "Telescope command_history", desc = "Command History" }, From 871e7fb0dbe0a9b5bed1a454cd1ee8464b6b9fa4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 08:14:39 +0200 Subject: [PATCH 102/513] chore(main): release 6.0.0 (#1158) 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 7ab9268172..9b7a5f1a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [6.0.0](https://github.com/LazyVim/LazyVim/compare/v5.1.1...v6.0.0) (2023-07-20) + + +### ⚠ BREAKING CHANGES + +* **options:** set default localleader to \ + +### Features + +* add a keybind to search register ([#1170](https://github.com/LazyVim/LazyVim/issues/1170)) ([fc50c05](https://github.com/LazyVim/LazyVim/commit/fc50c055c3db561043e23b53afc270de2231fbb2)) +* **keymaps:** added leader-K to run keywordprg ([a28acf0](https://github.com/LazyVim/LazyVim/commit/a28acf0ce7d00af11e7268c9edff579bd06abf56)) +* **lang:** add tex support ([#1156](https://github.com/LazyVim/LazyVim/issues/1156)) ([abaa6d9](https://github.com/LazyVim/LazyVim/commit/abaa6d90e4fe2c658b869e81a140a74f624d9299)) +* **options:** set default localleader to \ ([258f339](https://github.com/LazyVim/LazyVim/commit/258f339bcf8197ece54d66bf6ed6f351cb6e98cb)) + + +### Bug Fixes + +* **util:** fixed line number toggling. Closes [#1173](https://github.com/LazyVim/LazyVim/issues/1173) ([df08188](https://github.com/LazyVim/LazyVim/commit/df0818880e66086f10982827ea11332b46c3b74f)) + ## [5.1.1](https://github.com/LazyVim/LazyVim/compare/v5.1.0...v5.1.1) (2023-07-16) From a184fc1c732e16b10ed0bb19f8e9789b2b20b71a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 21 Jul 2023 06:15:15 +0000 Subject: [PATCH 103/513] 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 4cdf4b3b91..6a47de0451 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 20 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 21 ============================================================================== Table of Contents *LazyVim-table-of-contents* From d71ebeab24565bb109adc68253c2da6614eb5dda Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 21 Jul 2023 16:35:02 -0400 Subject: [PATCH 104/513] feat(clangd): better clangd root detection (#1165) --- lua/lazyvim/plugins/extras/lang/clangd.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 339a8b8f91..d9ce751c24 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -53,14 +53,19 @@ return { keys = { { "cR", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, }, - root_dir = function(...) - -- using a root .clang-format or .clang-tidy file messes up projects, so remove them + root_dir = function(fname) return require("lspconfig.util").root_pattern( - "compile_commands.json", - "compile_flags.txt", + "Makefile", + "CMakeLists.txt", "configure.ac", - ".git" - )(...) + "configure.in", + "config.h.in", + "meson.build", + "meson_options.txt", + "build.ninja" + )(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")( + fname + ) or require("lspconfig.util").find_git_ancestor(fname) end, capabilities = { offsetEncoding = { "utf-16" }, From e5f53ee1931fdc8c0f0d3150cbb5742dcb8ff477 Mon Sep 17 00:00:00 2001 From: Robson Roberto Souza Peixoto <124390+robsonpeixoto@users.noreply.github.com> Date: Sat, 22 Jul 2023 04:10:37 -0300 Subject: [PATCH 105/513] fix(terraform): configure commentstring (#1171) --- lua/lazyvim/plugins/extras/lang/terraform.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 2ad8835279..441887fadd 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -1,3 +1,9 @@ +vim.api.nvim_create_autocmd("FileType", { + pattern = { "hcl", "terraform" }, + desc = "terraform/hcl commentstring configuration", + command = "setlocal commentstring=#\\ %s", +}) + return { { "nvim-treesitter/nvim-treesitter", From 31b50e3a9c81bf520ec53444647da5306547eeb6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 22 Jul 2023 07:11:19 +0000 Subject: [PATCH 106/513] 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 6a47de0451..06929d4602 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 21 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 22 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 0411baab8985450a15a54a46c48197b704bc24cc Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Sat, 22 Jul 2023 03:12:42 -0400 Subject: [PATCH 107/513] feat(lang): add java (#1132) --- lua/lazyvim/plugins/extras/lang/java.lua | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/java.lua diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua new file mode 100644 index 0000000000..0f4062873b --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -0,0 +1,74 @@ +return { + -- Add java to treesitter. + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "java" }) + end + end, + }, + + -- Set up lsp with mfussenegger/nvim-jdtls instead of nvim-lspconfig. + { + "neovim/nvim-lspconfig", + dependencies = { "folke/which-key.nvim", "mfussenegger/nvim-jdtls" }, + opts = { + -- make sure mason installs the server + servers = { + jdtls = { + -- stylua: ignore + keys = { + { "co", function() require("jdtls").organize_imports() end, desc = "Organize Imports", }, + { "cR", function() require("jdtls").rename_file() end, desc = "Rename File", }, + { "cxv", function() require("jdtls").extract_variable() end, desc = "Extract Variable", }, + { "cxv", function() require("jdtls").extract_variable({ visual = true }) end, mode = "v", desc = "Extract Variable", }, + { "cxc", function() require("jdtls").extract_constant() end, desc = "Extract Constant", }, + { "cxc", function() require("jdtls").extract_constant({ visual = true }) end, mode = "v", desc = "Extract Constant", }, + { "cxm", function() require("jdtls").extract_method({ visual = true }) end, mode = "v", desc = "Extract Method", }, + }, + }, + }, + setup = { + -- Override the default jdtls server startup to use nvim-jdtls. + jdtls = function() + -- The lspconfig configuration for jdtls contains two useful items: + -- 1. The list of filetypes on which to match. + -- 2. Custom method for finding the root for a java project. + local lsp_config = require("lspconfig.server_configurations.jdtls").default_config + local find_java_project_root = lsp_config.root_dir + local filetypes = lsp_config.filetypes + + -- Attach jdtls for the proper filetypes (i.e. java). + -- Existing server will be reused if the root_dir matches. + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("MyJdtls", { clear = true }), + pattern = filetypes, + callback = function() + local fname = vim.api.nvim_buf_get_name(0) + local root_dir = find_java_project_root(fname) + local project_name = root_dir and vim.fs.basename(root_dir) + local cmd = { "jdtls" } + if project_name then + local jdtls_cache_dir = vim.fs.joinpath(vim.fn.stdpath("cache"), "jdtls", project_name) + vim.list_extend(cmd, { + "-configuration", + vim.fs.joinpath(jdtls_cache_dir, "config"), + "-data", + vim.fs.joinpath(jdtls_cache_dir, "workspace"), + }) + end + require("jdtls").start_or_attach({ + cmd = cmd, + root_dir = root_dir, + }) + require("which-key").register({ c = { x = { name = "Extract" } } }, { prefix = "" }) + end, + }) + + return true -- avoid duplicate servers + end, + }, + }, + }, +} From 02d673d37c6a097a43db877644e20db84f0880b1 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sat, 22 Jul 2023 09:13:54 +0200 Subject: [PATCH 108/513] feat(lang): add debug adapter plugin for go (#1115) neotest-go does not provide a DAP strategy, and thus you cannot invoke the debugger with require('neotest').run.run({strategy=dap}). There have been efforts to implement this in https://github.com/nvim-neotest/neotest-go/issues/12 but this seems to have stalled. You can find the background to this change discussed here: https://github.com/LazyVim/LazyVim/discussions/1107 --- lua/lazyvim/plugins/extras/lang/go.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 38aabc908d..a78a7434b7 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -15,6 +15,10 @@ return { opts = { servers = { gopls = { + keys = { + -- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12 + { "td", "lua require('dap-go').debug_test()", desc = "Debug Nearest (Go)" }, + }, settings = { gopls = { gofumpt = true, @@ -103,6 +107,10 @@ return { vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" }) end, }, + { + "leoluz/nvim-dap-go", + config = true, + }, }, }, { From 6b2c648878b8df538d719c06394bc430cc3ed48c Mon Sep 17 00:00:00 2001 From: Sam Amis <30879203+SameAsMuli@users.noreply.github.com> Date: Sat, 22 Jul 2023 02:15:14 -0500 Subject: [PATCH 109/513] feat(telescope): allow word and selection searches (#1096) Changes the current normal-mode mappings sw / sW to only display matches surrounded by word boundaries. Also adds the equivalent visual-mode mappings to allow searching for the current selection. Selection searching does not consider word boundaries, so highlighting a single word and searching for it will produce the same results as the word-under-cursor searching did before this change. This allows the user to easily choose whether or not to include word boundaries in their search. --- 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 1fad510ca2..d073dc58a6 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -119,8 +119,10 @@ return { { "sm", "Telescope marks", desc = "Jump to Mark" }, { "so", "Telescope vim_options", desc = "Options" }, { "sR", "Telescope resume", desc = "Resume" }, - { "sw", Util.telescope("grep_string"), desc = "Word (root dir)" }, - { "sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" }, + { "sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" }, + { "sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" }, + { "sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" }, + { "sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" }, { "uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" }, { "ss", From 012ca50b2801cc1c4e5b886cc26ebe0da532e31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Sat, 22 Jul 2023 09:21:12 +0200 Subject: [PATCH 110/513] feat(python): add semantic highlighting (#1149) * feat(python): add semantic highlighting * refactor: moved to python-semshi --------- Co-authored-by: Folke Lemaitre --- .../plugins/extras/lang/python-semshi.lua | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/python-semshi.lua diff --git a/lua/lazyvim/plugins/extras/lang/python-semshi.lua b/lua/lazyvim/plugins/extras/lang/python-semshi.lua new file mode 100644 index 0000000000..a9a4870ef6 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/python-semshi.lua @@ -0,0 +1,31 @@ +return { + -- "numiras/semshi", + "wookayin/semshi", -- use a maintained fork + ft = "python", + build = ":UpdateRemotePlugins", + init = function() + -- Disabled these features better provided by LSP or other more general plugins + vim.g["semshi#error_sign"] = false + vim.g["semshi#simplify_markup"] = false + vim.g["semshi#mark_selected_nodes"] = false + vim.g["semshi#update_delay_factor"] = 0.001 + + -- This autocmd must be defined in init to take effect + vim.api.nvim_create_autocmd({ "VimEnter", "ColorScheme" }, { + group = vim.api.nvim_create_augroup("SemanticHighlight", {}), + callback = function() + -- Only add style, inherit or link to the LSP's colors + vim.cmd([[ + highlight! semshiGlobal gui=italic + highlight! semshiImported gui=bold + highlight! link semshiParameter @lsp.type.parameter + highlight! link semshiParameterUnused DiagnosticUnnecessary + highlight! link semshiBuiltin @function.builtin + highlight! link semshiAttribute @attribute + highlight! link semshiSelf @lsp.type.selfKeyword + highlight! link semshiUnresolved @lsp.type.unresolvedReference + ]]) + end, + }) + end, +} From fa898b7293c6c67b0ae2bae1d3be70413bcadd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owicz?= Date: Sat, 22 Jul 2023 09:27:06 +0200 Subject: [PATCH 111/513] feat(lang): add cmake support (#1032) * feat(lang): add cmake support * refactor --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/cmake.lua | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/cmake.lua diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua new file mode 100644 index 0000000000..850a2a2ccf --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -0,0 +1,40 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "cmake" }) + end + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + vim.list_extend(opts.sources, { + nls.builtins.diagnostics.cmake_lint, + }) + end, + }, + { + "mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "cmakelint" }) + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + neocmake = {}, + }, + }, + }, + { + "Civitasv/cmake-tools.nvim", + opts = {}, + event = "BufRead", + }, +} From 142e6bec209704210db23b3424b4d51896bb206a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 09:28:43 +0200 Subject: [PATCH 112/513] chore(main): release 6.1.0 (#1181) 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 9b7a5f1a4a..b422ff403f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [6.1.0](https://github.com/LazyVim/LazyVim/compare/v6.0.0...v6.1.0) (2023-07-22) + + +### Features + +* **clangd:** better clangd root detection ([#1165](https://github.com/LazyVim/LazyVim/issues/1165)) ([d71ebea](https://github.com/LazyVim/LazyVim/commit/d71ebeab24565bb109adc68253c2da6614eb5dda)) +* **lang:** add cmake support ([#1032](https://github.com/LazyVim/LazyVim/issues/1032)) ([fa898b7](https://github.com/LazyVim/LazyVim/commit/fa898b7293c6c67b0ae2bae1d3be70413bcadd8d)) +* **lang:** add debug adapter plugin for go ([#1115](https://github.com/LazyVim/LazyVim/issues/1115)) ([02d673d](https://github.com/LazyVim/LazyVim/commit/02d673d37c6a097a43db877644e20db84f0880b1)) +* **lang:** add java ([#1132](https://github.com/LazyVim/LazyVim/issues/1132)) ([0411baa](https://github.com/LazyVim/LazyVim/commit/0411baab8985450a15a54a46c48197b704bc24cc)) +* **python:** add semantic highlighting ([#1149](https://github.com/LazyVim/LazyVim/issues/1149)) ([012ca50](https://github.com/LazyVim/LazyVim/commit/012ca50b2801cc1c4e5b886cc26ebe0da532e31d)) +* **telescope:** allow word and selection searches ([#1096](https://github.com/LazyVim/LazyVim/issues/1096)) ([6b2c648](https://github.com/LazyVim/LazyVim/commit/6b2c648878b8df538d719c06394bc430cc3ed48c)) + + +### Bug Fixes + +* **terraform:** configure commentstring ([#1171](https://github.com/LazyVim/LazyVim/issues/1171)) ([e5f53ee](https://github.com/LazyVim/LazyVim/commit/e5f53ee1931fdc8c0f0d3150cbb5742dcb8ff477)) + ## [6.0.0](https://github.com/LazyVim/LazyVim/compare/v5.1.1...v6.0.0) (2023-07-20) From b97ccb9e7390b6e73e3f1a4d63a443f6cec67f07 Mon Sep 17 00:00:00 2001 From: Andreas Gerlach Date: Sun, 23 Jul 2023 18:06:25 +0200 Subject: [PATCH 113/513] fix: #1194 use cmakelang instead of cmakelint (#1197) --- lua/lazyvim/plugins/extras/lang/cmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 850a2a2ccf..9d82c71bb6 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -21,7 +21,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "cmakelint" }) + vim.list_extend(opts.ensure_installed, { "cmakelang" }) end, }, { From 07f183516f1b287d1f6e5a119b968ee64973abc1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 23 Jul 2023 16:07:08 +0000 Subject: [PATCH 114/513] 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 06929d4602..4b449b8571 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 22 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 23 ============================================================================== Table of Contents *LazyVim-table-of-contents* From f6d646a3251efb39f7cb5de38b529c5dd1324f28 Mon Sep 17 00:00:00 2001 From: Andreas Gerlach Date: Sun, 23 Jul 2023 18:08:01 +0200 Subject: [PATCH 115/513] feat(java): add test and debug support for Java extension (#1192) --- lua/lazyvim/plugins/extras/lang/java.lua | 59 ++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 0f4062873b..bf90ff8018 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -9,6 +9,21 @@ return { end, }, + -- Ensure java debugger and test packages are installed + { + "mfussenegger/nvim-dap", + optional = true, + dependencies = { + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" }) + end, + }, + }, + }, + -- Set up lsp with mfussenegger/nvim-jdtls instead of nvim-lspconfig. { "neovim/nvim-lspconfig", @@ -38,7 +53,25 @@ return { local lsp_config = require("lspconfig.server_configurations.jdtls").default_config local find_java_project_root = lsp_config.root_dir local filetypes = lsp_config.filetypes - + -- lookup paths for java test and debugger package + local mason_registry = require("mason-registry") + local bundles = {} + if mason_registry.has_package("java-test") and mason_registry.has_package("java-debug-adapter") then + -- jdtls tools configuration for debugging support + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + java_test_path .. "/extension/server/*.jar" + } + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), '\n')) do + table.insert(bundles, bundle) + end + end + end -- Attach jdtls for the proper filetypes (i.e. java). -- Existing server will be reused if the root_dir matches. vim.api.nvim_create_autocmd("FileType", { @@ -58,14 +91,32 @@ return { vim.fs.joinpath(jdtls_cache_dir, "workspace"), }) end - require("jdtls").start_or_attach({ + local jdtls_base_config = { + on_attach = require("lazyvim.util").on_attach(function(client, buffer) + if mason_registry.has_package("java-test") then + -- custom keymaps for Java test runner (not yet compatible with neotest) + vim.keymap.set("n", "tT", function() require("jdtls").pick_test({ bufnr = buffer }) end, { buffer = buffer, desc = "Run specific Test" }) + vim.keymap.set("n", "tt", function() require("jdtls").test_class({ bufnr = buffer }) end, { buffer = buffer, desc = "Run File" }) + vim.keymap.set("n", "tr", function() require("jdtls").test_nearest_method({ bufnr = buffer }) end, { buffer = buffer, desc = "Run nearest" }) + end + if mason_registry.has_package("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.dap").setup_dap_main_class_configs() + end + require("jdtls.setup").add_commands() + end), cmd = cmd, root_dir = root_dir, - }) + init_options = { + bundles = bundles, + } + } + local jdtls_opts = require("lazyvim.util").opts("nvim-jdtls") + require("jdtls").start_or_attach(vim.tbl_deep_extend("force", jdtls_opts or {}, jdtls_base_config)) require("which-key").register({ c = { x = { name = "Extract" } } }, { prefix = "" }) end, }) - return true -- avoid duplicate servers end, }, From 9a0543531d05a417ba63f3dd710530ba5765aca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Sun, 23 Jul 2023 09:09:48 -0700 Subject: [PATCH 116/513] fix(lsp): supports_method for checking inlay hint support (#1195) --- lua/lazyvim/plugins/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index d49dbbfd4f..9c542b35f7 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -123,7 +123,7 @@ return { if opts.inlay_hints.enabled and inlay_hint then Util.on_attach(function(client, buffer) - if client.server_capabilities.inlayHintProvider then + if client.supports_method('textDocument/inlayHint') then inlay_hint(buffer, true) end end) From 2e0905147269d92d58627303bcae60bbcb3807dd Mon Sep 17 00:00:00 2001 From: Andreas Gerlach Date: Tue, 25 Jul 2023 15:25:24 +0200 Subject: [PATCH 117/513] fix: fixes #1207 (#1213) Co-authored-by: Andreas Gerlach --- lua/lazyvim/plugins/extras/lang/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index bf90ff8018..54f1f534a7 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -83,7 +83,7 @@ return { local project_name = root_dir and vim.fs.basename(root_dir) local cmd = { "jdtls" } if project_name then - local jdtls_cache_dir = vim.fs.joinpath(vim.fn.stdpath("cache"), "jdtls", project_name) + local jdtls_cache_dir = vim.fn.stdpath("cache") .. "/jdtls/" .. project_name vim.list_extend(cmd, { "-configuration", vim.fs.joinpath(jdtls_cache_dir, "config"), From 79619364bd7ff89dc80ac6093db9df957dee81ed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 25 Jul 2023 13:26:10 +0000 Subject: [PATCH 118/513] 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 4b449b8571..cf27f96cfa 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 23 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 25 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 76d33bba2cc8bd691979ee8bc66f8ac36236c3ba Mon Sep 17 00:00:00 2001 From: Radvil <36059968+radvil@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:39:08 +0800 Subject: [PATCH 119/513] feat: Enable flash.nvim highlight on catppuccin integration (#1206) Since flash.nvim has already been the default one, and catppuccin already support it Co-authored-by: Radvil --- lua/lazyvim/plugins/colorscheme.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 278e9bca9d..8ed12bbd9a 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -16,6 +16,7 @@ return { integrations = { alpha = true, cmp = true, + flash = true, gitsigns = true, illuminate = true, indent_blankline = { enabled = true }, From 9fe89f5f8a5a50438276a4d2f757549ea2496ca0 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis Date: Tue, 25 Jul 2023 20:22:10 +0300 Subject: [PATCH 120/513] fix(lang_java): fixes #1215 other two entries of `vim.fs.joinpath` as well that were not changed in #1213 (#1216) --- lua/lazyvim/plugins/extras/lang/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 54f1f534a7..d7e7f91e6e 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -86,9 +86,9 @@ return { local jdtls_cache_dir = vim.fn.stdpath("cache") .. "/jdtls/" .. project_name vim.list_extend(cmd, { "-configuration", - vim.fs.joinpath(jdtls_cache_dir, "config"), + jdtls_cache_dir .. "/config", "-data", - vim.fs.joinpath(jdtls_cache_dir, "workspace"), + jdtls_cache_dir .. "/workspace", }) end local jdtls_base_config = { From 6dc66852b8851f02b372e8a2882fddf04b3b6966 Mon Sep 17 00:00:00 2001 From: Andreas Gerlach Date: Tue, 25 Jul 2023 19:37:13 +0200 Subject: [PATCH 121/513] feat(extra): add yaml language extension (#1198) * feat: add yaml language extension * fix(yaml): disable keyOrdering checks --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/yaml.lua | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/yaml.lua diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua new file mode 100644 index 0000000000..b097cdf692 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -0,0 +1,48 @@ +return { + + -- add yaml specific modules to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "yaml" }) + end + end, + }, + + -- correctly setup lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "b0o/SchemaStore.nvim", + version = false, -- last release is way too old + }, + opts = { + -- make sure mason installs the server + servers = { + yamlls = { + -- lazy-load schemastore when needed + on_new_config = function(new_config) + new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {} + vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas()) + end, + settings = { + redhat = { telemetry = { enabled = false } }, + yaml = { + keyOrdering = false, + format = { + enable = true, + }, + validate = { enable = true }, + schemaStore = { + -- Must disable built-in schemaStore support to use + -- schemas from SchemaStore.nvim plugin + enable = false, + }, + }, + }, + }, + }, + }, + }, +} From aa1cccf230a01bd85d5173f7d87f782fd83caa88 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 19:39:16 +0200 Subject: [PATCH 122/513] chore(main): release 6.2.0 (#1202) 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 b422ff403f..fa19a45bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [6.2.0](https://github.com/LazyVim/LazyVim/compare/v6.1.0...v6.2.0) (2023-07-25) + + +### Features + +* Enable flash.nvim highlight on catppuccin integration ([#1206](https://github.com/LazyVim/LazyVim/issues/1206)) ([76d33bb](https://github.com/LazyVim/LazyVim/commit/76d33bba2cc8bd691979ee8bc66f8ac36236c3ba)) +* **extra:** add yaml language extension ([#1198](https://github.com/LazyVim/LazyVim/issues/1198)) ([6dc6685](https://github.com/LazyVim/LazyVim/commit/6dc66852b8851f02b372e8a2882fddf04b3b6966)) +* **java:** add test and debug support for Java extension ([#1192](https://github.com/LazyVim/LazyVim/issues/1192)) ([f6d646a](https://github.com/LazyVim/LazyVim/commit/f6d646a3251efb39f7cb5de38b529c5dd1324f28)) + + +### Bug Fixes + +* [#1194](https://github.com/LazyVim/LazyVim/issues/1194) use cmakelang instead of cmakelint ([#1197](https://github.com/LazyVim/LazyVim/issues/1197)) ([b97ccb9](https://github.com/LazyVim/LazyVim/commit/b97ccb9e7390b6e73e3f1a4d63a443f6cec67f07)) +* fixes [#1207](https://github.com/LazyVim/LazyVim/issues/1207) ([#1213](https://github.com/LazyVim/LazyVim/issues/1213)) ([2e09051](https://github.com/LazyVim/LazyVim/commit/2e0905147269d92d58627303bcae60bbcb3807dd)) +* **lang_java:** fixes [#1215](https://github.com/LazyVim/LazyVim/issues/1215) other two entries of `vim.fs.joinpath` as well that were not changed in [#1213](https://github.com/LazyVim/LazyVim/issues/1213) ([#1216](https://github.com/LazyVim/LazyVim/issues/1216)) ([9fe89f5](https://github.com/LazyVim/LazyVim/commit/9fe89f5f8a5a50438276a4d2f757549ea2496ca0)) +* **lsp:** supports_method for checking inlay hint support ([#1195](https://github.com/LazyVim/LazyVim/issues/1195)) ([9a05435](https://github.com/LazyVim/LazyVim/commit/9a0543531d05a417ba63f3dd710530ba5765aca5)) + ## [6.1.0](https://github.com/LazyVim/LazyVim/compare/v6.0.0...v6.1.0) (2023-07-22) From d7ca822d41bc65e31dc1019a64d5d3518c8e2470 Mon Sep 17 00:00:00 2001 From: Javier Tia Date: Wed, 26 Jul 2023 13:43:49 -0600 Subject: [PATCH 123/513] fix(yaml): yaml: Fix TypeError undefined length (#1229) In YAML files LSP completion is not happening because yaml-language-server is failing with error: TypeError: Cannot read properties of undefined (reading 'length') from out/server/src/languageserver/handlers/settingsHandlers.js:78:51, which it's expecting to have yaml.schemaStore.url.length and it's doesn't exist. Signed-off-by: Javier Tia --- lua/lazyvim/plugins/extras/lang/yaml.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index b097cdf692..520346642b 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -38,6 +38,8 @@ return { -- Must disable built-in schemaStore support to use -- schemas from SchemaStore.nvim plugin enable = false, + -- Avoid TypeError: Cannot read properties of undefined (reading 'length') + url = "", }, }, }, From 549baee2242f3ce9fd7bb27dd331430a82326705 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Jul 2023 19:44:27 +0000 Subject: [PATCH 124/513] 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 cf27f96cfa..caf034f7b2 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 25 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 26 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 9264c54ae96d1d56f029ad9b561326c7b991c53b Mon Sep 17 00:00:00 2001 From: Luco Bellic Date: Wed, 26 Jul 2023 21:44:47 +0200 Subject: [PATCH 125/513] feat(clangd): remove CMakelists root_dir search (#1230) Provide better handling of root_dir search for C++ project using CMakelists.txt per folder --- lua/lazyvim/plugins/extras/lang/clangd.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index d9ce751c24..50cf8f438b 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -56,7 +56,6 @@ return { root_dir = function(fname) return require("lspconfig.util").root_pattern( "Makefile", - "CMakeLists.txt", "configure.ac", "configure.in", "config.h.in", From a62a5942deb281b9edce3673e656854805297199 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Sun, 30 Jul 2023 11:09:44 +0200 Subject: [PATCH 126/513] fix(yaml): yaml validate and enable line folding (#1251) * fix(yaml): enable validate see https://github.com/redhat-developer/yaml-language-server#language-server-settings * feat(yaml): support line folding --- lua/lazyvim/plugins/extras/lang/yaml.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 520346642b..ca808bbfa5 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -21,6 +21,15 @@ return { -- make sure mason installs the server servers = { yamlls = { + -- Have to add this for yamlls to understand that we support line folding + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + }, + }, + }, -- lazy-load schemastore when needed on_new_config = function(new_config) new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {} @@ -33,7 +42,7 @@ return { format = { enable = true, }, - validate = { enable = true }, + validate = true, schemaStore = { -- Must disable built-in schemaStore support to use -- schemas from SchemaStore.nvim plugin From c1fc996ccd51a343f2bb18cc2578343503e7da93 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 30 Jul 2023 09:10:24 +0000 Subject: [PATCH 127/513] 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 caf034f7b2..3d0069db2a 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 26 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 30 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 566049aa4a26a86219dd1ad1624f9a1bf18831b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=B5=20Quang=20Chi=E1=BA=BFn?= <87252943+yeuxacucodon@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:10:45 +0700 Subject: [PATCH 128/513] feat(treesitter): add jsdoc to ensure_installed (#1252) better highlighting for jsdoc comment --- 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 d2f5b77505..b84d01a70f 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -34,6 +34,7 @@ return { "c", "html", "javascript", + "jsdoc", "json", "lua", "luadoc", From 73dc5a503f1f42fc12869688df1359ffd80da5d1 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Tue, 29 Aug 2023 11:57:09 -0400 Subject: [PATCH 129/513] fix(clangd): update setup from upstream changes (#1308) --- lua/lazyvim/plugins/extras/lang/clangd.lua | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 50cf8f438b..0801770064 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -15,29 +15,27 @@ return { lazy = true, config = function() end, opts = { - extensions = { - inlay_hints = { - inline = false, + inlay_hints = { + inline = false, + }, + ast = { + --These require codicons (https://github.com/microsoft/vscode-codicons) + role_icons = { + type = "", + declaration = "", + expression = "", + specifier = "", + statement = "", + ["template argument"] = "", }, - ast = { - --These require codicons (https://github.com/microsoft/vscode-codicons) - role_icons = { - type = "", - declaration = "", - expression = "", - specifier = "", - statement = "", - ["template argument"] = "", - }, - kind_icons = { - Compound = "", - Recovery = "", - TranslationUnit = "", - PackExpansion = "", - TemplateTypeParm = "", - TemplateTemplateParm = "", - TemplateParamObject = "", - }, + kind_icons = { + Compound = "", + Recovery = "", + TranslationUnit = "", + PackExpansion = "", + TemplateTypeParm = "", + TemplateTemplateParm = "", + TemplateParamObject = "", }, }, }, @@ -89,7 +87,7 @@ return { clangd = function(_, opts) local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim") require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts })) - return true + return false end, }, }, From 971ed5c148d050ec6f0a7c11df4c83c402af9766 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 29 Aug 2023 15:57:49 +0000 Subject: [PATCH 130/513] 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 3d0069db2a..19ea6b2549 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 30 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 August 29 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 377c0e397c3585cf7bae6afb8bd279a47954be0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owicz?= Date: Tue, 29 Aug 2023 17:58:42 +0200 Subject: [PATCH 131/513] feat(python): add more venv names (#1381) --- lua/lazyvim/plugins/extras/lang/python.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 746435cc3c..9c71521d0e 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -61,7 +61,14 @@ return { { "linux-cultist/venv-selector.nvim", cmd = "VenvSelect", - opts = {}, + opts = { + name = { + "venv", + ".venv", + "env", + ".env", + }, + }, keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv" } }, }, } From 451bde5b41ec410afbb2b5e75e339a3fc44c5587 Mon Sep 17 00:00:00 2001 From: Xie Zejian Date: Tue, 29 Aug 2023 23:59:18 +0800 Subject: [PATCH 132/513] fix(python): disable ruff hover correctly (#1365) * fix: disable ruff hover correctly * better fix --- lua/lazyvim/plugins/extras/lang/python.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 9c71521d0e..e64decd1e2 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -14,16 +14,16 @@ return { pyright = {}, ruff_lsp = {}, }, - }, - setup = { - ruff_lsp = function() - require("lazyvim.util").on_attach(function(client, _) - if client.name == "ruff_lsp" then - -- Disable hover in favor of Pyright - client.server_capabilities.hoverProvider = false - end - end) - end, + setup = { + ruff_lsp = function() + require("lazyvim.util").on_attach(function(client, _) + if client.name == "ruff_lsp" then + -- Disable hover in favor of Pyright + client.server_capabilities.hoverProvider = false + end + end) + end, + }, }, }, { From 23e2b073e6fa75dacaa58dc1fe63392af7f54598 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 29 Aug 2023 18:00:54 +0200 Subject: [PATCH 133/513] fix(keymaps): remove gw keymap --- lua/lazyvim/config/keymaps.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c86e6944a2..84427e1681 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -66,8 +66,6 @@ map( { desc = "Redraw / clear hlsearch / diff update" } ) -map({ "n", "x" }, "gw", "*N", { desc = "Search word under cursor" }) - -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) From 64c5848fe8e6d6fcf233286b0d077a4d120c4d59 Mon Sep 17 00:00:00 2001 From: Zhizhen He Date: Wed, 30 Aug 2023 00:02:45 +0800 Subject: [PATCH 134/513] style: fix comment typo (#1336) --- lua/lazyvim/plugins/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 9c542b35f7..8c5dc71a89 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -170,7 +170,7 @@ return { require("lspconfig")[server].setup(server_opts) end - -- get all the servers that are available thourgh mason-lspconfig + -- get all the servers that are available through mason-lspconfig local have_mason, mlsp = pcall(require, "mason-lspconfig") local all_mslp_servers = {} if have_mason then From ec0ddd481c785833c5caac9c9d22889b9e963883 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis Date: Tue, 29 Aug 2023 19:07:56 +0300 Subject: [PATCH 135/513] fix(keymaps): change `v` mode to `x` mode for `save file` (#1262) While trying to disable `` entirely by `vim.keymap.del({ "i", "v","n", "s" }, "")` in my own `keymaps.lua`, I got an error on reopening Neovim `No such mapping`. After tinkering around a bit, I changed `v` to `x`, since `v` incorporates both `x` and `s` and the error stopped occuring. --- lua/lazyvim/config/keymaps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 84427e1681..541071991d 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -80,7 +80,7 @@ map("i", ".", ".u") map("i", ";", ";u") -- save file -map({ "i", "v", "n", "s" }, "", "w", { desc = "Save file" }) +map({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) --keywordprg map("n", "K", "norm! K", { desc = "Keywordprg" }) From f9dadc11b39fb0b027473caaab2200b35c9f0c8b Mon Sep 17 00:00:00 2001 From: Callum Howard Date: Wed, 30 Aug 2023 02:13:32 +1000 Subject: [PATCH 136/513] fix(autocmds): restore tabpage on resize (#1260) --- lua/lazyvim/config/autocmds.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index ec1b98df45..c8a513f5a8 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -22,7 +22,9 @@ vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd({ "VimResized" }, { group = augroup("resize_splits"), callback = function() + local current_tab = vim.fn.tabpagenr() vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) end, }) From 15022f4892726f9899ce5eb3aed7a19df29f62ef Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Mon, 4 Sep 2023 17:00:39 -0400 Subject: [PATCH 137/513] fix(java): don't accumulate on_attach, and make more configurable (#1388) * fix(java): don't accumulate on_attach, and make more configurable * refactor(java): move defaults to opts --- lua/lazyvim/plugins/extras/lang/java.lua | 280 ++++++++++++++++------- 1 file changed, 191 insertions(+), 89 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index d7e7f91e6e..64808bee7c 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -1,15 +1,33 @@ +local Util = require("lazyvim.util") + +-- This is the same as in lspconfig.server_configurations.jdtls, but avoids +-- needing to require that when this module loads. +local java_filetypes = { "java" } + +-- Utility function to extend or override a config table, similar to the way +-- that Plugin.opts works. +---@param config table +---@param custom function | table | nil +local function extend_or_override(config, custom, ...) + if type(custom) == "function" then + config = custom(config, ...) or config + elseif custom then + config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] + end + return config +end + return { -- Add java to treesitter. { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "java" }) - end + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "java" }) end, }, - -- Ensure java debugger and test packages are installed + -- Ensure java debugger and test packages are installed. { "mfussenegger/nvim-dap", optional = true, @@ -24,102 +42,186 @@ return { }, }, - -- Set up lsp with mfussenegger/nvim-jdtls instead of nvim-lspconfig. + -- Configure nvim-lspconfig to install the server automatically via mason, but + -- defer actually starting it to our configuration of nvim-jtdls below. { "neovim/nvim-lspconfig", - dependencies = { "folke/which-key.nvim", "mfussenegger/nvim-jdtls" }, opts = { -- make sure mason installs the server servers = { - jdtls = { - -- stylua: ignore - keys = { - { "co", function() require("jdtls").organize_imports() end, desc = "Organize Imports", }, - { "cR", function() require("jdtls").rename_file() end, desc = "Rename File", }, - { "cxv", function() require("jdtls").extract_variable() end, desc = "Extract Variable", }, - { "cxv", function() require("jdtls").extract_variable({ visual = true }) end, mode = "v", desc = "Extract Variable", }, - { "cxc", function() require("jdtls").extract_constant() end, desc = "Extract Constant", }, - { "cxc", function() require("jdtls").extract_constant({ visual = true }) end, mode = "v", desc = "Extract Constant", }, - { "cxm", function() require("jdtls").extract_method({ visual = true }) end, mode = "v", desc = "Extract Method", }, - }, - }, + jdtls = {}, }, setup = { - -- Override the default jdtls server startup to use nvim-jdtls. jdtls = function() - -- The lspconfig configuration for jdtls contains two useful items: - -- 1. The list of filetypes on which to match. - -- 2. Custom method for finding the root for a java project. - local lsp_config = require("lspconfig.server_configurations.jdtls").default_config - local find_java_project_root = lsp_config.root_dir - local filetypes = lsp_config.filetypes - -- lookup paths for java test and debugger package - local mason_registry = require("mason-registry") - local bundles = {} - if mason_registry.has_package("java-test") and mason_registry.has_package("java-debug-adapter") then - -- jdtls tools configuration for debugging support - local java_test_pkg = mason_registry.get_package("java-test") - local java_test_path = java_test_pkg:get_install_path() - local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") - local java_dbg_path = java_dbg_pkg:get_install_path() - local jar_patterns = { - java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", - java_test_path .. "/extension/server/*.jar" - } - for _, jar_pattern in ipairs(jar_patterns) do - for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), '\n')) do - table.insert(bundles, bundle) - end - end - end - -- Attach jdtls for the proper filetypes (i.e. java). - -- Existing server will be reused if the root_dir matches. - vim.api.nvim_create_autocmd("FileType", { - group = vim.api.nvim_create_augroup("MyJdtls", { clear = true }), - pattern = filetypes, - callback = function() - local fname = vim.api.nvim_buf_get_name(0) - local root_dir = find_java_project_root(fname) - local project_name = root_dir and vim.fs.basename(root_dir) - local cmd = { "jdtls" } - if project_name then - local jdtls_cache_dir = vim.fn.stdpath("cache") .. "/jdtls/" .. project_name - vim.list_extend(cmd, { - "-configuration", - jdtls_cache_dir .. "/config", - "-data", - jdtls_cache_dir .. "/workspace", - }) - end - local jdtls_base_config = { - on_attach = require("lazyvim.util").on_attach(function(client, buffer) - if mason_registry.has_package("java-test") then - -- custom keymaps for Java test runner (not yet compatible with neotest) - vim.keymap.set("n", "tT", function() require("jdtls").pick_test({ bufnr = buffer }) end, { buffer = buffer, desc = "Run specific Test" }) - vim.keymap.set("n", "tt", function() require("jdtls").test_class({ bufnr = buffer }) end, { buffer = buffer, desc = "Run File" }) - vim.keymap.set("n", "tr", function() require("jdtls").test_nearest_method({ bufnr = buffer }) end, { buffer = buffer, desc = "Run nearest" }) - end - if mason_registry.has_package("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap({ hotcodereplace = "auto" }) - require("jdtls.dap").setup_dap_main_class_configs() - end - require("jdtls.setup").add_commands() - end), - cmd = cmd, - root_dir = root_dir, - init_options = { - bundles = bundles, - } - } - local jdtls_opts = require("lazyvim.util").opts("nvim-jdtls") - require("jdtls").start_or_attach(vim.tbl_deep_extend("force", jdtls_opts or {}, jdtls_base_config)) - require("which-key").register({ c = { x = { name = "Extract" } } }, { prefix = "" }) - end, - }) return true -- avoid duplicate servers end, }, }, }, + + -- Set up nvim-jdtls to attach to java files. + { + "mfussenegger/nvim-jdtls", + dependencies = { "folke/which-key.nvim" }, + ft = java_filetypes, + opts = function() + return { + -- How to find the root dir for a given filename. The default comes from + -- lspconfig which provides a function specifically for java projects. + root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir, + + -- How to find the project name for a given root dir. + project_name = function(root_dir) + return root_dir and vim.fs.basename(root_dir) + end, + + -- Where are the config and workspace dirs for a project? + jdtls_config_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + end, + jdtls_workspace_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + end, + + -- How to run jdtls. This can be overridden to a full java command-line + -- if the Python wrapper script doesn't suffice. + cmd = { "jdtls" }, + full_cmd = function(opts) + local fname = vim.api.nvim_buf_get_name(0) + local root_dir = opts.root_dir(fname) + local project_name = opts.project_name(root_dir) + local cmd = vim.deepcopy(opts.cmd) + if project_name then + vim.list_extend(cmd, { + "-configuration", + opts.jdtls_config_dir(project_name), + "-data", + opts.jdtls_workspace_dir(project_name), + }) + end + return cmd + end, + + -- These depend on nvim-dap, but can additionally be disabled by setting false here. + dap = { hotcodereplace = "auto", config_overrides = {} }, + test = true, + } + end, + config = function() + local opts = Util.opts("nvim-jdtls") or {} + + -- Find the extra bundles that should be passed on the jdtls command-line + -- if nvim-dap is enabled with java debug/test. + local mason_registry = require("mason-registry") + local bundles = {} ---@type string[] + if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + } + -- java-test also depends on java-debug-adapter. + if opts.test and mason_registry.is_installed("java-test") then + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + vim.list_extend(jar_patterns, { + java_test_path .. "/extension/server/*.jar", + }) + end + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do + table.insert(bundles, bundle) + end + end + end + + local function attach_jdtls() + local fname = vim.api.nvim_buf_get_name(0) + + -- Configuration can be augmented and overridden by opts.jdtls + local config = extend_or_override({ + cmd = opts.full_cmd(opts), + root_dir = opts.root_dir(fname), + init_options = { + bundles = bundles, + }, + -- enable CMP capabilities + capabilities = require("cmp_nvim_lsp").default_capabilities(), + }, opts.jdtls) + + -- Existing server will be reused if the root_dir matches. + require("jdtls").start_or_attach(config) + -- not need to require("jdtls.setup").add_commands(), start automatically adds commands + end + + -- Attach the jdtls for each java buffer. HOWEVER, this plugin loads + -- depending on filetype, so this autocmd doesn't run for the first file. + -- For that, we call directly below. + vim.api.nvim_create_autocmd("FileType", { + pattern = java_filetypes, + callback = attach_jdtls, + }) + + -- Setup keymap and dap after the lsp is fully attached. + -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration + -- https://neovim.io/doc/user/lsp.html#LspAttach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and client.name == "jdtls" then + local wk = require("which-key") + wk.register({ + ["cx"] = { name = "+extract" }, + ["cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" }, + ["cxc"] = { require("jdtls").extract_constant, "Extract Constant" }, + ["gs"] = { require("jdtls").super_implementation, "Goto Super" }, + ["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" }, + ["co"] = { require("jdtls").organize_imports, "Organize Imports" }, + }, { mode = "n", buffer = args.buf }) + wk.register({ + ["c"] = { name = "+code" }, + ["cx"] = { name = "+extract" }, + ["cxm"] = { + [[lua require('jdtls').extract_method(true)]], + "Extract Method", + }, + ["cxv"] = { + [[lua require('jdtls').extract_variable_all(true)]], + "Extract Variable", + }, + ["cxc"] = { + [[lua require('jdtls').extract_constant(true)]], + "Extract Constant", + }, + }, { mode = "v", buffer = args.buf }) + + if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + require("jdtls.dap").setup_dap_main_class_configs() + + -- Java Test require Java debugger to work + if opts.test and mason_registry.is_installed("java-test") then + -- custom keymaps for Java test runner (not yet compatible with neotest) + wk.register({ + ["t"] = { name = "+test" }, + ["tt"] = { require("jdtls.dap").test_class, "Run All Test" }, + ["tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, + ["tT"] = { require("jdtls.dap").pick_test, "Run Test" }, + }, { mode = "n", buffer = args.buf }) + end + end + + -- User can set additional keymaps in opts.on_attach + if opts.on_attach then + opts.on_attach(args) + end + end + end, + }) + + -- Avoid race condition by calling attach the first time, since the autocmd won't fire. + attach_jdtls() + end, + }, } From a910b871d1ce9d3b21338df9b8353f3b9020dc11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Sep 2023 21:05:40 +0000 Subject: [PATCH 138/513] 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 19ea6b2549..613586da95 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 August 29 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 04 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 6045a52d82ba4b0dcd0b050688302a22c2fc3991 Mon Sep 17 00:00:00 2001 From: GrigoreAlexandru-Arch <93489863+GrigoreAlexandru-Arch@users.noreply.github.com> Date: Tue, 5 Sep 2023 00:07:55 +0300 Subject: [PATCH 139/513] fix: #1305 rust debugging not working on windows due to missing liblldb path (#1390) --- lua/lazyvim/plugins/extras/lang/rust.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 4e8272708f..699ad5631c 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -51,8 +51,14 @@ return { local codelldb = mason_registry.get_package("codelldb") local extension_path = codelldb:get_install_path() .. "/extension/" local codelldb_path = extension_path .. "adapter/codelldb" - local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib" - or extension_path .. "lldb/lib/liblldb.so" + local liblldb_path = "" + if vim.loop.os_uname().sysname:find("Windows") then + liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll" + elseif vim.fn.has("mac") == 1 then + liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" + else + liblldb_path = extension_path .. "lldb/lib/liblldb.so" + end adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) end return { From a72a84972d85e5bbc6b9d60a0983b37efef21b8a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 23:10:50 +0200 Subject: [PATCH 140/513] chore(main): release 6.3.0 (#1231) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa19a45bc9..b553d773c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [6.3.0](https://github.com/LazyVim/LazyVim/compare/v6.2.0...v6.3.0) (2023-09-04) + + +### Features + +* **clangd:** remove CMakelists root_dir search ([#1230](https://github.com/LazyVim/LazyVim/issues/1230)) ([9264c54](https://github.com/LazyVim/LazyVim/commit/9264c54ae96d1d56f029ad9b561326c7b991c53b)) +* **python:** add more venv names ([#1381](https://github.com/LazyVim/LazyVim/issues/1381)) ([377c0e3](https://github.com/LazyVim/LazyVim/commit/377c0e397c3585cf7bae6afb8bd279a47954be0a)) +* **treesitter:** add jsdoc to ensure_installed ([#1252](https://github.com/LazyVim/LazyVim/issues/1252)) ([566049a](https://github.com/LazyVim/LazyVim/commit/566049aa4a26a86219dd1ad1624f9a1bf18831b6)) + + +### Bug Fixes + +* [#1305](https://github.com/LazyVim/LazyVim/issues/1305) rust debugging not working on windows due to missing liblldb path ([#1390](https://github.com/LazyVim/LazyVim/issues/1390)) ([6045a52](https://github.com/LazyVim/LazyVim/commit/6045a52d82ba4b0dcd0b050688302a22c2fc3991)) +* **autocmds:** restore tabpage on resize ([#1260](https://github.com/LazyVim/LazyVim/issues/1260)) ([f9dadc1](https://github.com/LazyVim/LazyVim/commit/f9dadc11b39fb0b027473caaab2200b35c9f0c8b)) +* **clangd:** update setup from upstream changes ([#1308](https://github.com/LazyVim/LazyVim/issues/1308)) ([73dc5a5](https://github.com/LazyVim/LazyVim/commit/73dc5a503f1f42fc12869688df1359ffd80da5d1)) +* **java:** don't accumulate on_attach, and make more configurable ([#1388](https://github.com/LazyVim/LazyVim/issues/1388)) ([15022f4](https://github.com/LazyVim/LazyVim/commit/15022f4892726f9899ce5eb3aed7a19df29f62ef)) +* **keymaps:** change `v` mode to `x` mode for `save file` ([#1262](https://github.com/LazyVim/LazyVim/issues/1262)) ([ec0ddd4](https://github.com/LazyVim/LazyVim/commit/ec0ddd481c785833c5caac9c9d22889b9e963883)) +* **keymaps:** remove gw keymap ([23e2b07](https://github.com/LazyVim/LazyVim/commit/23e2b073e6fa75dacaa58dc1fe63392af7f54598)) +* **python:** disable ruff hover correctly ([#1365](https://github.com/LazyVim/LazyVim/issues/1365)) ([451bde5](https://github.com/LazyVim/LazyVim/commit/451bde5b41ec410afbb2b5e75e339a3fc44c5587)) +* **yaml:** yaml validate and enable line folding ([#1251](https://github.com/LazyVim/LazyVim/issues/1251)) ([a62a594](https://github.com/LazyVim/LazyVim/commit/a62a5942deb281b9edce3673e656854805297199)) +* **yaml:** yaml: Fix TypeError undefined length ([#1229](https://github.com/LazyVim/LazyVim/issues/1229)) ([d7ca822](https://github.com/LazyVim/LazyVim/commit/d7ca822d41bc65e31dc1019a64d5d3518c8e2470)) + ## [6.2.0](https://github.com/LazyVim/LazyVim/compare/v6.1.0...v6.2.0) (2023-07-25) From b8d3a1c2cd0255a6c7d026f2b6481dc842d0f0f7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 10:13:00 +0200 Subject: [PATCH 141/513] Revert "fix(yanky): don't override c-p insert mode telescope mapping. Fixes #1007" This reverts commit 8b1e7976a004d7e0cbaec37546d2889ddab48bbb. --- lua/lazyvim/plugins/extras/coding/yanky.lua | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index f0bd966b08..00b675e9f4 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -3,21 +3,10 @@ return { { "gbprod/yanky.nvim", dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } }, - opts = function() - local mapping = require("yanky.telescope.mapping") - local mappings = mapping.get_defaults() - mappings.i[""] = nil - return { - highlight = { timer = 200 }, - ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, - picker = { - telescope = { - use_default_mappings = false, - mappings = mappings, - }, - }, - } - end, + opts = { + highlight = { timer = 250 }, + ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, + }, keys = { -- stylua: ignore { "p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, From a180c3097c7a0386f72d8303ab396707798d5d19 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 26 Sep 2023 08:14:33 +0000 Subject: [PATCH 142/513] 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 613586da95..6c1b70849e 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 04 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 26 ============================================================================== Table of Contents *LazyVim-table-of-contents* From f892ba5cffe8fcac724ad6b801e0824b391fa037 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 10:57:41 +0200 Subject: [PATCH 143/513] fix: always lazy load keymaps. fixes #1485 --- lua/lazyvim/config/init.lua | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 5c5e70dd1f..9b61b32fc6 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -98,22 +98,23 @@ function M.setup(opts) error("Exiting") end - if vim.fn.argc(-1) == 0 then - -- autocmds and keymaps can wait to load - vim.api.nvim_create_autocmd("User", { - group = vim.api.nvim_create_augroup("LazyVim", { clear = true }), - pattern = "VeryLazy", - callback = function() - M.load("autocmds") - M.load("keymaps") - end, - }) - else - -- load them now so they affect the opened buffers + -- autocmds can be loaded lazily when not opening a file + local lazy_autocmds = vim.fn.argc(-1) == 0 + if not lazy_autocmds then M.load("autocmds") - M.load("keymaps") end + vim.api.nvim_create_autocmd("User", { + group = vim.api.nvim_create_augroup("LazyVim", { clear = true }), + pattern = "VeryLazy", + callback = function() + if lazy_autocmds then + M.load("autocmds") + end + M.load("keymaps") + end, + }) + require("lazy.core.util").try(function() if type(M.colorscheme) == "function" then M.colorscheme() From afdcec5b4adccd94ff64774340a3ffd33a9d4ecf Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 10:58:35 +0200 Subject: [PATCH 144/513] feat(extras): added simple csharp extra --- lua/lazyvim/plugins/extras/lang/omnisharp.lua | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/omnisharp.lua diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua new file mode 100644 index 0000000000..5e17c0c990 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -0,0 +1,51 @@ +return { + { "Hoffs/omnisharp-extended-lsp.nvim", lazy = true }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "c_sharp" }) + end + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + table.insert(opts.sources, nls.builtins.formatting.csharpier) + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + table.insert(opts.ensure_installed, "csharpier") + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + omnisharp = { + handlers = { + ["textDocument/definition"] = function(...) + return require("omnisharp_extended").handler(...) + end, + }, + keys = { + { + "gd", + function() + require("omnisharp_extended").telescope_lsp_definitions() + end, + desc = "Goto Definition", + }, + }, + enable_roslyn_analyzers = true, + organize_imports_on_format = true, + enable_import_completion = true, + }, + }, + }, + }, +} From 0bff29c07a0d5fb4ef36ba4add2b9c4ee243f8a9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 13:24:03 +0200 Subject: [PATCH 145/513] fix: disable context commentstring autocmd --- lua/lazyvim/plugins/coding.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index cbf94e7734..65891244e2 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -137,7 +137,13 @@ return { }, -- comments - { "JoosepAlviste/nvim-ts-context-commentstring", lazy = true }, + { + "JoosepAlviste/nvim-ts-context-commentstring", + lazy = true, + opts = { + enable_autocmd = false, + }, + }, { "echasnovski/mini.comment", event = "VeryLazy", From e54d0dde623c206c4f7ed9a512785c9fc0de3a22 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 13:27:18 +0200 Subject: [PATCH 146/513] feat(autocmds): close InspectTree window with q --- lua/lazyvim/config/autocmds.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index c8a513f5a8..a3ba5c9138 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -55,6 +55,7 @@ vim.api.nvim_create_autocmd("FileType", { "man", "notify", "qf", + "query", "spectre_panel", "startuptime", "tsplayground", From a7f971f30ec89473482db4ab820d2afb25fa6abf Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Tue, 26 Sep 2023 05:34:28 -0600 Subject: [PATCH 147/513] feat(mini-pairs): add toggle mini pairs keymap and function (#1456) --- lua/lazyvim/plugins/coding.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 65891244e2..87172e1d07 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -97,6 +97,21 @@ return { "echasnovski/mini.pairs", event = "VeryLazy", opts = {}, + keys = { + { + "up", + function() + local Util = require("lazy.core.util") + vim.g.minipairs_disable = not vim.g.minipairs_disable + if vim.g.minipairs_disable then + Util.warn("Disabled auto pairs", { title = "Option" }) + else + Util.info("Enabled auto pairs", { title = "Option" }) + end + end, + desc = "Toggle auto pairs", + }, + }, }, -- Fast and feature-rich surround actions. For text that includes From ea930e35457df4a367b537c472af8d5c6e8ae7eb Mon Sep 17 00:00:00 2001 From: Hai Ninh Hoang <34930708+haininhhoang94@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:35:27 +0700 Subject: [PATCH 148/513] fix(python): use venv for DAP Python (#1457) dap_enabled = true, -- Ensure that the venv selector affect PythonPath in nvim-dap as well! (in venv-selector.nvim) --- lua/lazyvim/plugins/extras/lang/python.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index e64decd1e2..4530bd97a5 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -68,6 +68,7 @@ return { "env", ".env", }, + dap_enabled = true, -- Ensure that the venv selector affect PythonPath in nvim-dap as well! }, keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv" } }, }, From 5dc4ce3e4a452438838c271330df156fd3640c60 Mon Sep 17 00:00:00 2001 From: aqav <66734646+aqav@users.noreply.github.com> Date: Tue, 26 Sep 2023 19:36:22 +0800 Subject: [PATCH 149/513] feat(java): support vscode launch json in Java (#1422) * feat(java): support vscode launch json * feat(java): support vscode launch json --- lua/lazyvim/plugins/extras/lang/java.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 64808bee7c..11aa2a1c97 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -199,6 +199,8 @@ return { -- custom init for Java debugger require("jdtls").setup_dap(opts.dap) require("jdtls.dap").setup_dap_main_class_configs() + -- setup dap config by VsCode launch.json file + require("dap.ext.vscode").load_launchjs() -- Java Test require Java debugger to work if opts.test and mason_registry.is_installed("java-test") then From f1af34e88525cc291b7bacc76d915b642aef192b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 13:38:48 +0200 Subject: [PATCH 150/513] fix(dap): move launchjs code from java to dap --- lua/lazyvim/plugins/extras/dap/core.lua | 2 ++ lua/lazyvim/plugins/extras/lang/java.lua | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index e228afac07..d537e57559 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -13,6 +13,8 @@ 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) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 11aa2a1c97..64808bee7c 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -199,8 +199,6 @@ return { -- custom init for Java debugger require("jdtls").setup_dap(opts.dap) require("jdtls.dap").setup_dap_main_class_configs() - -- setup dap config by VsCode launch.json file - require("dap.ext.vscode").load_launchjs() -- Java Test require Java debugger to work if opts.test and mason_registry.is_installed("java-test") then From 7c79cfe07314245decd73ec67e7247bba22abaa9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 26 Sep 2023 14:16:22 +0200 Subject: [PATCH 151/513] fix(mini.comment): better lua pattern for tags. Fixes #1413 --- lua/lazyvim/plugins/coding.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 87172e1d07..7250638d4e 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -191,6 +191,7 @@ return { }, {}), 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][^<>]->.-", "^<.->().*()$" }, }, } end, From 50401d358b7be9b931b42fc3b537794920308bef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:59:08 +0200 Subject: [PATCH 152/513] chore(main): release 6.4.0 (#1495) 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 b553d773c4..374f3ed53e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [6.4.0](https://github.com/LazyVim/LazyVim/compare/v6.3.0...v6.4.0) (2023-09-26) + + +### Features + +* **autocmds:** close InspectTree window with q ([e54d0dd](https://github.com/LazyVim/LazyVim/commit/e54d0dde623c206c4f7ed9a512785c9fc0de3a22)) +* **extras:** added simple csharp extra ([afdcec5](https://github.com/LazyVim/LazyVim/commit/afdcec5b4adccd94ff64774340a3ffd33a9d4ecf)) +* **java:** support vscode launch json in Java ([#1422](https://github.com/LazyVim/LazyVim/issues/1422)) ([5dc4ce3](https://github.com/LazyVim/LazyVim/commit/5dc4ce3e4a452438838c271330df156fd3640c60)) +* **mini-pairs:** add toggle mini pairs keymap and function ([#1456](https://github.com/LazyVim/LazyVim/issues/1456)) ([a7f971f](https://github.com/LazyVim/LazyVim/commit/a7f971f30ec89473482db4ab820d2afb25fa6abf)) + + +### Bug Fixes + +* always lazy load keymaps. fixes [#1485](https://github.com/LazyVim/LazyVim/issues/1485) ([f892ba5](https://github.com/LazyVim/LazyVim/commit/f892ba5cffe8fcac724ad6b801e0824b391fa037)) +* **dap:** move launchjs code from java to dap ([f1af34e](https://github.com/LazyVim/LazyVim/commit/f1af34e88525cc291b7bacc76d915b642aef192b)) +* disable context commentstring autocmd ([0bff29c](https://github.com/LazyVim/LazyVim/commit/0bff29c07a0d5fb4ef36ba4add2b9c4ee243f8a9)) +* **mini.comment:** better lua pattern for tags. Fixes [#1413](https://github.com/LazyVim/LazyVim/issues/1413) ([7c79cfe](https://github.com/LazyVim/LazyVim/commit/7c79cfe07314245decd73ec67e7247bba22abaa9)) +* **python:** use venv for DAP Python ([#1457](https://github.com/LazyVim/LazyVim/issues/1457)) ([ea930e3](https://github.com/LazyVim/LazyVim/commit/ea930e35457df4a367b537c472af8d5c6e8ae7eb)) + ## [6.3.0](https://github.com/LazyVim/LazyVim/compare/v6.2.0...v6.3.0) (2023-09-04) From 36d6a7fe4f4e7d5c9ffceca0496655a889df2ebc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 27 Sep 2023 13:56:23 +0200 Subject: [PATCH 153/513] fix(dap): revert loading vscode launch files. Add it to your own config when needed. Fixes #1503 --- lua/lazyvim/plugins/extras/dap/core.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index d537e57559..3b623df535 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -14,7 +14,7 @@ return { opts = {}, config = function(_, opts) -- setup dap config by VsCode launch.json file - require("dap.ext.vscode").load_launchjs() + -- require("dap.ext.vscode").load_launchjs() local dap = require("dap") local dapui = require("dapui") dapui.setup(opts) From b30ff44af5645aa28b3812866f6e9e5738c10d62 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 Sep 2023 11:57:42 +0000 Subject: [PATCH 154/513] 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 6c1b70849e..baad8467e1 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 26 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 27 ============================================================================== Table of Contents *LazyVim-table-of-contents* From a1ab7c6e32c67b66ed2f318b5e971ebaab3999b0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:48:32 +0200 Subject: [PATCH 155/513] chore(main): release 6.4.1 (#1505) 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 374f3ed53e..69467336f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [6.4.1](https://github.com/LazyVim/LazyVim/compare/v6.4.0...v6.4.1) (2023-09-27) + + +### Bug Fixes + +* **dap:** revert loading vscode launch files. Add it to your own config when needed. Fixes [#1503](https://github.com/LazyVim/LazyVim/issues/1503) ([36d6a7f](https://github.com/LazyVim/LazyVim/commit/36d6a7fe4f4e7d5c9ffceca0496655a889df2ebc)) + ## [6.4.0](https://github.com/LazyVim/LazyVim/compare/v6.3.0...v6.4.0) (2023-09-26) From db86635e3276451f795da4f8af64eff94391fe48 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 07:40:58 +0200 Subject: [PATCH 156/513] fix(indent-blankline): upgrade ibl config to v3 --- lua/lazyvim/plugins/ui.lua | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 3976c97419..3f69841560 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -168,23 +168,27 @@ return { "lukas-reineke/indent-blankline.nvim", event = { "BufReadPost", "BufNewFile" }, opts = { - -- char = "▏", - char = "│", - filetype_exclude = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", + indent = { + char = "│", + highlight = "IndentBlanklineChar", + }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, }, - show_trailing_blankline_indent = false, - show_current_context = false, }, + main = "ibl", }, -- Active indent guide and indent text objects. When you're browsing From ee068d8399cad2231d2195c31aee368a303a4d11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Sep 2023 05:41:46 +0000 Subject: [PATCH 157/513] 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 baad8467e1..fbacd536f1 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 27 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 28 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b25559d3977d51cfb444639d9999fd69a5ba40d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 07:46:31 +0200 Subject: [PATCH 158/513] chore(main): release 6.4.2 (#1510) 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 69467336f4..3238f9c1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [6.4.2](https://github.com/LazyVim/LazyVim/compare/v6.4.1...v6.4.2) (2023-09-28) + + +### Bug Fixes + +* **indent-blankline:** upgrade ibl config to v3 ([db86635](https://github.com/LazyVim/LazyVim/commit/db86635e3276451f795da4f8af64eff94391fe48)) + ## [6.4.1](https://github.com/LazyVim/LazyVim/compare/v6.4.0...v6.4.1) (2023-09-27) From b220e541594a0ef556d1515649cd99d45fe94058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20B=C3=BCsch?= Date: Thu, 28 Sep 2023 16:41:55 +1000 Subject: [PATCH 159/513] fix(telescope): add enums and consts to search symbols (#1512) --- lua/lazyvim/plugins/editor.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index d073dc58a6..e726768ab2 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -138,6 +138,8 @@ return { "Trait", "Field", "Property", + "Enum", + "Constant", }, }), desc = "Goto Symbol", @@ -156,6 +158,8 @@ return { "Trait", "Field", "Property", + "Enum", + "Constant", }, }), desc = "Goto Symbol (Workspace)", From 7f5051ef72cfe66eb50ddb7c973714aa8aea04ec Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 09:00:31 +0200 Subject: [PATCH 160/513] fix(yamlls): work-around for yaml formatting on Neovim < 0.10. Fixes #1435 --- lua/lazyvim/plugins/extras/lang/yaml.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index ca808bbfa5..0a174aa263 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -54,6 +54,18 @@ return { }, }, }, + setup = { + yamlls = function() + -- Neovim < 0.10 does not have dynamic registration for formatting + if vim.fn.has("nvim-0.10") == 0 then + require("lazyvim.util").on_attach(function(client, _) + if client.name == "yamlls" then + client.server_capabilities.documentFormattingProvider = true + end + end) + end + end, + }, }, }, } From 74786c21d743db0fabed61b90bf7ecaab16bbf14 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 10:54:30 +0200 Subject: [PATCH 161/513] fix(ibl): use default hl groups --- lua/lazyvim/plugins/ui.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 3f69841560..cdc38c0a37 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -168,10 +168,7 @@ return { "lukas-reineke/indent-blankline.nvim", event = { "BufReadPost", "BufNewFile" }, opts = { - indent = { - char = "│", - highlight = "IndentBlanklineChar", - }, + indent = { char = "│" }, scope = { enabled = false }, exclude = { filetypes = { From 13bf7977a4bae39a38ef6a3fad6303366c8b4bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Thu, 28 Sep 2023 02:08:43 -0700 Subject: [PATCH 162/513] fix(telescope): replace anonymous functions in mappings by named functions (#1294) --- lua/lazyvim/plugins/editor.lua | 79 +++++++++++++++++----------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index e726768ab2..22b67c9037 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -165,48 +165,47 @@ return { desc = "Goto Symbol (Workspace)", }, }, - opts = { - defaults = { - prompt_prefix = " ", - selection_caret = " ", - mappings = { - i = { - [""] = function(...) - return require("trouble.providers.telescope").open_with_trouble(...) - end, - [""] = function(...) - return require("trouble.providers.telescope").open_selected_with_trouble(...) - end, - [""] = function() - local action_state = require("telescope.actions.state") - local line = action_state.get_current_line() - Util.telescope("find_files", { no_ignore = true, default_text = line })() - end, - [""] = function() - local action_state = require("telescope.actions.state") - local line = action_state.get_current_line() - Util.telescope("find_files", { hidden = true, default_text = line })() - end, - [""] = function(...) - return require("telescope.actions").cycle_history_next(...) - end, - [""] = function(...) - return require("telescope.actions").cycle_history_prev(...) - end, - [""] = function(...) - return require("telescope.actions").preview_scrolling_down(...) - end, - [""] = function(...) - return require("telescope.actions").preview_scrolling_up(...) - end, - }, - n = { - ["q"] = function(...) - return require("telescope.actions").close(...) - end, + opts = function() + local actions = require("telescope.actions") + + local open_with_trouble = function(...) + return require("trouble.providers.telescope").open_with_trouble(...) + end + local open_selected_with_trouble = function(...) + return require("trouble.providers.telescope").open_selected_with_trouble(...) + end + local find_files_no_ignore = function() + local action_state = require("telescope.actions.state") + local line = action_state.get_current_line() + Util.telescope("find_files", { no_ignore = true, default_text = line })() + end + local find_files_with_hidden = function() + local action_state = require("telescope.actions.state") + local line = action_state.get_current_line() + Util.telescope("find_files", { hidden = true, default_text = line })() + end + + return { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + mappings = { + i = { + [""] = open_with_trouble, + [""] = open_selected_with_trouble, + [""] = find_files_no_ignore, + [""] = find_files_with_hidden, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + }, + n = { + ["q"] = actions.close, + }, }, }, - }, + } }, }, From 017582c05a2d87c73cfe794dd2e296cc0caf86cd Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 11:10:25 +0200 Subject: [PATCH 163/513] fix(telescope): typo --- lua/lazyvim/plugins/editor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 22b67c9037..382626f217 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -206,7 +206,7 @@ return { }, }, } - }, + end, }, -- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins From d03f708cd3411d6e6dcb20b345b23a03222b0f35 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 11:22:19 +0200 Subject: [PATCH 164/513] chore: removed flash extra since this is now the default --- lua/lazyvim/plugins/extras/editor/flash.lua | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/editor/flash.lua diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua deleted file mode 100644 index d60c23875a..0000000000 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("lazy.core.util").warn( - "`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.", - { title = "LazyVim" } -) - -return {} From d012a1acb8fe0a7d11868c39e0fae610e4b58e4e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 11:24:20 +0200 Subject: [PATCH 165/513] docs(telescope): documented Telescope find files. Fixes #1425 --- lua/lazyvim/plugins/editor.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 382626f217..1b4f755809 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -82,7 +82,10 @@ return { }, }, - -- fuzzy finder + -- Fuzzy finder. + -- The default key bindings to find files will use Telescope's + -- `find_files` or `git_files` depending on whether the + -- directory is a git repo. { "nvim-telescope/telescope.nvim", commit = vim.fn.has("nvim-0.9.0") == 0 and "057ee0f8783" or nil, From fa6cbfc6020efcd2168ffe09a209037599b91442 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 11:33:45 +0200 Subject: [PATCH 166/513] fix(lsp): don't install jsonls by default. It's part of the json extra --- lua/lazyvim/plugins/lsp/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 8c5dc71a89..08b9f4b373 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -54,7 +54,6 @@ return { -- LSP Server Settings ---@type lspconfig.options servers = { - jsonls = {}, lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason -- Use this to add any additional keymaps @@ -123,7 +122,7 @@ return { if opts.inlay_hints.enabled and inlay_hint then Util.on_attach(function(client, buffer) - if client.supports_method('textDocument/inlayHint') then + if client.supports_method("textDocument/inlayHint") then inlay_hint(buffer, true) end end) From a3011daf403e985498320b930872b06065f693a3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 28 Sep 2023 11:36:58 +0200 Subject: [PATCH 167/513] style: better plugin docs --- lua/lazyvim/plugins/ui.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index cdc38c0a37..c66c5a4f32 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -221,7 +221,7 @@ return { end, }, - -- noicer ui + -- Displays a popup with possible key bindings of the command you started typing { "folke/which-key.nvim", opts = function(_, opts) @@ -230,6 +230,8 @@ return { end end, }, + + -- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu. { "folke/noice.nvim", event = "VeryLazy", From 274649e92321d615888f889476c9329f8d831e8e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 12:04:36 +0200 Subject: [PATCH 168/513] chore(main): release 6.4.3 (#1514) 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 3238f9c1ee..392ba8fcb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [6.4.3](https://github.com/LazyVim/LazyVim/compare/v6.4.2...v6.4.3) (2023-09-28) + + +### Bug Fixes + +* **ibl:** use default hl groups ([74786c2](https://github.com/LazyVim/LazyVim/commit/74786c21d743db0fabed61b90bf7ecaab16bbf14)) +* **lsp:** don't install jsonls by default. It's part of the json extra ([fa6cbfc](https://github.com/LazyVim/LazyVim/commit/fa6cbfc6020efcd2168ffe09a209037599b91442)) +* **telescope:** add enums and consts to search symbols ([#1512](https://github.com/LazyVim/LazyVim/issues/1512)) ([b220e54](https://github.com/LazyVim/LazyVim/commit/b220e541594a0ef556d1515649cd99d45fe94058)) +* **telescope:** replace anonymous functions in mappings by named functions ([#1294](https://github.com/LazyVim/LazyVim/issues/1294)) ([13bf797](https://github.com/LazyVim/LazyVim/commit/13bf7977a4bae39a38ef6a3fad6303366c8b4bea)) +* **telescope:** typo ([017582c](https://github.com/LazyVim/LazyVim/commit/017582c05a2d87c73cfe794dd2e296cc0caf86cd)) +* **yamlls:** work-around for yaml formatting on Neovim < 0.10. Fixes [#1435](https://github.com/LazyVim/LazyVim/issues/1435) ([7f5051e](https://github.com/LazyVim/LazyVim/commit/7f5051ef72cfe66eb50ddb7c973714aa8aea04ec)) + ## [6.4.2](https://github.com/LazyVim/LazyVim/compare/v6.4.1...v6.4.2) (2023-09-28) From 7cac6f064c5b30f6b0ae4dffab62100aa6fe2568 Mon Sep 17 00:00:00 2001 From: Ahmed W Date: Fri, 29 Sep 2023 04:52:45 -0500 Subject: [PATCH 169/513] feat(null-ls)!: use none-ls instead of null-ls (#1517) * FEATURE: use none-ls instead of null-ls Fixes #1516 * fix(none-ls): automatically migrate null-ls to none-ls * feat(config): show warning if user config contains renamed references --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/config/init.lua | 10 ++++++++++ lua/lazyvim/plugins/extras/formatting/prettier.lua | 2 +- lua/lazyvim/plugins/extras/lang/cmake.lua | 2 +- lua/lazyvim/plugins/extras/lang/docker.lua | 2 +- lua/lazyvim/plugins/extras/lang/go.lua | 2 +- lua/lazyvim/plugins/extras/lang/omnisharp.lua | 2 +- lua/lazyvim/plugins/extras/lang/terraform.lua | 2 +- lua/lazyvim/plugins/extras/lang/typescript.lua | 2 +- lua/lazyvim/plugins/lsp/init.lua | 2 +- 9 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 9b61b32fc6..5e1d5bf20f 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -79,6 +79,8 @@ local defaults = { M.renames = { ["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre", + ["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim", + ["null-ls.nvim"] = "none-ls.nvim", } ---@type LazyVimConfig @@ -181,6 +183,14 @@ function M.init() local add = Plugin.Spec.add Plugin.Spec.add = function(self, plugin, ...) if type(plugin) == "table" and M.renames[plugin[1]] then + require("lazy.core.util").warn( + ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( + plugin[1], + M.renames[plugin[1]], + self.importing or "LazyVim" + ), + { title = "LazyVim" } + ) plugin[1] = M.renames[plugin[1]] end return add(self, plugin, ...) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index e16b980562..359de5a727 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -6,7 +6,7 @@ return { end, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) local nls = require("null-ls") table.insert(opts.sources, nls.builtins.formatting.prettierd) diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 9d82c71bb6..73569db6ac 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -8,7 +8,7 @@ return { end, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index 5cadf86499..26a39ac9ee 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -8,7 +8,7 @@ return { end, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index a78a7434b7..252e2ccafc 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -83,7 +83,7 @@ return { }, -- Ensure Go tools are installed { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) if type(opts.sources) == "table" then local nls = require("null-ls") diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index 5e17c0c990..f0ab8317af 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -9,7 +9,7 @@ return { end, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) local nls = require("null-ls") table.insert(opts.sources, nls.builtins.formatting.csharpier) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 441887fadd..79748567fe 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -25,7 +25,7 @@ return { }, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) if type(opts.sources) == "table" then local null_ls = require("null-ls") diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 32f4079ec9..9734749e31 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -53,7 +53,7 @@ return { }, }, { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, opts) table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions")) end, diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 08b9f4b373..d69ec824b2 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -205,7 +205,7 @@ return { -- formatters { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", event = { "BufReadPre", "BufNewFile" }, dependencies = { "mason.nvim" }, opts = function() From 3c448a1be1d88711309026393f30da3a4de68235 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 29 Sep 2023 09:53:29 +0000 Subject: [PATCH 170/513] 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 fbacd536f1..cc9daf2bc9 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 28 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 29 ============================================================================== Table of Contents *LazyVim-table-of-contents* From a7f68e5e378f1431fc334036f29826f601e861ac Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 11:59:05 +0200 Subject: [PATCH 171/513] refactor(none-ls): make all null-ls usages in extras optional --- lua/lazyvim/plugins/extras/formatting/prettier.lua | 1 + lua/lazyvim/plugins/extras/lang/cmake.lua | 1 + lua/lazyvim/plugins/extras/lang/docker.lua | 1 + lua/lazyvim/plugins/extras/lang/go.lua | 1 + lua/lazyvim/plugins/extras/lang/omnisharp.lua | 1 + lua/lazyvim/plugins/extras/lang/terraform.lua | 1 + lua/lazyvim/plugins/extras/lang/typescript.lua | 1 + 7 files changed, 7 insertions(+) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 359de5a727..3e4d461f08 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -7,6 +7,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) local nls = require("null-ls") table.insert(opts.sources, nls.builtins.formatting.prettierd) diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 73569db6ac..30d7718cc5 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -9,6 +9,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index 26a39ac9ee..6d85c8d739 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -9,6 +9,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 252e2ccafc..c2946adbca 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -84,6 +84,7 @@ return { -- Ensure Go tools are installed { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) if type(opts.sources) == "table" then local nls = require("null-ls") diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index f0ab8317af..14f9e34d7b 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -10,6 +10,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) local nls = require("null-ls") table.insert(opts.sources, nls.builtins.formatting.csharpier) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 79748567fe..182c9f52b9 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -26,6 +26,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) if type(opts.sources) == "table" then local null_ls = require("null-ls") diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 9734749e31..5e3171e452 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -54,6 +54,7 @@ return { }, { "nvimtools/none-ls.nvim", + optional = true, opts = function(_, opts) table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions")) end, From 6b05ed7dcd729322e2e5b6752655a9491cd17f86 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 12:00:45 +0200 Subject: [PATCH 172/513] fix: remove deprecated leap/flit code checks --- lua/lazyvim/plugins/editor.lua | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 1b4f755809..3059dc84dc 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -212,30 +212,6 @@ return { end, }, - -- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins - { - "ggandor/leap.nvim", - enabled = function() - vim.schedule(function() - local Config = require("lazy.core.config") - if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then - require("lazy.core.util").warn( - [[`flash.nvim` is now the default **LazyVim** jump plugin. -**leap.nvim** and **flit.nvim** have been disabled. -Please remove the plugins from your config. -If you rather use leap/flit instead, you can add the leap extra: -`lazyvim.plugins.extras.editor.leap` -]], - { title = "LazyVim" } - ) - end - end) - return false - end, - optional = true, - }, - { "ggandor/flit.nvim", enabled = false, optional = true }, - -- Flash enhances the built-in search functionality by showing labels -- at the end of each match, letting you quickly jump to a specific -- location. From f61a243d1aca582963aca3f2c2c7c2ae0be16b06 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 13:37:00 +0200 Subject: [PATCH 173/513] feat(extras): added `conform.nvim` extra you can use instead of null-ls/none-ls --- .../plugins/extras/formatting/conform.lua | 47 +++++++++++++++++++ .../plugins/extras/formatting/prettier.lua | 24 ++++++++++ lua/lazyvim/plugins/extras/lang/go.lua | 9 ++++ lua/lazyvim/plugins/extras/lang/omnisharp.lua | 15 ++++++ lua/lazyvim/plugins/extras/lang/terraform.lua | 11 +++++ lua/lazyvim/plugins/lsp/format.lua | 9 ++++ 6 files changed, 115 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/formatting/conform.lua diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua new file mode 100644 index 0000000000..9858c08e86 --- /dev/null +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -0,0 +1,47 @@ +-- When `conform.nvim` is enabled, it will automatically be used as the +-- formatter for all files that it supports. +-- When no conform formatter is available for a filetype, LSP format +-- will be used instead. +-- +-- LazyVim adds a custom `formatter_opts` option to allow overriding the +-- default options for each formatter. +return { + { + "stevearc/conform.nvim", + dependencies = { "mason.nvim" }, + lazy = true, + cmd = "ConformInfo", + init = function() + -- Install the conform formatter on VeryLazy + require("lazyvim.util").on_very_lazy(function() + require("lazyvim.plugins.lsp.format").custom_format = function(buf) + return require("conform").format({ bufnr = buf }) + end + end) + end, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + fish = { "fish_indent" }, + sh = { "shfmt" }, + }, + -- LazyVim extension to easily override formatter options + ---@type table + formatter_opts = { + -- -- Example of using dprint only when a dprint.json file is present + -- dprint = { + -- condition = function(ctx) + -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + }, + }, + config = function(_, opts) + opts.formatters = opts.formatters or {} + for f, o in pairs(opts.formatter_opts or {}) do + opts.formatters[f] = vim.tbl_deep_extend("force", require("conform.formatters." .. f), o) + end + require("conform").setup(opts) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 3e4d461f08..81fc1939d8 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -13,4 +13,28 @@ return { table.insert(opts.sources, nls.builtins.formatting.prettierd) end, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ["javascript"] = { { "prettierd", "prettier" } }, + ["javascriptreact"] = { { "prettierd", "prettier" } }, + ["typescript"] = { { "prettierd", "prettier" } }, + ["typescriptreact"] = { { "prettierd", "prettier" } }, + ["vue"] = { { "prettierd", "prettier" } }, + ["css"] = { { "prettierd", "prettier" } }, + ["scss"] = { { "prettierd", "prettier" } }, + ["less"] = { { "prettierd", "prettier" } }, + ["html"] = { { "prettierd", "prettier" } }, + ["json"] = { { "prettierd", "prettier" } }, + ["jsonc"] = { { "prettierd", "prettier" } }, + ["yaml"] = { { "prettierd", "prettier" } }, + ["markdown"] = { { "prettierd", "prettier" } }, + ["markdown.mdx"] = { { "prettierd", "prettier" } }, + ["graphql"] = { { "prettierd", "prettier" } }, + ["handlebars"] = { { "prettierd", "prettier" } }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index c2946adbca..0b0cab7052 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -97,6 +97,15 @@ return { end end, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + go = { "goimports", "gofumpt" }, + }, + }, + }, { "mfussenegger/nvim-dap", optional = true, diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index 14f9e34d7b..d244fd77f6 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -16,6 +16,21 @@ return { table.insert(opts.sources, nls.builtins.formatting.csharpier) end, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + cs = { "csharpier" }, + }, + formatters = { + csharpier = { + command = "dotnet-csharpier", + args = { "--write-stdout" }, + }, + }, + }, + }, { "williamboman/mason.nvim", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 182c9f52b9..cb3aeaa2a1 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -37,4 +37,15 @@ return { end end, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + terraform = { "terraform_fmt" }, + tf = { "terraform_fmt" }, + ["terraform-vars"] = { "terraform_fmt" }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 64c4becfa1..f862a8a763 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -5,6 +5,11 @@ local M = {} ---@type PluginLspOpts M.opts = nil +-- Allow plugins to set a custom formatter for a buffer. +-- See the conform extra for an example. +---@type fun(bufnr:number):boolean +M.custom_format = nil + function M.enabled() return M.opts.autoformat end @@ -30,6 +35,10 @@ function M.format(opts) return end + if M.custom_format and M.custom_format(buf) then + return + end + local formatters = M.get_formatters(buf) local client_ids = vim.tbl_map(function(client) return client.id From aab365a9f8b6405c6c5a938cb4745e9b770f2261 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 13:57:04 +0200 Subject: [PATCH 174/513] fix(typescript)!: removed `typescript.nvim` since it's deprecated --- .../plugins/extras/lang/typescript.lua | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 5e3171e452..44a963ecb4 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -13,15 +13,25 @@ return { -- correctly setup lspconfig { "neovim/nvim-lspconfig", - dependencies = { "jose-elias-alvarez/typescript.nvim" }, opts = { -- make sure mason installs the server servers = { ---@type lspconfig.options.tsserver tsserver = { keys = { - { "co", "TypescriptOrganizeImports", desc = "Organize Imports" }, - { "cR", "TypescriptRenameFile", desc = "Rename File" }, + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports.ts" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, }, settings = { typescript = { @@ -44,21 +54,8 @@ return { }, }, }, - setup = { - tsserver = function(_, opts) - require("typescript").setup({ server = opts }) - return true - end, - }, }, }, - { - "nvimtools/none-ls.nvim", - optional = true, - opts = function(_, opts) - table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions")) - end, - }, { "mfussenegger/nvim-dap", optional = true, From 9762e7e43110013a0931b8470be2929b54b4b641 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 14:14:57 +0200 Subject: [PATCH 175/513] feat(neo-tree): added support for LSP renaming to NeoTree --- lua/lazyvim/plugins/editor.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 3059dc84dc..8465ca8914 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -59,6 +59,27 @@ return { }, }, config = function(_, opts) + opts.event_handlers = opts.event_handlers or {} + + local function on_move(data) + local clients = vim.lsp.get_active_clients() + for _, client in ipairs(clients) do + if client:supports_method("workspace/willRenameFiles") then + local resp = client.request_sync("workspace/willRenameFiles", { + files = { { oldUri = vim.uri_from_fname(data.source), newUri = vim.uri_from_fname(data.destination) } }, + }, 1000) + if resp and resp.result ~= nil then + vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) + end + end + end + end + + local events = require("neo-tree.events") + vim.list_extend(opts.event_handlers, { + { event = events.FILE_MOVED, handler = on_move }, + { event = events.FILE_RENAMED, handler = on_move }, + }) require("neo-tree").setup(opts) vim.api.nvim_create_autocmd("TermClose", { pattern = "*lazygit", From 05f45bb7200a6fd33ab7366553b957fa222e2cdf Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:05:01 +0200 Subject: [PATCH 176/513] feat(extras): added extra for nvim-lint --- lua/lazyvim/plugins/extras/lang/cmake.lua | 9 +++ lua/lazyvim/plugins/extras/lang/docker.lua | 9 +++ lua/lazyvim/plugins/extras/lang/terraform.lua | 10 +++ .../plugins/extras/linting/nvim-lint.lua | 65 +++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/linting/nvim-lint.lua diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 30d7718cc5..cd802edf04 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -18,6 +18,15 @@ return { }) end, }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + cmake = { "cmakelint" }, + }, + }, + }, { "mason.nvim", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index 6d85c8d739..d3e06ecb12 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -25,6 +25,15 @@ return { end, }, }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + dockerfile = { "hadolint" }, + }, + }, + }, { "neovim/nvim-lspconfig", opts = { diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index cb3aeaa2a1..6e368ff31b 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -37,6 +37,16 @@ return { end end, }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + terraform = { "terraform_validate" }, + tf = { "terraform_validate" }, + }, + }, + }, { "stevearc/conform.nvim", optional = true, diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua new file mode 100644 index 0000000000..c6c9629ad4 --- /dev/null +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -0,0 +1,65 @@ +return { + { + "mfussenegger/nvim-lint", + event = "BufReadPost", + opts = { + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + fish = { "fish" }, + }, + linters = {}, + linter_opts = {}, + }, + config = function(_, opts) + local M = {} + M._did_setup = false + + function M.setup() + if M._did_setup then + return + end + local lint = require("lint") + for name, linter in pairs(opts.linters) do + lint.linters[name] = linter + end + lint.linters_by_ft = vim.tbl_extend("force", lint.linters_by_ft, opts.linters_by_ft) + for l, o in pairs(opts.linter_opts or {}) do + lint.linters[l] = vim.tbl_deep_extend("force", lint.linters[l], o) + end + M._did_setup = true + end + + function M.debounce(ms, fn) + local timer = vim.loop.new_timer() + return function(...) + local argv = { ... } + timer:start(ms, 0, function() + timer:stop() + vim.schedule_wrap(fn)(unpack(argv)) + end) + end + end + + function M.lint() + M.setup() + local lint = require("lint") + local names = lint.linters_by_ft[vim.bo.filetype] or {} + local ctx = { filename = vim.api.nvim_buf_get_name(0) } + ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") + names = vim.tbl_filter(function(name) + local linter = lint.linters[name] + return linter and not (linter.condition and not linter.condition(ctx)) + end, names) + + if #names > 0 then + lint.try_lint(names) + end + end + + vim.api.nvim_create_autocmd(opts.events, { + group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }), + callback = M.debounce(100, M.lint), + }) + end, + }, +} From 0f7a009d1cdd9e4449e45d4d40cde3e3813eb794 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:07:29 +0200 Subject: [PATCH 177/513] docs: added more docs to nvim-lint extensions --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index c6c9629ad4..46a005743c 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -3,12 +3,25 @@ return { "mfussenegger/nvim-lint", event = "BufReadPost", opts = { + -- Event to trigger linters events = { "BufWritePost", "BufReadPost", "InsertLeave" }, linters_by_ft = { fish = { "fish" }, }, + -- Custom linters, or fully replace a builtin linters = {}, - linter_opts = {}, + -- LazyVim extension to easily override linter options + ---@type table + linter_opts = { + -- -- Example of using selene only when a selene.toml file is present + selene = { + -- `condition` is another LazyVim extension that allows you to + -- dynamically enable/disable linters based on the context. + condition = function(ctx) + return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] + end, + }, + }, }, config = function(_, opts) local M = {} From 886d49eb89cc96dd8942182d4c3d87b252500831 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:15:38 +0200 Subject: [PATCH 178/513] style: comment the selene example --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index 46a005743c..fd380c12d9 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -14,13 +14,13 @@ return { ---@type table linter_opts = { -- -- Example of using selene only when a selene.toml file is present - selene = { - -- `condition` is another LazyVim extension that allows you to - -- dynamically enable/disable linters based on the context. - condition = function(ctx) - return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] - end, - }, + -- selene = { + -- -- `condition` is another LazyVim extension that allows you to + -- -- dynamically enable/disable linters based on the context. + -- condition = function(ctx) + -- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, }, }, config = function(_, opts) From 0e5ff5c0ab6930190122df086db5e3f91d8b38b8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:55:29 +0200 Subject: [PATCH 179/513] fix(format): wrap custom formatter with error handler --- lua/lazyvim/plugins/lsp/format.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index f862a8a763..6eb78d0d04 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -35,7 +35,9 @@ function M.format(opts) return end - if M.custom_format and M.custom_format(buf) then + if M.custom_format and Util.try(function() + M.custom_format(buf) + end, { msg = "Custom formatter failed" }) then return end From 6bb0d1b66ffe6d0a77ad96d0f945113ddcb9fdb3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:56:20 +0200 Subject: [PATCH 180/513] fix(conform): use `formatters` for both custom and overriding formatters --- .../plugins/extras/formatting/conform.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index 9858c08e86..d89385d77c 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -1,10 +1,3 @@ --- When `conform.nvim` is enabled, it will automatically be used as the --- formatter for all files that it supports. --- When no conform formatter is available for a filetype, LSP format --- will be used instead. --- --- LazyVim adds a custom `formatter_opts` option to allow overriding the --- default options for each formatter. return { { "stevearc/conform.nvim", @@ -25,9 +18,10 @@ return { fish = { "fish_indent" }, sh = { "shfmt" }, }, - -- LazyVim extension to easily override formatter options + -- LazyVim will merge the options you set here with builtin formatters. + -- You can also define any custom formatters here. ---@type table - formatter_opts = { + formatters = { -- -- Example of using dprint only when a dprint.json file is present -- dprint = { -- condition = function(ctx) @@ -38,8 +32,9 @@ return { }, config = function(_, opts) opts.formatters = opts.formatters or {} - for f, o in pairs(opts.formatter_opts or {}) do - opts.formatters[f] = vim.tbl_deep_extend("force", require("conform.formatters." .. f), o) + for f, o in pairs(opts.formatters) do + local ok, formatter = pcall(require, "conform.formatters." .. f) + opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o) end require("conform").setup(opts) end, From 31d913697bc9b731bc941362021ce06617f627d3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 15:58:44 +0200 Subject: [PATCH 181/513] fix(nvim-lint): use `linters` for both custom and overriding linters --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index fd380c12d9..f893395c0e 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -8,11 +8,10 @@ return { linters_by_ft = { fish = { "fish" }, }, - -- Custom linters, or fully replace a builtin - linters = {}, -- LazyVim extension to easily override linter options + -- or add custom linters. ---@type table - linter_opts = { + linters = { -- -- Example of using selene only when a selene.toml file is present -- selene = { -- -- `condition` is another LazyVim extension that allows you to @@ -33,12 +32,9 @@ return { end local lint = require("lint") for name, linter in pairs(opts.linters) do - lint.linters[name] = linter + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter) end lint.linters_by_ft = vim.tbl_extend("force", lint.linters_by_ft, opts.linters_by_ft) - for l, o in pairs(opts.linter_opts or {}) do - lint.linters[l] = vim.tbl_deep_extend("force", lint.linters[l], o) - end M._did_setup = true end From 718c5c6036f2aff6534501e151dd3e5ff13a42fa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 16:09:33 +0200 Subject: [PATCH 182/513] fix(docker): put hadolint in its own spec --- lua/lazyvim/plugins/extras/lang/docker.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index d3e06ecb12..86c7175ba8 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -7,6 +7,13 @@ return { end end, }, + { + "mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "hadolint" }) + end, + }, { "nvimtools/none-ls.nvim", optional = true, @@ -17,13 +24,6 @@ return { nls.builtins.diagnostics.hadolint, }) end, - dependencies = { - "mason.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "hadolint" }) - end, - }, }, { "mfussenegger/nvim-lint", From 300350686f761a87fe531afb8724590555ccf3bf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:14:13 +0200 Subject: [PATCH 183/513] chore(main): release 7.0.0 (#1521) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 392ba8fcb4..af533e12b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [7.0.0](https://github.com/LazyVim/LazyVim/compare/v6.4.3...v7.0.0) (2023-09-29) + + +### ⚠ BREAKING CHANGES + +* **typescript:** removed `typescript.nvim` since it's deprecated +* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517)) + +### Features + +* **extras:** added `conform.nvim` extra you can use instead of null-ls/none-ls ([f61a243](https://github.com/LazyVim/LazyVim/commit/f61a243d1aca582963aca3f2c2c7c2ae0be16b06)) +* **extras:** added extra for nvim-lint ([05f45bb](https://github.com/LazyVim/LazyVim/commit/05f45bb7200a6fd33ab7366553b957fa222e2cdf)) +* **neo-tree:** added support for LSP renaming to NeoTree ([9762e7e](https://github.com/LazyVim/LazyVim/commit/9762e7e43110013a0931b8470be2929b54b4b641)) +* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517)) ([7cac6f0](https://github.com/LazyVim/LazyVim/commit/7cac6f064c5b30f6b0ae4dffab62100aa6fe2568)) + + +### Bug Fixes + +* **conform:** use `formatters` for both custom and overriding formatters ([6bb0d1b](https://github.com/LazyVim/LazyVim/commit/6bb0d1b66ffe6d0a77ad96d0f945113ddcb9fdb3)) +* **docker:** put hadolint in its own spec ([718c5c6](https://github.com/LazyVim/LazyVim/commit/718c5c6036f2aff6534501e151dd3e5ff13a42fa)) +* **format:** wrap custom formatter with error handler ([0e5ff5c](https://github.com/LazyVim/LazyVim/commit/0e5ff5c0ab6930190122df086db5e3f91d8b38b8)) +* **nvim-lint:** use `linters` for both custom and overriding linters ([31d9136](https://github.com/LazyVim/LazyVim/commit/31d913697bc9b731bc941362021ce06617f627d3)) +* remove deprecated leap/flit code checks ([6b05ed7](https://github.com/LazyVim/LazyVim/commit/6b05ed7dcd729322e2e5b6752655a9491cd17f86)) +* **typescript:** removed `typescript.nvim` since it's deprecated ([aab365a](https://github.com/LazyVim/LazyVim/commit/aab365a9f8b6405c6c5a938cb4745e9b770f2261)) + ## [6.4.3](https://github.com/LazyVim/LazyVim/compare/v6.4.2...v6.4.3) (2023-09-28) From ff5f5886db321679e3fdc5dbb82b12daf6075510 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 29 Sep 2023 16:49:55 +0200 Subject: [PATCH 184/513] fix(nvim-lint): dont use default configured linters from nvim-lint --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index f893395c0e..825b257b4e 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -24,19 +24,12 @@ return { }, config = function(_, opts) local M = {} - M._did_setup = false - function M.setup() - if M._did_setup then - return - end - local lint = require("lint") - for name, linter in pairs(opts.linters) do - lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter) - end - lint.linters_by_ft = vim.tbl_extend("force", lint.linters_by_ft, opts.linters_by_ft) - M._did_setup = true + local lint = require("lint") + for name, linter in pairs(opts.linters) do + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter) end + lint.linters_by_ft = opts.linters_by_ft function M.debounce(ms, fn) local timer = vim.loop.new_timer() @@ -50,7 +43,6 @@ return { end function M.lint() - M.setup() local lint = require("lint") local names = lint.linters_by_ft[vim.bo.filetype] or {} local ctx = { filename = vim.api.nvim_buf_get_name(0) } From 6f9adbd4fba4132bd4f12404bd2b90c4a28ff136 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:52:39 +0200 Subject: [PATCH 185/513] chore(main): release 7.0.1 (#1523) 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 af533e12b7..daa2df358f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.0.1](https://github.com/LazyVim/LazyVim/compare/v7.0.0...v7.0.1) (2023-09-29) + + +### Bug Fixes + +* **nvim-lint:** dont use default configured linters from nvim-lint ([ff5f588](https://github.com/LazyVim/LazyVim/commit/ff5f5886db321679e3fdc5dbb82b12daf6075510)) + ## [7.0.0](https://github.com/LazyVim/LazyVim/compare/v6.4.3...v7.0.0) (2023-09-29) From 1c878b9d06fb116135419d098fe5dfde5304b709 Mon Sep 17 00:00:00 2001 From: loqusion Date: Sat, 30 Sep 2023 10:48:19 -0500 Subject: [PATCH 186/513] fix(format): allow `custom_format` to return early (#1531) --- lua/lazyvim/plugins/lsp/format.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 6eb78d0d04..1ec548ae14 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -36,7 +36,7 @@ function M.format(opts) end if M.custom_format and Util.try(function() - M.custom_format(buf) + return M.custom_format(buf) end, { msg = "Custom formatter failed" }) then return end From bd485363353611f961cc73e613f9fac2f0130689 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 30 Sep 2023 15:48:50 +0000 Subject: [PATCH 187/513] 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 cc9daf2bc9..3f17b717af 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 29 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 30 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 7821c0e85199205af98ceedfb2c4990c96900e46 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis Date: Sat, 30 Sep 2023 18:51:47 +0300 Subject: [PATCH 188/513] fix(python): make venv-selector `dap_enabled` conditional on `nvim-dap-python` (#1529) --- lua/lazyvim/plugins/extras/lang/python.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 4530bd97a5..ff4267fbb9 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -61,15 +61,19 @@ return { { "linux-cultist/venv-selector.nvim", cmd = "VenvSelect", - opts = { - name = { - "venv", - ".venv", - "env", - ".env", - }, - dap_enabled = true, -- Ensure that the venv selector affect PythonPath in nvim-dap as well! - }, + opts = function(_, opts) + if require("lazyvim.util").has("nvim-dap-python") then + opts.dap_enabled = true + end + return vim.tbl_deep_extend("force", opts, { + name = { + "venv", + ".venv", + "env", + ".env", + }, + }) + end, keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv" } }, }, } From 5eca3dc3bba081fd1baced79af80da2c60307c8a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 30 Sep 2023 18:08:39 +0200 Subject: [PATCH 189/513] chore(main): release 7.0.2 (#1532) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index daa2df358f..e3f6119b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [7.0.2](https://github.com/LazyVim/LazyVim/compare/v7.0.1...v7.0.2) (2023-09-30) + + +### Bug Fixes + +* **format:** allow `custom_format` to return early ([#1531](https://github.com/LazyVim/LazyVim/issues/1531)) ([1c878b9](https://github.com/LazyVim/LazyVim/commit/1c878b9d06fb116135419d098fe5dfde5304b709)) +* **python:** make venv-selector `dap_enabled` conditional on `nvim-dap-python` ([#1529](https://github.com/LazyVim/LazyVim/issues/1529)) ([7821c0e](https://github.com/LazyVim/LazyVim/commit/7821c0e85199205af98ceedfb2c4990c96900e46)) + ## [7.0.1](https://github.com/LazyVim/LazyVim/compare/v7.0.0...v7.0.1) (2023-09-29) From 0136bfa4b5e0df397efbe2d4e348a521f0986759 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 30 Sep 2023 17:50:41 +0200 Subject: [PATCH 190/513] style: format --- lua/lazyvim/plugins/lsp/format.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 1ec548ae14..72f187461b 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -35,9 +35,12 @@ function M.format(opts) return end - if M.custom_format and Util.try(function() - return M.custom_format(buf) - end, { msg = "Custom formatter failed" }) then + if + M.custom_format + and Util.try(function() + return M.custom_format(buf) + end, { msg = "Custom formatter failed" }) + then return end From 964dd6c4b2135399758c87afed7e1f3c8e30b487 Mon Sep 17 00:00:00 2001 From: Ahmed W Date: Sat, 30 Sep 2023 12:30:52 -0500 Subject: [PATCH 191/513] fix(extras.go): remove unneeded formatters since gopls handles them (#1535) * fix(extras.go): remove unneeded formatters since gopls handles them * add optional back --- lua/lazyvim/plugins/extras/lang/go.lua | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 0b0cab7052..d46a215c8c 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -91,21 +91,10 @@ return { vim.list_extend(opts.sources, { nls.builtins.code_actions.gomodifytags, nls.builtins.code_actions.impl, - nls.builtins.formatting.gofumpt, - nls.builtins.formatting.goimports_reviser, }) end end, }, - { - "stevearc/conform.nvim", - optional = true, - opts = { - formatters_by_ft = { - go = { "goimports", "gofumpt" }, - }, - }, - }, { "mfussenegger/nvim-dap", optional = true, @@ -114,7 +103,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" }) + vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "delve" }) end, }, { From 4a2c89cd1dee9b0c842ea4f9d7509b915db6ba11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 00:29:14 +0200 Subject: [PATCH 192/513] chore(main): release 7.0.3 (#1536) 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 e3f6119b78..3cfa33633b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.0.3](https://github.com/LazyVim/LazyVim/compare/v7.0.2...v7.0.3) (2023-09-30) + + +### Bug Fixes + +* **extras.go:** remove unneeded formatters since gopls handles them ([#1535](https://github.com/LazyVim/LazyVim/issues/1535)) ([964dd6c](https://github.com/LazyVim/LazyVim/commit/964dd6c4b2135399758c87afed7e1f3c8e30b487)) + ## [7.0.2](https://github.com/LazyVim/LazyVim/compare/v7.0.1...v7.0.2) (2023-09-30) From 9bb4e8755f5a822659ca1d8cb3689732435d90d0 Mon Sep 17 00:00:00 2001 From: Mark Tareshawty Date: Sun, 1 Oct 2023 04:21:35 -0400 Subject: [PATCH 193/513] feat: replace Copilot icon with logo (#1539) --- lua/lazyvim/config/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 5e1d5bf20f..ad32353b7e 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -44,7 +44,7 @@ local defaults = { Color = " ", Constant = " ", Constructor = " ", - Copilot = " ", + Copilot = " ", Enum = " ", EnumMember = " ", Event = " ", From f7655a83c504d54ae5169d2fc706498e1c2d6535 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 1 Oct 2023 08:22:12 +0000 Subject: [PATCH 194/513] 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 3f17b717af..13a24ae61c 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 30 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 01 ============================================================================== Table of Contents *LazyVim-table-of-contents* From bfe04222fe5585179f03197b01a6f6ed711d4421 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 14:01:12 +0200 Subject: [PATCH 195/513] docs!: LazyVim now requires Neovim >= 0.9.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1291cdb4a..ba76377011 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ to tweak your config as needed, along with the convenience of a pre-configured s ## ⚡️ Requirements -- Neovim >= **0.8.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.9.0** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_** - a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements) From b8ffa5261abec398268a38b52111ec477200970a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 1 Oct 2023 12:01:59 +0000 Subject: [PATCH 196/513] 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 13a24ae61c..23cb40242a 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -52,7 +52,7 @@ FEATURES *LazyVim-features* REQUIREMENTS *LazyVim-requirements* -- Neovim >= **0.8.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.9.0** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a Nerd Font **(optional)** - a **C** compiler for `nvim-treesitter`. See here From 9935dc3944c4724d7ee7f70b6bc450f8c3b34a08 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 14:17:54 +0200 Subject: [PATCH 197/513] fix: cleanup all Neovim < 0.9.0 code --- lua/lazyvim/config/keymaps.lua | 4 +--- lua/lazyvim/config/options.lua | 8 ++------ lua/lazyvim/health.lua | 6 +++--- lua/lazyvim/plugins/editor.lua | 1 - 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 541071991d..1186281ed9 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -125,9 +125,7 @@ map("n", "gG", function() Util.float_term({ "lazygit" }, {esc_esc = fals map("n", "qq", "qa", { desc = "Quit all" }) -- highlights under cursor -if vim.fn.has("nvim-0.9.0") == 1 then - map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) -end +map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) -- LazyVim Changelog map("n", "L", Util.changelog, {desc = "LazyVim Changelog"}) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index f3d944844d..874aed0553 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -27,7 +27,7 @@ opt.scrolloff = 4 -- Lines of context opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.shiftround = true -- Round indent opt.shiftwidth = 2 -- Size of an indent -opt.shortmess:append({ W = true, I = true, c = true }) +opt.shortmess:append({ W = true, I = true, c = true, C = true }) opt.showmode = false -- Dont show mode since we have a statusline opt.sidescrolloff = 8 -- Columns of context opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time @@ -35,6 +35,7 @@ opt.smartcase = true -- Don't ignore case with capitals opt.smartindent = true -- Insert indents automatically opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current +opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support @@ -46,10 +47,5 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -if vim.fn.has("nvim-0.9.0") == 1 then - opt.splitkeep = "screen" - opt.shortmess:append({ C = true }) -end - -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 diff --git a/lua/lazyvim/health.lua b/lua/lazyvim/health.lua index 810022e580..a23c90f503 100644 --- a/lua/lazyvim/health.lua +++ b/lua/lazyvim/health.lua @@ -8,10 +8,10 @@ local error = vim.health.error or vim.health.report_error function M.check() start("LazyVim") - if vim.fn.has("nvim-0.8.0") == 1 then - ok("Using Neovim >= 0.8.0") + if vim.fn.has("nvim-0.9.0") == 1 then + ok("Using Neovim >= 0.9.0") else - error("Neovim >= 0.8.0 is required") + error("Neovim >= 0.9.0 is required") end for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 8465ca8914..a23393de12 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -109,7 +109,6 @@ return { -- directory is a git repo. { "nvim-telescope/telescope.nvim", - commit = vim.fn.has("nvim-0.9.0") == 0 and "057ee0f8783" or nil, cmd = "Telescope", version = false, -- telescope did only one release, so use HEAD for now keys = { From 2aea5c7210882a2f98526ee29115fe2e1a41d7b4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 14:18:22 +0200 Subject: [PATCH 198/513] feat: show error and exit Neovim when version is too old --- lua/lazyvim/config/init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index ad32353b7e..4a36450d02 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -89,6 +89,21 @@ local options ---@param opts? LazyVimConfig function M.setup(opts) options = vim.tbl_deep_extend("force", defaults, opts or {}) + + if vim.fn.has("nvim-0.9.0") == 0 then + vim.api.nvim_echo({ + { + "LazyVim requires Neovim >= 0.9.0\n", + "ErrorMsg", + }, + { "Press any key to exit", "MoreMsg" }, + }, true, {}) + + vim.fn.getchar() + vim.cmd([[quit]]) + return + end + if not M.has() then require("lazy.core.util").error( "**LazyVim** needs **lazy.nvim** version " From 9d17c4308713e8db7ec03871ba62ff80a3bfb79c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 16:21:18 +0200 Subject: [PATCH 199/513] perf: dont't load schemastore as an lspconfig dep --- lua/lazyvim/plugins/extras/lang/json.lua | 11 +++++++---- lua/lazyvim/plugins/extras/lang/yaml.lua | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/json.lua b/lua/lazyvim/plugins/extras/lang/json.lua index d4dab0db6a..ff41ba4fea 100644 --- a/lua/lazyvim/plugins/extras/lang/json.lua +++ b/lua/lazyvim/plugins/extras/lang/json.lua @@ -10,13 +10,16 @@ return { end, }, + -- yaml schema support + { + "b0o/SchemaStore.nvim", + lazy = true, + version = false, -- last release is way too old + }, + -- correctly setup lspconfig { "neovim/nvim-lspconfig", - dependencies = { - "b0o/SchemaStore.nvim", - version = false, -- last release is way too old - }, opts = { -- make sure mason installs the server servers = { diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 0a174aa263..51f3d8246d 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -10,13 +10,16 @@ return { end, }, + -- yaml schema support + { + "b0o/SchemaStore.nvim", + lazy = true, + version = false, -- last release is way too old + }, + -- correctly setup lspconfig { "neovim/nvim-lspconfig", - dependencies = { - "b0o/SchemaStore.nvim", - version = false, -- last release is way too old - }, opts = { -- make sure mason installs the server servers = { From dd95de5dbe31ecb106305920cbd0e24e26c17afe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:28:37 +0200 Subject: [PATCH 200/513] chore(main): release 8.0.0 (#1542) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cfa33633b..6983dcd1d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [8.0.0](https://github.com/LazyVim/LazyVim/compare/v7.0.3...v8.0.0) (2023-10-01) + + +### ⚠ BREAKING CHANGES + +* LazyVim now requires Neovim >= 0.9.0 + +### Features + +* replace Copilot icon with logo ([#1539](https://github.com/LazyVim/LazyVim/issues/1539)) ([9bb4e87](https://github.com/LazyVim/LazyVim/commit/9bb4e8755f5a822659ca1d8cb3689732435d90d0)) +* show error and exit Neovim when version is too old ([2aea5c7](https://github.com/LazyVim/LazyVim/commit/2aea5c7210882a2f98526ee29115fe2e1a41d7b4)) + + +### Bug Fixes + +* cleanup all Neovim < 0.9.0 code ([9935dc3](https://github.com/LazyVim/LazyVim/commit/9935dc3944c4724d7ee7f70b6bc450f8c3b34a08)) + + +### Performance Improvements + +* dont't load schemastore as an lspconfig dep ([9d17c43](https://github.com/LazyVim/LazyVim/commit/9d17c4308713e8db7ec03871ba62ff80a3bfb79c)) + + +### Documentation + +* LazyVim now requires Neovim >= 0.9.0 ([bfe0422](https://github.com/LazyVim/LazyVim/commit/bfe04222fe5585179f03197b01a6f6ed711d4421)) + ## [7.0.3](https://github.com/LazyVim/LazyVim/compare/v7.0.2...v7.0.3) (2023-09-30) From 2ffd629cc7a68e6e4a721ac8babe6b7cf612868e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Sun, 1 Oct 2023 14:48:09 -0300 Subject: [PATCH 201/513] feat(elixir): Add credo if none-ls is used (#1546) --- lua/lazyvim/plugins/extras/lang/elixir.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index 757afb073f..dbd0e9a715 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -29,4 +29,24 @@ return { }, }, }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + vim.list_extend(opts.sources, { + nls.builtins.diagnostics.credo, + }) + end, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + elixir = { "credo" }, + }, + }, + }, } From 3acdac917b79e22b1c3420aabde8b583d0799f6a Mon Sep 17 00:00:00 2001 From: ueaner Date: Mon, 2 Oct 2023 03:01:40 +0800 Subject: [PATCH 202/513] docs: LazyVim now requires Neovim >= 0.9.0 (#1548) See: https://github.com/LazyVim/LazyVim/commit/bfe04222fe5585179f03197b01a6f6ed711d4421 --- README-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-CN.md b/README-CN.md index a879148d75..395e146ed1 100644 --- a/README-CN.md +++ b/README-CN.md @@ -54,7 +54,7 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性, ## ⚡️ 要求 -- Neovim >= **0.8.0** (需要用 **LuaJIT** 构建) +- Neovim >= **0.9.0** (需要用 **LuaJIT** 构建) - Git >= **2.19.0** (用于部分克隆支持) - 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_** - 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements) From e8ab2ff5b6a75952943d3ba44586c7de5588be33 Mon Sep 17 00:00:00 2001 From: Ahmed W Date: Sun, 1 Oct 2023 16:01:43 -0500 Subject: [PATCH 203/513] feat(go): add goimports (#1549) --- lua/lazyvim/plugins/extras/lang/go.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index d46a215c8c..b9966b7e56 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -91,10 +91,20 @@ return { vim.list_extend(opts.sources, { nls.builtins.code_actions.gomodifytags, nls.builtins.code_actions.impl, + nls.builtins.formatting.goimports, }) end end, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + go = { "goimports" }, + }, + }, + }, { "mfussenegger/nvim-dap", optional = true, @@ -103,7 +113,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "delve" }) + vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" }) end, }, { From 0b04e3908c86a26192b48715a7b1005b4498911a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 23:30:26 +0200 Subject: [PATCH 204/513] chore(format): removed format_notify option --- lua/lazyvim/plugins/lsp/format.lua | 43 ------------------------------ lua/lazyvim/plugins/lsp/init.lua | 3 --- 2 files changed, 46 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 72f187461b..dbabbe53a4 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -53,10 +53,6 @@ function M.format(opts) return end - if M.opts.format_notify then - M.notify(formatters) - end - vim.lsp.buf.format(vim.tbl_deep_extend("force", { bufnr = buf, filter = function(client) @@ -65,45 +61,6 @@ function M.format(opts) }, require("lazyvim.util").opts("nvim-lspconfig").format or {})) end ----@param formatters LazyVimFormatters -function M.notify(formatters) - local lines = { "# Active:" } - - for _, client in ipairs(formatters.active) do - local line = "- **" .. client.name .. "**" - if client.name == "null-ls" then - line = line - .. " (" - .. table.concat( - vim.tbl_map(function(f) - return "`" .. f.name .. "`" - end, formatters.null_ls), - ", " - ) - .. ")" - end - table.insert(lines, line) - end - - if #formatters.available > 0 then - table.insert(lines, "") - table.insert(lines, "# Disabled:") - for _, client in ipairs(formatters.available) do - table.insert(lines, "- **" .. client.name .. "**") - end - end - - vim.notify(table.concat(lines, "\n"), vim.log.levels.INFO, { - title = "Formatting", - on_open = function(win) - vim.api.nvim_win_set_option(win, "conceallevel", 3) - vim.api.nvim_win_set_option(win, "spell", false) - local buf = vim.api.nvim_win_get_buf(win) - vim.treesitter.start(buf, "markdown") - end, - }) -end - -- Gets all lsp clients that support formatting. -- When a null-ls formatter is available for the current filetype, -- only null-ls formatters are returned. diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index d69ec824b2..178102e3a8 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -41,9 +41,6 @@ return { capabilities = {}, -- Automatically format on save autoformat = true, - -- Enable this to show formatters used in a notification - -- Useful for debugging formatter issues - format_notify = false, -- options for vim.lsp.buf.format -- `bufnr` and `filter` is handled by the LazyVim formatter, -- but can be also overridden when specified From e36f7d811c396b60bcbf65f962b3f52d2f75b0b3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 23:30:56 +0200 Subject: [PATCH 205/513] feat(format): show warning when no formatter ran when using the format keymap --- lua/lazyvim/plugins/lsp/format.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index dbabbe53a4..7d1c91092d 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -50,6 +50,9 @@ function M.format(opts) end, formatters.active) if #client_ids == 0 then + if opts and opts.force then + Util.warn("No formatter available", { title = "LazyVim" }) + end return end From 9b1677057377400ab292c51bbc085c82637a39d4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 23:31:24 +0200 Subject: [PATCH 206/513] fix(format): moved formatting keymap to lua/lazyvim/config/keymaps.lua --- lua/lazyvim/config/keymaps.lua | 5 +++++ lua/lazyvim/plugins/lsp/keymaps.lua | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 1186281ed9..b518193694 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -103,6 +103,11 @@ if not Util.has("trouble.nvim") then map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) end +-- formatting +map({ "n", "v" }, "cf", function() + require("lazyvim.plugins.lsp.format").format({ force = true }) +end, { desc = "Format" }) + -- stylua: ignore start -- toggle options diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index b88d305621..695e6ce859 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -5,9 +5,6 @@ M._keys = nil ---@return (LazyKeys|{has?:string})[] function M.get() - local format = function() - require("lazyvim.plugins.lsp.format").format({ force = true }) - end if not M._keys then ---@class PluginLspKeys -- stylua: ignore @@ -28,8 +25,6 @@ function M.get() { "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" }, { "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" }, { "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" }, - { "cf", format, desc = "Format Document", has = "formatting" }, - { "cf", format, desc = "Format Range", mode = "v", has = "rangeFormatting" }, { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cA", From 766d5e5bf7a8e40910a00aef4dc30f36376e5652 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 1 Oct 2023 23:36:26 +0200 Subject: [PATCH 207/513] feat(conform): set vim.opt.formatexpr --- lua/lazyvim/plugins/extras/formatting/conform.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index d89385d77c..bc8da08b33 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -5,6 +5,7 @@ return { lazy = true, cmd = "ConformInfo", init = function() + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" -- Install the conform formatter on VeryLazy require("lazyvim.util").on_very_lazy(function() require("lazyvim.plugins.lsp.format").custom_format = function(buf) From 0ca732e0ef2eb2fa610fe399be53943d10b076c5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 07:40:30 +0200 Subject: [PATCH 208/513] chore(main): release 8.1.0 (#1547) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6983dcd1d7..c7862af3c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [8.1.0](https://github.com/LazyVim/LazyVim/compare/v8.0.0...v8.1.0) (2023-10-01) + + +### Features + +* **conform:** set vim.opt.formatexpr ([766d5e5](https://github.com/LazyVim/LazyVim/commit/766d5e5bf7a8e40910a00aef4dc30f36376e5652)) +* **elixir:** Add credo if none-ls is used ([#1546](https://github.com/LazyVim/LazyVim/issues/1546)) ([2ffd629](https://github.com/LazyVim/LazyVim/commit/2ffd629cc7a68e6e4a721ac8babe6b7cf612868e)) +* **format:** show warning when no formatter ran when using the format keymap ([e36f7d8](https://github.com/LazyVim/LazyVim/commit/e36f7d811c396b60bcbf65f962b3f52d2f75b0b3)) +* **go:** add goimports ([#1549](https://github.com/LazyVim/LazyVim/issues/1549)) ([e8ab2ff](https://github.com/LazyVim/LazyVim/commit/e8ab2ff5b6a75952943d3ba44586c7de5588be33)) + + +### Bug Fixes + +* **format:** moved formatting keymap to lua/lazyvim/config/keymaps.lua ([9b16770](https://github.com/LazyVim/LazyVim/commit/9b1677057377400ab292c51bbc085c82637a39d4)) + ## [8.0.0](https://github.com/LazyVim/LazyVim/compare/v7.0.3...v8.0.0) (2023-10-01) From fe341e6b97d6916df50809dfd6a8cf1ea6a735b3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 2 Oct 2023 05:41:09 +0000 Subject: [PATCH 209/513] 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 23cb40242a..8ba694362e 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 01 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 4ff51cd678343ea32668eaf0c1103caacb4334a2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 2 Oct 2023 11:02:53 +0200 Subject: [PATCH 210/513] feat(mini.files): added lsp rename support to mini.files --- lua/lazyvim/plugins/editor.lua | 15 ++----------- .../plugins/extras/editor/mini-files.lua | 7 +++++++ lua/lazyvim/util/init.lua | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index a23393de12..20b466fd82 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -59,23 +59,12 @@ return { }, }, config = function(_, opts) - opts.event_handlers = opts.event_handlers or {} - local function on_move(data) - local clients = vim.lsp.get_active_clients() - for _, client in ipairs(clients) do - if client:supports_method("workspace/willRenameFiles") then - local resp = client.request_sync("workspace/willRenameFiles", { - files = { { oldUri = vim.uri_from_fname(data.source), newUri = vim.uri_from_fname(data.destination) } }, - }, 1000) - if resp and resp.result ~= nil then - vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) - end - end - end + Util.on_rename(data.source, data.destination) end local events = require("neo-tree.events") + opts.event_handlers = opts.event_handlers or {} vim.list_extend(opts.event_handlers, { { event = events.FILE_MOVED, handler = on_move }, { event = events.FILE_RENAMED, handler = on_move }, diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index a9b318d8b7..c3ddd2734d 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -53,5 +53,12 @@ return { vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id }) end, }) + + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesActionRename", + callback = function(event) + require("lazyvim.util").on_rename(event.data.from, event.data.to) + end, + }) end, } diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index dba6aaadb5..2a2f69f3bc 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -299,4 +299,25 @@ function M.changelog() vim.diagnostic.disable(float.buf) end +---@param from string +---@param to string +function M.on_rename(from, to) + local clients = vim.lsp.get_active_clients() + for _, client in ipairs(clients) do + if client:supports_method("workspace/willRenameFiles") then + local resp = client.request_sync("workspace/willRenameFiles", { + files = { + { + oldUri = vim.uri_from_fname(from), + newUri = vim.uri_from_fname(to), + }, + }, + }, 1000) + if resp and resp.result ~= nil then + vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) + end + end + end +end + return M From ecac59c9823c86ac4c916a4cc1aa761f43e040ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:27:12 +0200 Subject: [PATCH 211/513] chore(main): release 8.2.0 (#1551) 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 c7862af3c9..9b87553c90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [8.2.0](https://github.com/LazyVim/LazyVim/compare/v8.1.0...v8.2.0) (2023-10-02) + + +### Features + +* **mini.files:** added lsp rename support to mini.files ([4ff51cd](https://github.com/LazyVim/LazyVim/commit/4ff51cd678343ea32668eaf0c1103caacb4334a2)) + ## [8.1.0](https://github.com/LazyVim/LazyVim/compare/v8.0.0...v8.1.0) (2023-10-01) From 7c5a458761fe7002c6603d602e8d130b9a62dd68 Mon Sep 17 00:00:00 2001 From: loqusion Date: Mon, 2 Oct 2023 05:23:08 -0500 Subject: [PATCH 212/513] fix(indent-blankline): set `config.indent.tab_char` (#1552) See lukas-reineke/indent-blankline.nvim#665. --- lua/lazyvim/plugins/ui.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index c66c5a4f32..d8d6e1811f 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -168,7 +168,10 @@ return { "lukas-reineke/indent-blankline.nvim", event = { "BufReadPost", "BufNewFile" }, opts = { - indent = { char = "│" }, + indent = { + char = "│", + tab_char = "│", + }, scope = { enabled = false }, exclude = { filetypes = { From 86d36946727bade57918c6a358c6b6bae52d441b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 2 Oct 2023 20:59:00 +0200 Subject: [PATCH 213/513] feat(conform): added new keymap (leader-cF) to format injected languages --- lua/lazyvim/plugins/extras/formatting/conform.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index bc8da08b33..ee914f8eb7 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -4,6 +4,16 @@ return { dependencies = { "mason.nvim" }, lazy = true, cmd = "ConformInfo", + keys = { + { + "cF", + function() + require("conform").format({ formatters = { "injected" } }) + end, + mode = { "n", "v" }, + desc = "Format Injected Langs", + }, + }, init = function() vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" -- Install the conform formatter on VeryLazy From 4e277fcb8f6c73fe557f140ff407b3be691f31f6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:00:47 +0200 Subject: [PATCH 214/513] chore(main): release 8.3.0 (#1553) 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 9b87553c90..adb6d4427e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [8.3.0](https://github.com/LazyVim/LazyVim/compare/v8.2.0...v8.3.0) (2023-10-02) + + +### Features + +* **conform:** added new keymap (leader-cF) to format injected languages ([86d3694](https://github.com/LazyVim/LazyVim/commit/86d36946727bade57918c6a358c6b6bae52d441b)) + + +### Bug Fixes + +* **indent-blankline:** set `config.indent.tab_char` ([#1552](https://github.com/LazyVim/LazyVim/issues/1552)) ([7c5a458](https://github.com/LazyVim/LazyVim/commit/7c5a458761fe7002c6603d602e8d130b9a62dd68)) + ## [8.2.0](https://github.com/LazyVim/LazyVim/compare/v8.1.0...v8.2.0) (2023-10-02) From 450e0c6bebc5bb9a0c513cdffaf9c46d5f62d5fa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 08:01:48 +0200 Subject: [PATCH 215/513] feat(options): enable smoothscroll on nightly --- lua/lazyvim/config/options.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 874aed0553..cee2bc261c 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -47,5 +47,9 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap +if vim.fn.has("nvim-0.10") == 1 then + opt.smoothscroll = true +end + -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 From 19926d284862b5e58f29e73b71ec532ac29c54ba Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 08:02:10 +0200 Subject: [PATCH 216/513] feat(options): enabled treesitter folding and foldtext when available --- lua/lazyvim/config/options.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index cee2bc261c..2262dbff5b 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -51,5 +51,17 @@ if vim.fn.has("nvim-0.10") == 1 then opt.smoothscroll = true end +-- Folding +vim.opt.foldlevel = 99 +if vim.treesitter.foldexpr then + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +else + vim.opt.foldmethod = "indent" +end +if vim.treesitter.foldtext then + vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()" +end + -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 From fecc5faca25c209ed62e3658dd63731e26c0c643 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 3 Oct 2023 06:02:56 +0000 Subject: [PATCH 217/513] 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 8ba694362e..dd020d8ee8 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 02 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 3f868aa8254efbd494f6bf100c86a59c5a002c1c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 13:50:30 +0200 Subject: [PATCH 218/513] feat(keymaps): added toggle for relative line numbers --- 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 b518193694..ff4b4af92c 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -114,6 +114,7 @@ end, { desc = "Format" }) map("n", "uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" }) map("n", "us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) map("n", "uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) +map("n", "uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) map("n", "ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" }) map("n", "ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" }) local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 From 364bcf325d91a06e6bd6516bdfed84399566cdb6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 14:56:09 +0200 Subject: [PATCH 219/513] feat(ui): fancy status column --- lua/lazyvim/config/options.lua | 2 ++ lua/lazyvim/util/ui.lua | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 lua/lazyvim/util/ui.lua diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 2262dbff5b..16afa00aee 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -61,6 +61,8 @@ else end if vim.treesitter.foldtext then vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()" +if vim.fn.has("nvim-0.9.0") == 1 then + vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] end -- Fix markdown indentation settings diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua new file mode 100644 index 0000000000..549e3201d3 --- /dev/null +++ b/lua/lazyvim/util/ui.lua @@ -0,0 +1,57 @@ +local M = {} + +---@alias Sign {name:string, text:string, texthl:string} + +---@return Sign[] +function M.get_signs(win) + local buf = vim.api.nvim_win_get_buf(win) + ---@diagnostic disable-next-line: no-unknown + return vim.tbl_map(function(sign) + return vim.fn.sign_getdefined(sign.name)[1] + end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs) +end + +---@param sign? Sign +---@param len? number +function M.icon(sign, len) + sign = sign or {} + len = len or 1 + local text = vim.fn.strcharpart(sign.text or "", 0, len, false) ---@type string + text = text .. string.rep(" ", len - vim.fn.strchars(text)) + return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text +end + +function M.statuscolumn() + local win = vim.g.statusline_winid + if vim.wo[win].signcolumn == "no" then + return "" + end + + ---@type Sign?,Sign?,Sign? + local left, right, fold + for _, s in ipairs(M.get_signs(win)) do + if s.name:find("GitSign") then + right = s + elseif not left then + left = s + end + end + + if vim.fn.foldclosed(vim.v.lnum) >= 0 then + fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } + end + + local nu = "" + if vim.wo[win].number and vim.v.virtnum == 0 then + nu = vim.wo[win].relativenumber and vim.v.relnum ~= 0 and vim.v.relnum or vim.v.lnum + end + + return table.concat({ + M.icon(left), + [[%=]], + nu .. " ", + M.icon(fold or right, 2), + }, "") +end + +return M From f1ce07510d2048e33fec2b609814d68a7175d591 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 14:56:28 +0200 Subject: [PATCH 220/513] feat(ui): fancy fold text --- lua/lazyvim/config/init.lua | 3 +++ lua/lazyvim/config/options.lua | 13 ++++++++++++- lua/lazyvim/util/ui.lua | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 4a36450d02..91a66f89b3 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -19,6 +19,9 @@ local defaults = { }, -- icons used by other plugins icons = { + misc = { + dots = "󰇘", + }, dap = { Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, Breakpoint = " ", diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 16afa00aee..64774b0c0a 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -46,6 +46,15 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold 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 = "⸱", + fold = " ", + foldsep = " ", + diff = "╱", + eob = " ", +} if vim.fn.has("nvim-0.10") == 1 then opt.smoothscroll = true @@ -60,7 +69,9 @@ else vim.opt.foldmethod = "indent" end if vim.treesitter.foldtext then - vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()" + vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()" +end + if vim.fn.has("nvim-0.9.0") == 1 then vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] end diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 549e3201d3..a26bf5e6fe 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -21,6 +21,15 @@ function M.icon(sign, len) return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text end +function M.foldtext() + local ret = vim.treesitter.foldtext and vim.treesitter.foldtext() + if not ret then + ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } } + end + table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots }) + return ret +end + function M.statuscolumn() local win = vim.g.statusline_winid if vim.wo[win].signcolumn == "no" then From afbe2043a73b6c90476812f9cc0ca4759814e5ac Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 14:59:26 +0200 Subject: [PATCH 221/513] fix(ui): Neovim < 0.10 --- lua/lazyvim/util/ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index a26bf5e6fe..1e992ecc5b 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -16,7 +16,7 @@ end function M.icon(sign, len) sign = sign or {} len = len or 1 - local text = vim.fn.strcharpart(sign.text or "", 0, len, false) ---@type string + local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string text = text .. string.rep(" ", len - vim.fn.strchars(text)) return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text end From 762017dc35fc961bdcc7879a5527dbccced27792 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 15:05:01 +0200 Subject: [PATCH 222/513] fix(ui): better fallback for foldtext when buffer does not have TreeSitter --- lua/lazyvim/util/ui.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 1e992ecc5b..fbe46d29ad 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -22,7 +22,8 @@ function M.icon(sign, len) end function M.foldtext() - local ret = vim.treesitter.foldtext and vim.treesitter.foldtext() + local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf()) + local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext() if not ret then ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } } end From 6428fc167c329cb43abc55dc63b32698d31c6faa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:10:22 +0200 Subject: [PATCH 223/513] chore(main): release 8.4.0 (#1564) 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 adb6d4427e..8ec3f6544a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [8.4.0](https://github.com/LazyVim/LazyVim/compare/v8.3.0...v8.4.0) (2023-10-03) + + +### Features + +* **keymaps:** added toggle for relative line numbers ([3f868aa](https://github.com/LazyVim/LazyVim/commit/3f868aa8254efbd494f6bf100c86a59c5a002c1c)) +* **options:** enable smoothscroll on nightly ([450e0c6](https://github.com/LazyVim/LazyVim/commit/450e0c6bebc5bb9a0c513cdffaf9c46d5f62d5fa)) +* **options:** enabled treesitter folding and foldtext when available ([19926d2](https://github.com/LazyVim/LazyVim/commit/19926d284862b5e58f29e73b71ec532ac29c54ba)) +* **ui:** fancy fold text ([f1ce075](https://github.com/LazyVim/LazyVim/commit/f1ce07510d2048e33fec2b609814d68a7175d591)) +* **ui:** fancy status column ([364bcf3](https://github.com/LazyVim/LazyVim/commit/364bcf325d91a06e6bd6516bdfed84399566cdb6)) + + +### Bug Fixes + +* **ui:** better fallback for foldtext when buffer does not have TreeSitter ([762017d](https://github.com/LazyVim/LazyVim/commit/762017dc35fc961bdcc7879a5527dbccced27792)) +* **ui:** Neovim < 0.10 ([afbe204](https://github.com/LazyVim/LazyVim/commit/afbe2043a73b6c90476812f9cc0ca4759814e5ac)) + ## [8.3.0](https://github.com/LazyVim/LazyVim/compare/v8.2.0...v8.3.0) (2023-10-02) From 13e9f6e6b5b085191b0ecf194ddf4c9e2d3ae6d7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 15:53:11 +0200 Subject: [PATCH 224/513] fix(ui): check folds of the statuscolumn win instead of current win --- lua/lazyvim/util/ui.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index fbe46d29ad..cc60ca7c5a 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -47,9 +47,11 @@ function M.statuscolumn() end end - if vim.fn.foldclosed(vim.v.lnum) >= 0 then - fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } - end + vim.api.nvim_win_call(win, function() + if vim.fn.foldclosed(vim.v.lnum) >= 0 then + fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } + end + end) local nu = "" if vim.wo[win].number and vim.v.virtnum == 0 then From 63467c1f21c60382cc8838f6cab32591fd874aac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:55:11 +0200 Subject: [PATCH 225/513] chore(main): release 8.4.1 (#1568) 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 8ec3f6544a..323401c76d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [8.4.1](https://github.com/LazyVim/LazyVim/compare/v8.4.0...v8.4.1) (2023-10-03) + + +### Bug Fixes + +* **ui:** check folds of the statuscolumn win instead of current win ([13e9f6e](https://github.com/LazyVim/LazyVim/commit/13e9f6e6b5b085191b0ecf194ddf4c9e2d3ae6d7)) + ## [8.4.0](https://github.com/LazyVim/LazyVim/compare/v8.3.0...v8.4.0) (2023-10-03) From b1ad48067e2c18747bedd7b7054c3ce97ef32890 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 16:32:05 +0200 Subject: [PATCH 226/513] fix(nvim-lint): dont evaluate conditions for linter functions. Fixes #1569 --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index 825b257b4e..879b21775e 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -49,7 +49,7 @@ return { ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") names = vim.tbl_filter(function(name) local linter = lint.linters[name] - return linter and not (linter.condition and not linter.condition(ctx)) + return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) end, names) if #names > 0 then From 1b74d67a0d5783e587dedc73a715cb0c9db6cd16 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 17:35:14 +0200 Subject: [PATCH 227/513] fix(ui): fixed foldtext on Neovim < 0.10 --- lua/lazyvim/util/ui.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index cc60ca7c5a..b11e6a0451 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -28,6 +28,15 @@ function M.foldtext() ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } } end table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots }) + + if not vim.treesitter.foldtext then + return table.concat( + vim.tbl_map(function(line) + return line[1] + end, ret), + " " + ) + end return ret end From e105c9daf6e973b4a294a17b4d2d1882f2188ac6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 18:19:32 +0200 Subject: [PATCH 228/513] perf(options): better detection for foldtext,statuscolumn,folexpr support --- lua/lazyvim/config/options.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 64774b0c0a..c2f3177d40 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -62,19 +62,15 @@ end -- Folding vim.opt.foldlevel = 99 -if vim.treesitter.foldexpr then +vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()" + +if vim.fn.has("nvim-0.9.0") == 1 then vim.opt.foldmethod = "expr" vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] else vim.opt.foldmethod = "indent" end -if vim.treesitter.foldtext then - vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()" -end - -if vim.fn.has("nvim-0.9.0") == 1 then - vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] -end -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 From e08813fa11ad12fedada92f9fbdbc2e53176fb52 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:22:19 +0200 Subject: [PATCH 229/513] chore(main): release 8.4.2 (#1570) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 323401c76d..eba18cda5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [8.4.2](https://github.com/LazyVim/LazyVim/compare/v8.4.1...v8.4.2) (2023-10-03) + + +### Bug Fixes + +* **nvim-lint:** dont evaluate conditions for linter functions. Fixes [#1569](https://github.com/LazyVim/LazyVim/issues/1569) ([b1ad480](https://github.com/LazyVim/LazyVim/commit/b1ad48067e2c18747bedd7b7054c3ce97ef32890)) +* **ui:** fixed foldtext on Neovim < 0.10 ([1b74d67](https://github.com/LazyVim/LazyVim/commit/1b74d67a0d5783e587dedc73a715cb0c9db6cd16)) + + +### Performance Improvements + +* **options:** better detection for foldtext,statuscolumn,folexpr support ([e105c9d](https://github.com/LazyVim/LazyVim/commit/e105c9daf6e973b4a294a17b4d2d1882f2188ac6)) + ## [8.4.1](https://github.com/LazyVim/LazyVim/compare/v8.4.0...v8.4.1) (2023-10-03) From 6cf6b0a6241c659113f5646ff64fba7dbf5161b9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 18:28:02 +0200 Subject: [PATCH 230/513] fix(ui): always pad to 2 cells for status column icons. Fixes #1571 --- lua/lazyvim/util/ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index b11e6a0451..0f96e87a33 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -15,7 +15,7 @@ end ---@param len? number function M.icon(sign, len) sign = sign or {} - len = len or 1 + len = len or 2 local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string text = text .. string.rep(" ", len - vim.fn.strchars(text)) return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text @@ -71,7 +71,7 @@ function M.statuscolumn() M.icon(left), [[%=]], nu .. " ", - M.icon(fold or right, 2), + M.icon(fold or right), }, "") end From 0e16033e9cfd375ad52ca183718af4e319ed5406 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:30:22 +0200 Subject: [PATCH 231/513] chore(main): release 8.4.3 (#1573) 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 eba18cda5d..4a10bce87c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [8.4.3](https://github.com/LazyVim/LazyVim/compare/v8.4.2...v8.4.3) (2023-10-03) + + +### Bug Fixes + +* **ui:** always pad to 2 cells for status column icons. Fixes [#1571](https://github.com/LazyVim/LazyVim/issues/1571) ([6cf6b0a](https://github.com/LazyVim/LazyVim/commit/6cf6b0a6241c659113f5646ff64fba7dbf5161b9)) + ## [8.4.2](https://github.com/LazyVim/LazyVim/compare/v8.4.1...v8.4.2) (2023-10-03) From ccff8683ba957250d71ef66429fc877f0ee5cedb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 18:57:03 +0200 Subject: [PATCH 232/513] fix(ui): work-around for telescope issue with treesitter folds --- lua/lazyvim/config/autocmds.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index a3ba5c9138..86635832b0 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -91,3 +91,16 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") end, }) + +-- HACK: re-caclulate folds when entering a buffer through Telescope +-- @see https://github.com/nvim-telescope/telescope.nvim/issues/699 +vim.api.nvim_create_autocmd("BufEnter", { + group = augroup("fix_folds"), + callback = function() + if vim.opt.foldmethod:get() == "expr" then + vim.schedule(function() + vim.opt.foldmethod = "expr" + end) + end + end, +}) From 758520dcbbf0f40774beceaf65de3f464b23fc3f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:00:20 +0200 Subject: [PATCH 233/513] chore(main): release 8.4.4 (#1575) 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 4a10bce87c..040cf6b520 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [8.4.4](https://github.com/LazyVim/LazyVim/compare/v8.4.3...v8.4.4) (2023-10-03) + + +### Bug Fixes + +* **ui:** work-around for telescope issue with treesitter folds ([ccff868](https://github.com/LazyVim/LazyVim/commit/ccff8683ba957250d71ef66429fc877f0ee5cedb)) + ## [8.4.3](https://github.com/LazyVim/LazyVim/compare/v8.4.2...v8.4.3) (2023-10-03) From 5f0713d2b612a814586bffec39700ab6a30dc0ea Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Oct 2023 20:17:30 +0200 Subject: [PATCH 234/513] feat(treesitter): map `vim` to `@namespace.builtin` --- queries/lua/highlights.scm | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 queries/lua/highlights.scm diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm new file mode 100644 index 0000000000..829b2b0875 --- /dev/null +++ b/queries/lua/highlights.scm @@ -0,0 +1,4 @@ +;; extends + +((identifier) @namespace.builtin + (#eq? @namespace.builtin "vim")) From 626ae1338a88f6cd8962d6c20bd79953a67f0b72 Mon Sep 17 00:00:00 2001 From: Ahmed W Date: Tue, 3 Oct 2023 16:40:32 -0500 Subject: [PATCH 235/513] feat(typescript): add typescriptreact/javascriptreact to types (#1574) * feat(typescript): add typescriptreact/javascriptreact to types * remove unneeded values * revert settings change --- lua/lazyvim/plugins/extras/lang/typescript.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 44a963ecb4..4af1deec73 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -86,7 +86,7 @@ return { }, } end - for _, language in ipairs({ "typescript", "javascript" }) do + for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do if not dap.configurations[language] then dap.configurations[language] = { { From 0e66ef83934eb62ee2237e331dcbc0a22b809aae Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 00:12:32 +0200 Subject: [PATCH 236/513] feat(treesitter): added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects --- lua/lazyvim/plugins/coding.lua | 1 - lua/lazyvim/plugins/treesitter.lua | 32 +++++++++--------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 7250638d4e..0e01d277af 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -179,7 +179,6 @@ return { -- { "i", mode = { "x", "o" } }, -- }, event = "VeryLazy", - dependencies = { "nvim-treesitter-textobjects" }, opts = function() local ai = require("mini.ai") return { diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index b84d01a70f..0b9b689593 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -1,4 +1,3 @@ -local load_textobjects = false return { -- Treesitter is a new parser generator tool that we can -- use in Neovim to power faster and more accurate @@ -11,13 +10,6 @@ return { dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", - init = function() - -- disable rtp plugin, as we only need its queries for mini.ai - -- In case other textobject modules are enabled, we will load them - -- once nvim-treesitter is loaded - require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects") - load_textobjects = true - end, }, }, cmd = { "TSUpdateSync" }, @@ -59,6 +51,15 @@ return { node_decremental = "", }, }, + textobjects = { + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, + }, + }, }, ---@param opts TSConfig config = function(_, opts) @@ -74,21 +75,6 @@ return { end, opts.ensure_installed) end require("nvim-treesitter.configs").setup(opts) - - if load_textobjects then - -- PERF: no need to load the plugin, if we only need its queries for mini.ai - if opts.textobjects then - for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do - if opts.textobjects[mod] and opts.textobjects[mod].enable then - local Loader = require("lazy.core.loader") - Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil - local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"] - require("lazy.core.loader").source_runtime(plugin.dir, "plugin") - break - end - end - end - end end, }, } From d28c69e49eab62b45f7d1562b3bc00afee5fbb65 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 00:25:44 +0200 Subject: [PATCH 237/513] feat(mini.surround)!: default surround mappings are now gs instead of gz (unless you enabled the leap extra) --- lua/lazyvim/plugins/coding.lua | 14 +++++++------- lua/lazyvim/plugins/extras/editor/leap.lua | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 0e01d277af..122187f82c 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -140,13 +140,13 @@ return { end, opts = { mappings = { - add = "gza", -- Add surrounding in Normal and Visual modes - delete = "gzd", -- Delete surrounding - find = "gzf", -- Find surrounding (to the right) - find_left = "gzF", -- Find surrounding (to the left) - highlight = "gzh", -- Highlight surrounding - replace = "gzr", -- Replace surrounding - update_n_lines = "gzn", -- Update `n_lines` + 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 a104b98ef4..ab422abf3f 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -35,6 +35,22 @@ return { end, }, + -- rename surround mappings from gs to gz to prevent conflict with leap + { + "echasnovski/mini.surround", + opts = { + mappings = { + add = "gza", -- Add surrounding in Normal and Visual modes + delete = "gzd", -- Delete surrounding + find = "gzf", -- Find surrounding (to the right) + find_left = "gzF", -- Find surrounding (to the left) + highlight = "gzh", -- Highlight surrounding + replace = "gzr", -- Replace surrounding + update_n_lines = "gzn", -- Update `n_lines` + }, + }, + }, + -- makes some plugins dot-repeatable like leap { "tpope/vim-repeat", event = "VeryLazy" }, } From f15dd301e5fea81921a9320347e8a9b31f79814e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 10:43:44 +0200 Subject: [PATCH 238/513] style: fixed lua annotations --- lua/lazyvim/config/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 91a66f89b3..964ca5b998 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -1,9 +1,9 @@ ----@type LazyVimConfig +---@class LazyVimConfig: LazyVimOptions local M = {} M.lazy_version = ">=9.1.0" ----@class LazyVimConfig +---@class LazyVimOptions local defaults = { -- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme ---@type string|fun() @@ -86,12 +86,12 @@ M.renames = { ["null-ls.nvim"] = "none-ls.nvim", } ----@type LazyVimConfig +---@type LazyVimOptions local options ----@param opts? LazyVimConfig +---@param opts? LazyVimOptions function M.setup(opts) - options = vim.tbl_deep_extend("force", defaults, opts or {}) + options = vim.tbl_deep_extend("force", defaults, opts or {}) or {} if vim.fn.has("nvim-0.9.0") == 0 then vim.api.nvim_echo({ @@ -199,6 +199,7 @@ function M.init() require("lazyvim.config").load("options") local Plugin = require("lazy.core.plugin") local add = Plugin.Spec.add + ---@diagnostic disable-next-line: duplicate-set-field Plugin.Spec.add = function(self, plugin, ...) if type(plugin) == "table" and M.renames[plugin[1]] then require("lazy.core.util").warn( From 936d74bb6127721eeefa62e5f697d9693ab04fdd Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 10:45:10 +0200 Subject: [PATCH 239/513] perf: added support for `LazyFile` event that properly loads file based plugins without blocking the ui --- lua/lazyvim/config/init.lua | 47 ++++++++++++++++++- lua/lazyvim/plugins/editor.lua | 6 +-- lua/lazyvim/plugins/extras/lang/cmake.lua | 2 +- .../plugins/extras/linting/nvim-lint.lua | 3 +- .../plugins/extras/util/mini-hipatterns.lua | 2 +- lua/lazyvim/plugins/lsp/init.lua | 4 +- lua/lazyvim/plugins/treesitter.lua | 2 +- lua/lazyvim/plugins/ui.lua | 6 +-- 8 files changed, 58 insertions(+), 14 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 964ca5b998..36335f7bc4 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -124,8 +124,9 @@ function M.setup(opts) M.load("autocmds") end + local group = vim.api.nvim_create_augroup("LazyVim", { clear = true }) vim.api.nvim_create_autocmd("User", { - group = vim.api.nvim_create_augroup("LazyVim", { clear = true }), + group = group, pattern = "VeryLazy", callback = function() if lazy_autocmds then @@ -135,6 +136,8 @@ function M.setup(opts) end, }) + M.lazy_file() + require("lazy.core.util").try(function() if type(M.colorscheme) == "function" then M.colorscheme() @@ -150,6 +153,40 @@ function M.setup(opts) }) end +-- Properly load file based plugins without blocking the UI +function M.lazy_file() + local events = {} ---@type {event: string, pattern?: string, buf: number, data?: any}[] + + local function load() + if #events == 0 then + return + end + vim.api.nvim_del_augroup_by_name("lazy_file") + vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) + for _, event in ipairs(events) do + vim.api.nvim_exec_autocmds(event.event, { + pattern = event.pattern, + modeline = false, + buffer = event.buf, + data = event.data, + }) + end + 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({ "BufReadPost", "BufWritePost", "BufNewFile" }, { + group = vim.api.nvim_create_augroup("lazy_file", { clear = true }), + callback = function(event) + table.insert(events, event) + load() + end, + }) +end + ---@param range? string function M.has(range) local Semver = require("lazy.manage.semver") @@ -214,6 +251,14 @@ function M.init() end return add(self, plugin, ...) end + + -- Add support for the LazyFile event + local Event = require("lazy.core.handler.event") + local _event = Event._event + ---@diagnostic disable-next-line: duplicate-set-field + Event._event = function(self, value) + return value == "LazyFile" and "User LazyFile" or _event(self, value) + end end end diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 20b466fd82..3f4c5d52b5 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -310,7 +310,7 @@ return { -- hunks in a commit. { "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, + event = "LazyFile", opts = { signs = { add = { text = "▎" }, @@ -349,7 +349,7 @@ return { -- instances. { "RRethy/vim-illuminate", - event = { "BufReadPost", "BufNewFile" }, + event = "LazyFile", opts = { delay = 200, large_file_cutoff = 2000, @@ -440,7 +440,7 @@ return { { "folke/todo-comments.nvim", cmd = { "TodoTrouble", "TodoTelescope" }, - event = { "BufReadPost", "BufNewFile" }, + event = "LazyFile", config = true, -- stylua: ignore keys = { diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index cd802edf04..bc7b235a3f 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -45,6 +45,6 @@ return { { "Civitasv/cmake-tools.nvim", opts = {}, - event = "BufRead", + event = "LazyFile", }, } diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index 879b21775e..2d750309a2 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -1,7 +1,7 @@ return { { "mfussenegger/nvim-lint", - event = "BufReadPost", + event = "LazyFile", opts = { -- Event to trigger linters events = { "BufWritePost", "BufReadPost", "InsertLeave" }, @@ -43,7 +43,6 @@ return { end function M.lint() - local lint = require("lint") local names = lint.linters_by_ft[vim.bo.filetype] or {} local ctx = { filename = vim.api.nvim_buf_get_name(0) } ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") diff --git a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua index 1367f908e1..43b8c49dfa 100644 --- a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua +++ b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua @@ -5,7 +5,7 @@ M.hl = {} M.plugin = { "echasnovski/mini.hipatterns", - event = "BufReadPre", + event = "LazyFile", opts = function() local hi = require("mini.hipatterns") return { diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 178102e3a8..211385f989 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -2,7 +2,7 @@ return { -- lspconfig { "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, + event = "LazyFile", dependencies = { { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, { "folke/neodev.nvim", opts = {} }, @@ -203,7 +203,7 @@ return { -- formatters { "nvimtools/none-ls.nvim", - event = { "BufReadPre", "BufNewFile" }, + event = "LazyFile", dependencies = { "mason.nvim" }, opts = function() local nls = require("null-ls") diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 0b9b689593..f6d3651948 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -6,7 +6,7 @@ return { "nvim-treesitter/nvim-treesitter", version = false, -- last release is way too old and doesn't work on Windows build = ":TSUpdate", - event = { "BufReadPost", "BufNewFile" }, + event = { "LazyFile", "VeryLazy" }, dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index d8d6e1811f..677b902ac6 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -53,7 +53,7 @@ return { -- tabs, which include filetype icons and close buttons. { "akinsho/bufferline.nvim", - event = "VeryLazy", + event = "LazyFile", keys = { { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, @@ -166,7 +166,7 @@ return { -- indent guides for Neovim { "lukas-reineke/indent-blankline.nvim", - event = { "BufReadPost", "BufNewFile" }, + event = "LazyFile", opts = { indent = { char = "│", @@ -197,7 +197,7 @@ return { { "echasnovski/mini.indentscope", version = false, -- wait till new 0.7.0 release to put it back on semver - event = { "BufReadPre", "BufNewFile" }, + event = "LazyFile", opts = { -- symbol = "▏", symbol = "│", From afc8e7f8cac06335efd12ec5f71cabb1f38a09b0 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 10:48:20 +0200 Subject: [PATCH 240/513] fix(autocmds): retore last location for correct buffer --- lua/lazyvim/config/autocmds.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 86635832b0..7d9feeddbc 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -31,9 +31,9 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { -- go to last loc when opening a buffer vim.api.nvim_create_autocmd("BufReadPost", { group = augroup("last_loc"), - callback = function() + callback = function(event) local exclude = { "gitcommit" } - local buf = vim.api.nvim_get_current_buf() + local buf = event.buf if vim.tbl_contains(exclude, vim.bo[buf].filetype) then return end From a12d4bd4e4b62635e6c4ef091c145f64a6eb9228 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 4 Oct 2023 08:49:22 +0000 Subject: [PATCH 241/513] 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 dd020d8ee8..9a155be349 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 04 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 417de0193dd0663100a8b1eaedc2bc4976712c61 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 12:44:00 +0200 Subject: [PATCH 242/513] feat(extras): added extra for dashboard.nvim --- lua/lazyvim/plugins/extras/ui/dashboard.lua | 62 +++++++++++++++++++ .../plugins/extras/ui/mini-starter.lua | 1 + 2 files changed, 63 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/ui/dashboard.lua diff --git a/lua/lazyvim/plugins/extras/ui/dashboard.lua b/lua/lazyvim/plugins/extras/ui/dashboard.lua new file mode 100644 index 0000000000..b9801b7505 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/dashboard.lua @@ -0,0 +1,62 @@ +return { + { "goolord/alpha-nvim", enabled = false }, + { "echasnovski/mini.starter", enabled = false }, + { + "glepnir/dashboard-nvim", + event = "VimEnter", + dependencies = { + -- disable alpha + { "goolord/alpha-nvim", enabled = false }, + }, + opts = function() + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep("\n", 8) .. logo .. "\n\n" + + local opts = { + theme = "doom", + config = { + header = vim.split(logo, "\n"), + center = { + { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, + { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) + end + return opts + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index ee35fc687c..04a578be2b 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -2,6 +2,7 @@ return { -- disable alpha { "goolord/alpha-nvim", enabled = false }, + { "glepnir/dashboard-nvim", enabled = false }, -- enable mini.starter { From 35053290bf957a230c8758d31ba3997c0699f5f9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 12:47:24 +0200 Subject: [PATCH 243/513] fix(ui): use custom fold when treesitter foldtext returns a string --- lua/lazyvim/util/ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 0f96e87a33..92376a5271 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -24,7 +24,7 @@ end function M.foldtext() local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf()) local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext() - if not ret then + if not ret or type(ret) == "string" then ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } } end table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots }) From bd2ac542a0bb4c58237cd6ca8848063bd20a5282 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 12:48:37 +0200 Subject: [PATCH 244/513] feat(ui): show alpha marks in statuscolumn --- lua/lazyvim/util/ui.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 92376a5271..43e2d583b0 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -3,12 +3,26 @@ local M = {} ---@alias Sign {name:string, text:string, texthl:string} ---@return Sign[] -function M.get_signs(win) - local buf = vim.api.nvim_win_get_buf(win) +---@param buf number +---@param lnum number +function M.get_signs(buf, lnum) ---@diagnostic disable-next-line: no-unknown return vim.tbl_map(function(sign) return vim.fn.sign_getdefined(sign.name)[1] - end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs) + end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs) +end + +---@return Sign? +---@param buf number +---@param lnum number +function M.get_mark(buf, lnum) + local marks = vim.fn.getmarklist(buf) + vim.list_extend(marks, vim.fn.getmarklist()) + for _, mark in ipairs(marks) do + if mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then + return { text = mark.mark:sub(2), texthl = "DiagnosticHint" } + end + end end ---@param sign? Sign @@ -45,10 +59,11 @@ function M.statuscolumn() if vim.wo[win].signcolumn == "no" then return "" end + local buf = vim.api.nvim_win_get_buf(win) ---@type Sign?,Sign?,Sign? local left, right, fold - for _, s in ipairs(M.get_signs(win)) do + for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do if s.name:find("GitSign") then right = s elseif not left then @@ -68,7 +83,7 @@ function M.statuscolumn() end return table.concat({ - M.icon(left), + M.icon(M.get_mark(buf, vim.v.lnum) or left), [[%=]], nu .. " ", M.icon(fold or right), From 3833a7d1ce9b65d6cb85a72705670d00bce52e08 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 13:19:12 +0200 Subject: [PATCH 245/513] style: removed dead code --- lua/lazyvim/plugins/extras/vscode.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index 6a457cf15b..6f78fd9f8e 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -18,7 +18,6 @@ local enabled = { } local Config = require("lazy.core.config") -local Plugin = require("lazy.core.plugin") Config.options.checker.enabled = false Config.options.change_detection.enabled = false Config.options.defaults.cond = function(plugin) From 2f16a7b2d96e912c9ab50ce99d9994413ff3678d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 13:43:36 +0200 Subject: [PATCH 246/513] perf(config): add LazyVim to the rtp early for faster spec loading --- lua/lazyvim/config/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 36335f7bc4..feed2dff05 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -227,6 +227,7 @@ M.did_init = false function M.init() if not M.did_init then M.did_init = true + vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir) -- delay notifications till vim.notify was replaced or after 500ms require("lazyvim.util").lazy_notify() From 9f034ab10650e306e178d5189ee9214a52f2e8e5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 14:41:00 +0200 Subject: [PATCH 247/513] fix(conform): dont try to merge formatter functions --- lua/lazyvim/plugins/extras/formatting/conform.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index ee914f8eb7..eb1db8b1fb 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -44,8 +44,10 @@ return { config = function(_, opts) opts.formatters = opts.formatters or {} for f, o in pairs(opts.formatters) do - local ok, formatter = pcall(require, "conform.formatters." .. f) - opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o) + if type(o) ~= "function" then + local ok, formatter = pcall(require, "conform.formatters." .. f) + opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o) + end end require("conform").setup(opts) end, From f4750859f2c2c9a41b3974ac05962ce9648d6c16 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 14:44:24 +0200 Subject: [PATCH 248/513] fix(conform): dont try merging function formatters. Fixes #1582 --- lua/lazyvim/plugins/extras/formatting/conform.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index eb1db8b1fb..b297588221 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -43,10 +43,12 @@ return { }, config = function(_, opts) opts.formatters = opts.formatters or {} - for f, o in pairs(opts.formatters) do - if type(o) ~= "function" then - local ok, formatter = pcall(require, "conform.formatters." .. f) - opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o) + for name, formatter in pairs(opts.formatters) do + if type(formatter) == "table" then + local ok, defaults = pcall(require, "conform.formatters." .. name) + if ok and type(defaults) == "table" then + opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter) + end end end require("conform").setup(opts) From 79010ae671035d8ed0040ce51df4fb59ec3962f8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 14:45:45 +0200 Subject: [PATCH 249/513] fix(nvim-lint): dont try merging function linters --- lua/lazyvim/plugins/extras/linting/nvim-lint.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua index 2d750309a2..1fb7ab5dff 100644 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua @@ -27,7 +27,9 @@ return { local lint = require("lint") for name, linter in pairs(opts.linters) do - lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter) + if type(linter) == "table" and type(lint.linters) == "table" then + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) + end end lint.linters_by_ft = opts.linters_by_ft From c490c61d07b02755a34df188d283550d59a04c2f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:03:00 +0200 Subject: [PATCH 250/513] chore(main): release 9.0.0 (#1576) 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 040cf6b520..c91f01bd39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## [9.0.0](https://github.com/LazyVim/LazyVim/compare/v8.4.4...v9.0.0) (2023-10-04) + + +### ⚠ BREAKING CHANGES + +* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra) + +### Features + +* **extras:** added extra for dashboard.nvim ([417de01](https://github.com/LazyVim/LazyVim/commit/417de0193dd0663100a8b1eaedc2bc4976712c61)) +* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra) ([d28c69e](https://github.com/LazyVim/LazyVim/commit/d28c69e49eab62b45f7d1562b3bc00afee5fbb65)) +* **treesitter:** added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects ([0e66ef8](https://github.com/LazyVim/LazyVim/commit/0e66ef83934eb62ee2237e331dcbc0a22b809aae)) +* **treesitter:** map `vim` to `[@namespace](https://github.com/namespace).builtin` ([5f0713d](https://github.com/LazyVim/LazyVim/commit/5f0713d2b612a814586bffec39700ab6a30dc0ea)) +* **typescript:** add typescriptreact/javascriptreact to types ([#1574](https://github.com/LazyVim/LazyVim/issues/1574)) ([626ae13](https://github.com/LazyVim/LazyVim/commit/626ae1338a88f6cd8962d6c20bd79953a67f0b72)) +* **ui:** show alpha marks in statuscolumn ([bd2ac54](https://github.com/LazyVim/LazyVim/commit/bd2ac542a0bb4c58237cd6ca8848063bd20a5282)) + + +### Bug Fixes + +* **autocmds:** retore last location for correct buffer ([afc8e7f](https://github.com/LazyVim/LazyVim/commit/afc8e7f8cac06335efd12ec5f71cabb1f38a09b0)) +* **conform:** dont try merging function formatters. Fixes [#1582](https://github.com/LazyVim/LazyVim/issues/1582) ([f475085](https://github.com/LazyVim/LazyVim/commit/f4750859f2c2c9a41b3974ac05962ce9648d6c16)) +* **conform:** dont try to merge formatter functions ([9f034ab](https://github.com/LazyVim/LazyVim/commit/9f034ab10650e306e178d5189ee9214a52f2e8e5)) +* **nvim-lint:** dont try merging function linters ([79010ae](https://github.com/LazyVim/LazyVim/commit/79010ae671035d8ed0040ce51df4fb59ec3962f8)) +* **ui:** use custom fold when treesitter foldtext returns a string ([3505329](https://github.com/LazyVim/LazyVim/commit/35053290bf957a230c8758d31ba3997c0699f5f9)) + + +### Performance Improvements + +* added support for `LazyFile` event that properly loads file based plugins without blocking the ui ([936d74b](https://github.com/LazyVim/LazyVim/commit/936d74bb6127721eeefa62e5f697d9693ab04fdd)) +* **config:** add LazyVim to the rtp early for faster spec loading ([2f16a7b](https://github.com/LazyVim/LazyVim/commit/2f16a7b2d96e912c9ab50ce99d9994413ff3678d)) + ## [8.4.4](https://github.com/LazyVim/LazyVim/compare/v8.4.3...v8.4.4) (2023-10-03) From 1abcffbfd940588fa67cc7438ce2115df1c58e92 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 16:44:29 +0200 Subject: [PATCH 251/513] fix(alpha): use `` instead of `:` for shortcuts --- lua/lazyvim/plugins/ui.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 677b902ac6..335cbcb85a 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -296,14 +296,14 @@ return { dashboard.section.header.val = vim.split(logo, "\n") dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", ":Telescope find_files "), - dashboard.button("n", " " .. " New file", ":ene startinsert "), - dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), - dashboard.button("g", " " .. " Find text", ":Telescope live_grep "), - dashboard.button("c", " " .. " Config", ":e $MYVIMRC "), - dashboard.button("s", " " .. " Restore Session", [[:lua require("persistence").load() ]]), - dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy"), - dashboard.button("q", " " .. " Quit", ":qa"), + dashboard.button("f", " " .. " Find file", " Telescope find_files "), + dashboard.button("n", " " .. " New file", " ene startinsert "), + dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), + dashboard.button("g", " " .. " Find text", " Telescope live_grep "), + dashboard.button("c", " " .. " Config", " e $MYVIMRC "), + dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), + dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), + dashboard.button("q", " " .. " Quit", " qa "), } for _, button in ipairs(dashboard.section.buttons.val) do button.opts.hl = "AlphaButtons" From 3849e0150b0a616dbd6e7e12ec5025aff6c81d39 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 17:53:00 +0200 Subject: [PATCH 252/513] fix(ui): show global marks in the correct buffer only --- lua/lazyvim/util/ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 43e2d583b0..d24d423996 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -19,7 +19,7 @@ function M.get_mark(buf, lnum) local marks = vim.fn.getmarklist(buf) vim.list_extend(marks, vim.fn.getmarklist()) for _, mark in ipairs(marks) do - if mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then + if mark.pos[1] == buf and mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then return { text = mark.mark:sub(2), texthl = "DiagnosticHint" } end end From d989ecc943b3240db0be3aa0369b96089cee4b40 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 18:07:21 +0200 Subject: [PATCH 253/513] fix(options): only enable treesitter `foldexpr` on nightly. Fixes #1581 --- lua/lazyvim/config/options.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index c2f3177d40..f1198397f6 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -65,9 +65,13 @@ vim.opt.foldlevel = 99 vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()" if vim.fn.has("nvim-0.9.0") == 1 then + vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] +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.vim.treesitter.foldexpr()" - vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] else vim.opt.foldmethod = "indent" end From b58446f7b3724ae321501a6c0cce6d3abdf1b918 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:09:31 +0200 Subject: [PATCH 254/513] chore(main): release 9.0.1 (#1585) 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 c91f01bd39..b7b7644b51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [9.0.1](https://github.com/LazyVim/LazyVim/compare/v9.0.0...v9.0.1) (2023-10-04) + + +### Bug Fixes + +* **alpha:** use `<cmd>` instead of `:` for shortcuts ([1abcffb](https://github.com/LazyVim/LazyVim/commit/1abcffbfd940588fa67cc7438ce2115df1c58e92)) +* **options:** only enable treesitter `foldexpr` on nightly. Fixes [#1581](https://github.com/LazyVim/LazyVim/issues/1581) ([d989ecc](https://github.com/LazyVim/LazyVim/commit/d989ecc943b3240db0be3aa0369b96089cee4b40)) +* **ui:** show global marks in the correct buffer only ([3849e01](https://github.com/LazyVim/LazyVim/commit/3849e0150b0a616dbd6e7e12ec5025aff6c81d39)) + ## [9.0.0](https://github.com/LazyVim/LazyVim/compare/v8.4.4...v9.0.0) (2023-10-04) From 7272b3e4b5b626597658dabf774998057892d066 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 20:04:56 +0200 Subject: [PATCH 255/513] fix(bufferline): load bufferline on VeryLazy. Fixes #1587 --- 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 335cbcb85a..1df40c92a6 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -53,7 +53,7 @@ return { -- tabs, which include filetype icons and close buttons. { "akinsho/bufferline.nvim", - event = "LazyFile", + event = "VeryLazy", keys = { { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, From 0cc80b1b0594516ccc2c1e6c9a60c84012a29abb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 20:40:11 +0200 Subject: [PATCH 256/513] fix(autocmds): last_loc autocmd didn't work correctly for first opened file --- lua/lazyvim/config/autocmds.lua | 3 +++ lua/lazyvim/config/init.lua | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 7d9feeddbc..e28287261e 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -32,6 +32,9 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { vim.api.nvim_create_autocmd("BufReadPost", { group = augroup("last_loc"), callback = function(event) + if event.data and event.data.lazy_file then + return + end local exclude = { "gitcommit" } local buf = event.buf if vim.tbl_contains(exclude, vim.bo[buf].filetype) then diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index feed2dff05..119d8b4c61 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -168,9 +168,10 @@ function M.lazy_file() pattern = event.pattern, modeline = false, buffer = event.buf, - data = event.data, + data = { lazy_file = true }, }) end + vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) events = {} end From 86de423ef029abd085531e18b197a5f90e201d98 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 21:00:32 +0200 Subject: [PATCH 257/513] fix(treesitter): dont enable ]c, [c, ... in diff-mode --- lua/lazyvim/plugins/treesitter.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index f6d3651948..753cfb7dae 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -10,6 +10,18 @@ return { dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", + config = function() + -- Disable class keymaps in diff mode + vim.api.nvim_create_autocmd("BufReadPost", { + callback = function(event) + if vim.wo.diff then + for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do + pcall(vim.keymap.del, "n", key, { buffer = event.buf }) + end + end + end, + }) + end, }, }, cmd = { "TSUpdateSync" }, From 49b91b6b1fe8a9bc55f643b390a346919f629948 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:10:17 +0200 Subject: [PATCH 258/513] chore(main): release 9.0.2 (#1589) 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 b7b7644b51..b2fbe7fa93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [9.0.2](https://github.com/LazyVim/LazyVim/compare/v9.0.1...v9.0.2) (2023-10-04) + + +### Bug Fixes + +* **autocmds:** last_loc autocmd didn't work correctly for first opened file ([0cc80b1](https://github.com/LazyVim/LazyVim/commit/0cc80b1b0594516ccc2c1e6c9a60c84012a29abb)) +* **bufferline:** load bufferline on VeryLazy. Fixes [#1587](https://github.com/LazyVim/LazyVim/issues/1587) ([7272b3e](https://github.com/LazyVim/LazyVim/commit/7272b3e4b5b626597658dabf774998057892d066)) +* **treesitter:** dont enable ]c, [c, ... in diff-mode ([86de423](https://github.com/LazyVim/LazyVim/commit/86de423ef029abd085531e18b197a5f90e201d98)) + ## [9.0.1](https://github.com/LazyVim/LazyVim/compare/v9.0.0...v9.0.1) (2023-10-04) From d3e7f7717e960bb883b35e9a75badfd5b938cace Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 5 Oct 2023 08:07:53 +0200 Subject: [PATCH 259/513] fix(tailwind): allow overriding filetypes. Fixes #1590 --- lua/lazyvim/plugins/extras/lang/tailwind.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index bed7e6c055..d7d35963c4 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -4,16 +4,30 @@ return { opts = { servers = { tailwindcss = { + -- exclude a filetype from the default_config filetypes_exclude = { "markdown" }, + -- add additional filetypes to the default_config + filetypes_include = {}, + -- to fully override the default_config, change the below + -- filetypes = {} }, }, setup = { tailwindcss = function(_, opts) local tw = require("lspconfig.server_configurations.tailwindcss") + opts.filetypes = opts.filetypes or {} + + -- Add default filetypes + vim.list_extend(opts.filetypes, tw.default_config.filetypes) + + -- Remove excluded filetypes --- @param ft string opts.filetypes = vim.tbl_filter(function(ft) return not vim.tbl_contains(opts.filetypes_exclude or {}, ft) - end, tw.default_config.filetypes) + end, opts.filetypes) + + -- Add additional filetypes + vim.list_extend(opts.filetypes, opts.filetypes_include) end, }, }, From 6f6d58799895e0b76dec7feb241709c494007390 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Oct 2023 06:08:38 +0000 Subject: [PATCH 260/513] 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 9a155be349..d1cb145772 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 04 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 05 ============================================================================== Table of Contents *LazyVim-table-of-contents* From d6b56c075e88ce12e9e16fb2eeeea38fb7853600 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 5 Oct 2023 09:53:48 +0200 Subject: [PATCH 261/513] fix(dasboard): disable alpha only once --- lua/lazyvim/plugins/extras/ui/dashboard.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/dashboard.lua b/lua/lazyvim/plugins/extras/ui/dashboard.lua index b9801b7505..cf7c88601c 100644 --- a/lua/lazyvim/plugins/extras/ui/dashboard.lua +++ b/lua/lazyvim/plugins/extras/ui/dashboard.lua @@ -4,10 +4,6 @@ return { { "glepnir/dashboard-nvim", event = "VimEnter", - dependencies = { - -- disable alpha - { "goolord/alpha-nvim", enabled = false }, - }, opts = function() local logo = [[ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z From 1eb019274b5564e66ac6c7e119c140bae262e10c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 5 Oct 2023 10:43:21 +0200 Subject: [PATCH 262/513] fix(options): set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering --- lua/lazyvim/config/options.lua | 2 +- lua/lazyvim/plugins/ui.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index f1198397f6..de54693f10 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -16,7 +16,7 @@ opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" opt.ignorecase = true -- Ignore case opt.inccommand = "nosplit" -- preview incremental substitute -opt.laststatus = 0 +opt.laststatus = 3 -- global statusline opt.list = true -- Show some invisible characters (tabs... opt.mouse = "a" -- Enable mouse mode opt.number = true -- Print line number diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 1df40c92a6..1e45b9c40e 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -316,6 +316,7 @@ return { return dashboard end, config = function(_, dashboard) + vim.o.laststatus = 0 -- close Lazy and re-open when the dashboard is ready if vim.o.filetype == "lazy" then vim.cmd.close() From 6f1cdfe4bd2ec9a85c92a312fa52ba86e02d1a9f Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Thu, 5 Oct 2023 15:59:44 +0200 Subject: [PATCH 263/513] feat(dashboard): add projects if enabled (#1595) --- lua/lazyvim/plugins/extras/util/project.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 82234c4d7a..d6be2b9c74 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -42,4 +42,17 @@ return { vim.list_extend(opts.items, items) end, }, + { + "glepnir/dashboard-nvim", + optional = true, + opts = function(_, opts) + local projects = { + action = "Telescope projects", + desc = " Projects", + icon = " ", + key = "p", + } + table.insert(opts.config.center, 3, projects) + end, + }, } From f2193646564cd90a3ac7f4a25cd09ddbe751b2f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:03:46 +0200 Subject: [PATCH 264/513] chore(main): release 9.1.0 (#1592) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2fbe7fa93..a40a88cdeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [9.1.0](https://github.com/LazyVim/LazyVim/compare/v9.0.2...v9.1.0) (2023-10-05) + + +### Features + +* **dashboard:** add projects if enabled ([#1595](https://github.com/LazyVim/LazyVim/issues/1595)) ([6f1cdfe](https://github.com/LazyVim/LazyVim/commit/6f1cdfe4bd2ec9a85c92a312fa52ba86e02d1a9f)) + + +### Bug Fixes + +* **dasboard:** disable alpha only once ([d6b56c0](https://github.com/LazyVim/LazyVim/commit/d6b56c075e88ce12e9e16fb2eeeea38fb7853600)) +* **options:** set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering ([1eb0192](https://github.com/LazyVim/LazyVim/commit/1eb019274b5564e66ac6c7e119c140bae262e10c)) +* **tailwind:** allow overriding filetypes. Fixes [#1590](https://github.com/LazyVim/LazyVim/issues/1590) ([d3e7f77](https://github.com/LazyVim/LazyVim/commit/d3e7f7717e960bb883b35e9a75badfd5b938cace)) + ## [9.0.2](https://github.com/LazyVim/LazyVim/compare/v9.0.1...v9.0.2) (2023-10-04) From b2af9412907730068f038e6f642f3c7368c95c30 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 5 Oct 2023 16:33:01 +0200 Subject: [PATCH 265/513] ci: disable blank issues --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..3ba13e0cec --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false From 337cfdbec43003cb2c269e59b27167aa752bf41f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 5 Oct 2023 23:33:44 +0200 Subject: [PATCH 266/513] fix(ui): include extmark signs in signcolumn. Fixes #1596 --- lua/lazyvim/util/ui.lua | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index d24d423996..1cb3b81d57 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,15 +1,44 @@ local M = {} ----@alias Sign {name:string, text:string, texthl:string} +---@alias Sign {name:string, text:string, texthl:string, priority:number} +-- Returns a list of regular and extmark signs sorted by priority (low to high) ---@return Sign[] ---@param buf number ---@param lnum number function M.get_signs(buf, lnum) - ---@diagnostic disable-next-line: no-unknown - return vim.tbl_map(function(sign) - return vim.fn.sign_getdefined(sign.name)[1] + -- Get regular signs + ---@type Sign[] + local signs = vim.tbl_map(function(sign) + ---@type Sign + local ret = vim.fn.sign_getdefined(sign.name)[1] + ret.priority = sign.priority + return ret end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs) + + -- Get extmark signs + local extmarks = vim.api.nvim_buf_get_extmarks( + buf, + -1, + { lnum - 1, 0 }, + { lnum - 1, -1 }, + { details = true, type = "sign" } + ) + for _, extmark in pairs(extmarks) do + signs[#signs + 1] = { + name = extmark[4].sign_hl_group, + text = extmark[4].sign_text, + texthl = extmark[4].sign_hl_group, + priority = extmark[4].priority, + } + end + + -- Sort by priority + table.sort(signs, function(a, b) + return (a.priority or 0) < (b.priority or 0) + end) + + return signs end ---@return Sign? @@ -66,7 +95,7 @@ function M.statuscolumn() for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do if s.name:find("GitSign") then right = s - elseif not left then + else left = s end end From cce46cd6401239f04c6ce98113a3410677c1a82f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 01:02:16 +0200 Subject: [PATCH 267/513] chore(main): release 9.1.1 (#1597) 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 a40a88cdeb..a326204a0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [9.1.1](https://github.com/LazyVim/LazyVim/compare/v9.1.0...v9.1.1) (2023-10-05) + + +### Bug Fixes + +* **ui:** include extmark signs in signcolumn. Fixes [#1596](https://github.com/LazyVim/LazyVim/issues/1596) ([337cfdb](https://github.com/LazyVim/LazyVim/commit/337cfdbec43003cb2c269e59b27167aa752bf41f)) + ## [9.1.0](https://github.com/LazyVim/LazyVim/compare/v9.0.2...v9.1.0) (2023-10-05) From f1ea518e29a601b773d9c9c94489fc9d273c2dea Mon Sep 17 00:00:00 2001 From: Latif Sulistyo Date: Fri, 6 Oct 2023 14:02:45 +0700 Subject: [PATCH 268/513] fix(which-key): change surround group key (#1598) --- lua/lazyvim/plugins/editor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 3f4c5d52b5..526509fc8a 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -282,7 +282,7 @@ return { defaults = { mode = { "n", "v" }, ["g"] = { name = "+goto" }, - ["gz"] = { name = "+surround" }, + ["gs"] = { name = "+surround" }, ["]"] = { name = "+next" }, ["["] = { name = "+prev" }, [""] = { name = "+tabs" }, From 3823f177e93c5370190a4b230818b4ddd8b9bd85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 6 Oct 2023 07:03:24 +0000 Subject: [PATCH 269/513] 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 d1cb145772..2497b44288 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 05 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 06 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 8a1de2b90a699bdfee704f3d4422e2ced18ae0f3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 09:18:04 +0200 Subject: [PATCH 270/513] fix(elixir): only enable credo when installed. Fixes #1546 --- lua/lazyvim/plugins/extras/lang/elixir.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index dbd0e9a715..53454c37a8 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -33,6 +33,9 @@ return { "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) + if vim.fn.executable("credo") == 0 then + return + end local nls = require("null-ls") opts.sources = opts.sources or {} vim.list_extend(opts.sources, { @@ -43,10 +46,13 @@ return { { "mfussenegger/nvim-lint", optional = true, - opts = { - linters_by_ft = { + opts = function(_, opts) + if vim.fn.executable("credo") == 0 then + return + end + opts.linters_by_ft = { elixir = { "credo" }, - }, - }, + } + end, }, } From a1c5886947e20059ad7802e71e0a82b413af6657 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 09:26:14 +0200 Subject: [PATCH 271/513] feat(conform): ignore formatting errors for injected languages and fix condition example --- lua/lazyvim/plugins/extras/formatting/conform.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index b297588221..44f4ba403b 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -33,9 +33,10 @@ return { -- You can also define any custom formatters here. ---@type table formatters = { + injected = { options = { ignore_errors = true } }, -- -- Example of using dprint only when a dprint.json file is present -- dprint = { - -- condition = function(ctx) + -- condition = function(self, ctx) -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] -- end, -- }, From 6e0e01f5b4dd7e97abbb50241a207d36d0ce9cd5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 15:40:27 +0200 Subject: [PATCH 272/513] fix(config): fixed issues related to LazyFile. Fixes #1601 --- lua/lazyvim/config/autocmds.lua | 3 --- lua/lazyvim/config/init.lua | 42 ++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index e28287261e..7d9feeddbc 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -32,9 +32,6 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { vim.api.nvim_create_autocmd("BufReadPost", { group = augroup("last_loc"), callback = function(event) - if event.data and event.data.lazy_file then - return - end local exclude = { "gitcommit" } local buf = event.buf if vim.tbl_contains(exclude, vim.bo[buf].filetype) then diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 119d8b4c61..98ec867cd7 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -2,6 +2,7 @@ local M = {} M.lazy_version = ">=9.1.0" +M.use_lazy_file = true ---@class LazyVimOptions local defaults = { @@ -136,7 +137,10 @@ function M.setup(opts) end, }) - M.lazy_file() + M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil + if M.use_lazy_file then + M.lazy_file() + end require("lazy.core.util").try(function() if type(M.colorscheme) == "function" then @@ -155,31 +159,50 @@ end -- Properly load file based plugins without blocking the UI function M.lazy_file() - local events = {} ---@type {event: string, pattern?: string, buf: number, data?: any}[] + local events = {} ---@type {event: string, buf: number, data?: any}[] local function load() if #events == 0 then return end + local Event = require("lazy.core.handler.event") + local Util = require("lazy.core.util") vim.api.nvim_del_augroup_by_name("lazy_file") + + Util.track({ event = "LazyFile" }) + + ---@type table + local skips = { FileType = Event.get_augroups("FileType") } + for _, event in ipairs(events) do + skips[event.event] = skips[event.event] or Event.get_augroups(event.event) + end + vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) for _, event in ipairs(events) do - vim.api.nvim_exec_autocmds(event.event, { - pattern = event.pattern, - modeline = false, - buffer = event.buf, - data = { lazy_file = true }, + 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", + exclude = skips.FileType, + buf = event.buf, + }) + end end vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) events = {} + Util.track() 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({ "BufReadPost", "BufWritePost", "BufNewFile" }, { + vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { group = vim.api.nvim_create_augroup("lazy_file", { clear = true }), callback = function(event) table.insert(events, event) @@ -251,6 +274,9 @@ function M.init() ) plugin[1] = M.renames[plugin[1]] end + if not M.use_lazy_file and type(plugin) == "table" and plugin.event == "LazyFile" then + plugin.event = { "BufReadPost", "BufNewFile" } + end return add(self, plugin, ...) end From 6b4c872f2dacfd6e445438da460934ff7fb1f9cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:53:13 +0200 Subject: [PATCH 273/513] chore(main): release 9.2.0 (#1600) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a326204a0f..ca4b160fb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [9.2.0](https://github.com/LazyVim/LazyVim/compare/v9.1.1...v9.2.0) (2023-10-06) + + +### Features + +* **conform:** ignore formatting errors for injected languages and fix condition example ([a1c5886](https://github.com/LazyVim/LazyVim/commit/a1c5886947e20059ad7802e71e0a82b413af6657)) + + +### Bug Fixes + +* **config:** fixed issues related to LazyFile. Fixes [#1601](https://github.com/LazyVim/LazyVim/issues/1601) ([6e0e01f](https://github.com/LazyVim/LazyVim/commit/6e0e01f5b4dd7e97abbb50241a207d36d0ce9cd5)) +* **elixir:** only enable credo when installed. Fixes [#1546](https://github.com/LazyVim/LazyVim/issues/1546) ([8a1de2b](https://github.com/LazyVim/LazyVim/commit/8a1de2b90a699bdfee704f3d4422e2ced18ae0f3)) +* **which-key:** change surround group key ([#1598](https://github.com/LazyVim/LazyVim/issues/1598)) ([f1ea518](https://github.com/LazyVim/LazyVim/commit/f1ea518e29a601b773d9c9c94489fc9d273c2dea)) + ## [9.1.1](https://github.com/LazyVim/LazyVim/compare/v9.1.0...v9.1.1) (2023-10-05) From e1f5484c826a5ce4fff74ade82471e4c0b6c9f74 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 18:35:17 +0200 Subject: [PATCH 274/513] refactor: use_lazy_file --- lua/lazyvim/config/init.lua | 44 +++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 98ec867cd7..8af4193e72 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -137,7 +137,6 @@ function M.setup(opts) end, }) - M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil if M.use_lazy_file then M.lazy_file() end @@ -252,6 +251,10 @@ function M.init() if not M.did_init then M.did_init = true vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir) + + ---@diagnostic disable-next-line: undefined-field + M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil + -- delay notifications till vim.notify was replaced or after 500ms require("lazyvim.util").lazy_notify() @@ -263,19 +266,32 @@ function M.init() local add = Plugin.Spec.add ---@diagnostic disable-next-line: duplicate-set-field Plugin.Spec.add = function(self, plugin, ...) - if type(plugin) == "table" and M.renames[plugin[1]] then - require("lazy.core.util").warn( - ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( - plugin[1], - M.renames[plugin[1]], - self.importing or "LazyVim" - ), - { title = "LazyVim" } - ) - plugin[1] = M.renames[plugin[1]] - end - if not M.use_lazy_file and type(plugin) == "table" and plugin.event == "LazyFile" then - plugin.event = { "BufReadPost", "BufNewFile" } + if type(plugin) == "table" then + if M.renames[plugin[1]] then + require("lazy.core.util").warn( + ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( + plugin[1], + M.renames[plugin[1]], + self.importing or "LazyVim" + ), + { title = "LazyVim" } + ) + plugin[1] = M.renames[plugin[1]] + end + if not M.use_lazy_file and plugin.event then + if plugin.event == "LazyFile" then + plugin.event = { "BufReadPost", "BufNewFile" } + elseif type(plugin.event) == "table" then + local events = {} ---@type string[] + for i, event in ipairs(plugin.event) do + if event == "LazyFile" then + vim.list_extend(events, { "BufReadPost", "BufNewFile" }) + else + events[#events + 1] = event + end + end + end + end end return add(self, plugin, ...) end From 54df3e26aca5c5c4da746f210e6f7e7de30673bb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 18:35:53 +0200 Subject: [PATCH 275/513] feat(bufremove): ask to save changes before trying to remove a buffer --- lua/lazyvim/plugins/editor.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 526509fc8a..c26d00d5a3 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -387,9 +387,27 @@ return { -- buffer remove { "echasnovski/mini.bufremove", - -- stylua: ignore + keys = { - { "bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" }, + { + "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)" }, }, }, From 11c9084ec576c8735a87550f7975640eb75e6ff7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 18:43:52 +0200 Subject: [PATCH 276/513] perf(config): only enable LazyFile when opening a file from the cmdline --- lua/lazyvim/config/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 8af4193e72..0f4ce24ea8 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,6 +3,7 @@ local M = {} M.lazy_version = ">=9.1.0" M.use_lazy_file = true +M.lazy_file_events = { "BufReadPost", "BufNewFile" } ---@class LazyVimOptions local defaults = { @@ -168,7 +169,7 @@ function M.lazy_file() local Util = require("lazy.core.util") vim.api.nvim_del_augroup_by_name("lazy_file") - Util.track({ event = "LazyFile" }) + Util.track({ event = "LazyVim.lazy_file" }) ---@type table local skips = { FileType = Event.get_augroups("FileType") } @@ -201,7 +202,7 @@ function M.lazy_file() -- and the UI can continue rendering without blocking load = vim.schedule_wrap(load) - vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { + 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) @@ -252,6 +253,7 @@ function M.init() M.did_init = true vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir) + M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil @@ -280,12 +282,12 @@ function M.init() end if not M.use_lazy_file and plugin.event then if plugin.event == "LazyFile" then - plugin.event = { "BufReadPost", "BufNewFile" } + plugin.event = M.lazy_file_events elseif type(plugin.event) == "table" then local events = {} ---@type string[] - for i, event in ipairs(plugin.event) do + for _, event in ipairs(plugin.event) do if event == "LazyFile" then - vim.list_extend(events, { "BufReadPost", "BufNewFile" }) + vim.list_extend(events, M.lazy_file_events) else events[#events + 1] = event end From d8f4382dd3850550076b33d64a5f455daf7e6450 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 23:06:41 +0200 Subject: [PATCH 277/513] fix(tailwind): nil check for filetypes_include. Fixes #1607 --- lua/lazyvim/plugins/extras/lang/tailwind.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index d7d35963c4..795449ee3f 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -27,7 +27,7 @@ return { end, opts.filetypes) -- Add additional filetypes - vim.list_extend(opts.filetypes, opts.filetypes_include) + vim.list_extend(opts.filetypes, opts.filetypes_include or {}) end, }, }, From 8bcc241b720517d4e61fcdd2021d1e39008f5415 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 23:16:59 +0200 Subject: [PATCH 278/513] chore(main): release 9.3.0 (#1603) 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 ca4b160fb0..cc9c3b5ea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [9.3.0](https://github.com/LazyVim/LazyVim/compare/v9.2.0...v9.3.0) (2023-10-06) + + +### Features + +* **bufremove:** ask to save changes before trying to remove a buffer ([54df3e2](https://github.com/LazyVim/LazyVim/commit/54df3e26aca5c5c4da746f210e6f7e7de30673bb)) + + +### Bug Fixes + +* **tailwind:** nil check for filetypes_include. Fixes [#1607](https://github.com/LazyVim/LazyVim/issues/1607) ([d8f4382](https://github.com/LazyVim/LazyVim/commit/d8f4382dd3850550076b33d64a5f455daf7e6450)) + + +### Performance Improvements + +* **config:** only enable LazyFile when opening a file from the cmdline ([11c9084](https://github.com/LazyVim/LazyVim/commit/11c9084ec576c8735a87550f7975640eb75e6ff7)) + ## [9.2.0](https://github.com/LazyVim/LazyVim/compare/v9.1.1...v9.2.0) (2023-10-06) From fb110e76d86096fd0ad5585537cb7915b6d3cf8d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 6 Oct 2023 23:25:24 +0200 Subject: [PATCH 279/513] docs(conform): conform condition example --- lua/lazyvim/plugins/extras/formatting/conform.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index 44f4ba403b..601967c59d 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -36,7 +36,7 @@ return { injected = { options = { ignore_errors = true } }, -- -- Example of using dprint only when a dprint.json file is present -- dprint = { - -- condition = function(self, ctx) + -- condition = function(ctx) -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] -- end, -- }, From 0fcdbe20daf44f00252668b3866b19ac18b339df Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 7 Oct 2023 11:18:04 +0200 Subject: [PATCH 280/513] fix(ui): properly handly signs without name. Fixes #1612 --- lua/lazyvim/util/ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 1cb3b81d57..66ec4bcaf9 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -26,7 +26,7 @@ function M.get_signs(buf, lnum) ) for _, extmark in pairs(extmarks) do signs[#signs + 1] = { - name = extmark[4].sign_hl_group, + name = extmark[4].sign_hl_group or "", text = extmark[4].sign_text, texthl = extmark[4].sign_hl_group, priority = extmark[4].priority, @@ -93,7 +93,7 @@ function M.statuscolumn() ---@type Sign?,Sign?,Sign? local left, right, fold for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do - if s.name:find("GitSign") then + if s.name and s.name:find("GitSign") then right = s else left = s From 75a26e850970cc1b250cd5b5bc471715ca52a0e4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 7 Oct 2023 09:18:48 +0000 Subject: [PATCH 281/513] 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 2497b44288..ce46050166 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 06 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 07 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 237be9e3a7f5ca8165d4242d47df34d8d407f4cc Mon Sep 17 00:00:00 2001 From: jyuan0 Date: Sat, 7 Oct 2023 05:45:03 -0400 Subject: [PATCH 282/513] fix(rust): explicitly enable nvim-cmp source registration for crates (#1609) --- lua/lazyvim/plugins/extras/lang/rust.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 699ad5631c..1e6e059469 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -7,7 +7,11 @@ return { { "Saecki/crates.nvim", event = { "BufRead Cargo.toml" }, - config = true, + opts = { + src = { + cmp = { enabled = true }, + }, + }, }, }, ---@param opts cmp.ConfigSchema From 1935486ff143dd5cf100b8c89204dc01d8e06021 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 7 Oct 2023 15:06:13 +0200 Subject: [PATCH 283/513] fix(treesitter-textobjects): use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes #1610 --- lua/lazyvim/plugins/treesitter.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 753cfb7dae..ed8bf964e2 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -11,16 +11,26 @@ return { { "nvim-treesitter/nvim-treesitter-textobjects", config = function() - -- Disable class keymaps in diff mode - vim.api.nvim_create_autocmd("BufReadPost", { - callback = function(event) - if vim.wo.diff then - for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do - pcall(vim.keymap.del, "n", key, { buffer = event.buf }) + -- 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 end, }, }, From 862e140a7ad8452cd5a103982687fca63a2f44da Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 7 Oct 2023 15:15:33 +0200 Subject: [PATCH 284/513] fix(config): trigger all buf filetype events on LazyFile --- lua/lazyvim/config/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 0f4ce24ea8..39899750b2 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -172,7 +172,7 @@ function M.lazy_file() Util.track({ event = "LazyVim.lazy_file" }) ---@type table - local skips = { FileType = Event.get_augroups("FileType") } + local skips = {} for _, event in ipairs(events) do skips[event.event] = skips[event.event] or Event.get_augroups(event.event) end @@ -188,7 +188,6 @@ function M.lazy_file() if vim.bo[event.buf].filetype then Event.trigger({ event = "FileType", - exclude = skips.FileType, buf = event.buf, }) end From 8c20e0b5889ed254613dbac26b203130764d9c5f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 15:19:39 +0200 Subject: [PATCH 285/513] chore(main): release 9.3.1 (#1613) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc9c3b5ea5..40e3dd416c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [9.3.1](https://github.com/LazyVim/LazyVim/compare/v9.3.0...v9.3.1) (2023-10-07) + + +### Bug Fixes + +* **config:** trigger all buf filetype events on LazyFile ([862e140](https://github.com/LazyVim/LazyVim/commit/862e140a7ad8452cd5a103982687fca63a2f44da)) +* **rust:** explicitly enable nvim-cmp source registration for crates ([#1609](https://github.com/LazyVim/LazyVim/issues/1609)) ([237be9e](https://github.com/LazyVim/LazyVim/commit/237be9e3a7f5ca8165d4242d47df34d8d407f4cc)) +* **treesitter-textobjects:** use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes [#1610](https://github.com/LazyVim/LazyVim/issues/1610) ([1935486](https://github.com/LazyVim/LazyVim/commit/1935486ff143dd5cf100b8c89204dc01d8e06021)) +* **ui:** properly handly signs without name. Fixes [#1612](https://github.com/LazyVim/LazyVim/issues/1612) ([0fcdbe2](https://github.com/LazyVim/LazyVim/commit/0fcdbe20daf44f00252668b3866b19ac18b339df)) + ## [9.3.0](https://github.com/LazyVim/LazyVim/compare/v9.2.0...v9.3.0) (2023-10-06) From 3c92fa4eb04f827c79c095905ca9391d540fea79 Mon Sep 17 00:00:00 2001 From: Radvil <36059968+radvil@users.noreply.github.com> Date: Sun, 8 Oct 2023 02:42:33 +0800 Subject: [PATCH 286/513] perf(navic): enable lazy_update_context option to update context on "CursorHold" instead of of using default "CursorMove" (#1620) Co-authored-by: Radvil --- 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 1e45b9c40e..7782ee69d5 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -362,6 +362,7 @@ return { highlight = true, depth_limit = 5, icons = require("lazyvim.config").icons.kinds, + lazy_update_context = true, } end, }, From 30d573502a2f9264273a14143e6bddb0b876a391 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 7 Oct 2023 21:07:29 +0200 Subject: [PATCH 287/513] fix(alpha): reset laststatus when alpha unloads. Fixes #1623 --- lua/lazyvim/plugins/ui.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 7782ee69d5..95c00eafc2 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -316,11 +316,13 @@ return { return dashboard end, config = function(_, dashboard) + local laststatus = vim.o.laststatus vim.o.laststatus = 0 -- close Lazy and re-open when the dashboard is ready if vim.o.filetype == "lazy" then vim.cmd.close() vim.api.nvim_create_autocmd("User", { + once = true, pattern = "AlphaReady", callback = function() require("lazy").show() @@ -328,9 +330,18 @@ return { }) end + vim.api.nvim_create_autocmd("BufUnload", { + once = true, + buffer = vim.api.nvim_get_current_buf(), + callback = function() + vim.opt.laststatus = laststatus + end, + }) + require("alpha").setup(dashboard.opts) vim.api.nvim_create_autocmd("User", { + once = true, pattern = "LazyVimStarted", callback = function() local stats = require("lazy").stats() From 9372d78e7e4ed46612de9818868373da81b6f4f1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 7 Oct 2023 21:08:16 +0200 Subject: [PATCH 288/513] feat(nlua): make lua dap keybindings buffer-local --- lua/lazyvim/plugins/extras/dap/nlua.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/nlua.lua b/lua/lazyvim/plugins/extras/dap/nlua.lua index 1d9eb65048..21a9e51dac 100644 --- a/lua/lazyvim/plugins/extras/dap/nlua.lua +++ b/lua/lazyvim/plugins/extras/dap/nlua.lua @@ -6,8 +6,8 @@ return { "jbyuki/one-small-step-for-vimkind", -- stylua: ignore keys = { - { "daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" }, - { "dal", function() require("osv").run_this() end, desc = "Adapter Lua" }, + { "daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server", ft = "lua" }, + { "dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" }, }, config = function() local dap = require("dap") From af9e4528543d98bccce333d39eccc34e433ef6dc Mon Sep 17 00:00:00 2001 From: Andreas Gerlach Date: Sat, 7 Oct 2023 21:09:36 +0200 Subject: [PATCH 289/513] feat(codeium): add codeium extra (#1619) * [feat] add codeium extension * PR comments --- lua/lazyvim/config/init.lua | 1 + lua/lazyvim/plugins/extras/coding/codeium.lua | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/coding/codeium.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 39899750b2..61ea1fd941 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -46,6 +46,7 @@ local defaults = { Array = " ", Boolean = " ", Class = " ", + Codeium = " ", Color = " ", Constant = " ", Constructor = " ", diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua new file mode 100644 index 0000000000..b55c5274cc --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -0,0 +1,25 @@ +return { + + -- codeium + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = {}, + }, + -- codeium cmp source + { + "nvim-cmp", + dependencies = { + { + "Exafunction/codeium.nvim", + }, + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, 1, { name = "codeium", group_index = 2 }) + opts.sorting = opts.sorting or require("cmp.config.default")().sorting + end, + }, + +} From 1bc78272da28821479e98df528d399214a8cdbee Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 10:15:26 +0200 Subject: [PATCH 290/513] feat(keymaps): added support for lazy's per-mode keymap disabling --- lua/lazyvim/config/init.lua | 43 +++++++++++++------ lua/lazyvim/config/keymaps.lua | 10 ++++- lua/lazyvim/plugins/lsp/init.lua | 2 +- lua/lazyvim/plugins/lsp/keymaps.lua | 66 +++++++++++++---------------- 4 files changed, 68 insertions(+), 53 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 61ea1fd941..739d093eff 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -1,7 +1,7 @@ ---@class LazyVimConfig: LazyVimOptions local M = {} -M.lazy_version = ">=9.1.0" +M.lazy_version = ">=10.8.0" M.use_lazy_file = true M.lazy_file_events = { "BufReadPost", "BufNewFile" } @@ -92,33 +92,50 @@ M.renames = { ---@type LazyVimOptions local options +---@param lines {[1]:string, [2]:string}[] +function M.msg(lines) + vim.cmd([[clear]]) + vim.api.nvim_echo(lines, true, {}) + vim.fn.getchar() +end + ---@param opts? LazyVimOptions function M.setup(opts) options = vim.tbl_deep_extend("force", defaults, opts or {}) or {} if vim.fn.has("nvim-0.9.0") == 0 then - vim.api.nvim_echo({ + M.msg({ { "LazyVim requires Neovim >= 0.9.0\n", "ErrorMsg", }, { "Press any key to exit", "MoreMsg" }, - }, true, {}) - - vim.fn.getchar() + }) vim.cmd([[quit]]) return end if not M.has() then - require("lazy.core.util").error( - "**LazyVim** needs **lazy.nvim** version " - .. M.lazy_version - .. " to work properly.\n" - .. "Please upgrade **lazy.nvim**", - { title = "LazyVim" } - ) - error("Exiting") + M.msg({ + { + "LazyVim requires lazy.nvim " .. M.lazy_version .. "\n", + "WarningMsg", + }, + { "Press any key to attempt an upgrade", "MoreMsg" }, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + callback = function() + require("lazy").update({ plugins = { "lazy.nvim" }, wait = true }) + M.msg({ + { + "**lazy.nvim** has been upgraded.\nPlease restart **Neovim**", + "WarningMsg", + }, + }) + end, + }) end -- autocmds can be loaded lazily when not opening a file diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index ff4b4af92c..375f977563 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -4,14 +4,20 @@ local Util = require("lazyvim.util") local function map(mode, lhs, rhs, opts) local keys = require("lazy.core.handler").handlers.keys ---@cast keys LazyKeysHandler + local modes = type(mode) == "string" and { mode } or mode + + modes = vim.tbl_filter(function(mode) + return not (keys.have and keys:have(lhs, mode)) + end, modes) + -- do not create the keymap if a lazy keys handler exists - if not keys.active[keys.parse({ lhs, mode = mode }).id] then + if #modes > 0 then opts = opts or {} opts.silent = opts.silent ~= false if opts.remap and not vim.g.vscode then opts.remap = nil end - vim.keymap.set(mode, lhs, rhs, opts) + vim.keymap.set(modes, lhs, rhs, opts) end end diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 211385f989..ee8393a0c9 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -55,7 +55,7 @@ return { -- mason = false, -- set to false if you don't want this server to be installed with mason -- Use this to add any additional keymaps -- for specific lsp servers - ---@type LazyKeys[] + ---@type LazyKeysSpec[] -- keys = {}, settings = { Lua = { diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 695e6ce859..dd48691a66 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -1,12 +1,16 @@ local M = {} ----@type PluginLspKeys +---@type LazyKeysLspSpec[]|nil M._keys = nil ----@return (LazyKeys|{has?:string})[] +---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string} +---@alias LazyKeysLsp LazyKeys|{has?:string} + +---@return LazyKeysLspSpec[] function M.get() - if not M._keys then - ---@class PluginLspKeys + if M._keys then + return M._keys + end -- stylua: ignore M._keys = { { "cd", vim.diagnostic.open_float, desc = "Line Diagnostics" }, @@ -42,20 +46,19 @@ function M.get() has = "codeAction", } } - if require("lazyvim.util").has("inc-rename.nvim") then - M._keys[#M._keys + 1] = { - "cr", - function() - local inc_rename = require("inc_rename") - return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") - end, - expr = true, - desc = "Rename", - has = "rename", - } - else - M._keys[#M._keys + 1] = { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" } - end + if require("lazyvim.util").has("inc-rename.nvim") then + M._keys[#M._keys + 1] = { + "cr", + function() + local inc_rename = require("inc_rename") + return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") + end, + expr = true, + desc = "Rename", + has = "rename", + } + else + M._keys[#M._keys + 1] = { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" } end return M._keys end @@ -72,34 +75,23 @@ function M.has(buffer, method) return false end +---@return (LazyKeys|{has?:string})[] function M.resolve(buffer) local Keys = require("lazy.core.handler.keys") - local keymaps = {} ---@type table - - local function add(keymap) - local keys = Keys.parse(keymap) - if keys[2] == false then - keymaps[keys.id] = nil - else - keymaps[keys.id] = keys - end + if not Keys.resolve then + return {} end - for _, keymap in ipairs(M.get()) do - add(keymap) - end - + local spec = M.get() local opts = require("lazyvim.util").opts("nvim-lspconfig") local clients = vim.lsp.get_active_clients({ bufnr = buffer }) for _, client in ipairs(clients) do local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} - for _, keymap in ipairs(maps) do - add(keymap) - end + vim.list_extend(spec, maps) end - return keymaps + return Keys.resolve(spec) end -function M.on_attach(client, buffer) +function M.on_attach(_, buffer) local Keys = require("lazy.core.handler.keys") local keymaps = M.resolve(buffer) @@ -110,7 +102,7 @@ function M.on_attach(client, buffer) opts.has = nil opts.silent = opts.silent ~= false opts.buffer = buffer - vim.keymap.set(keys.mode or "n", keys[1], keys[2], opts) + vim.keymap.set(keys.mode or "n", keys.lhs, keys.rhs, opts) end end end From 89d0805fb817b2089c567603fc2cf93afed0912f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 8 Oct 2023 08:16:15 +0000 Subject: [PATCH 291/513] 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 ce46050166..d29b094b09 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 07 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 08 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 0cdc23a51d928202fecf7ff3c8da7dc62c6a501d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:17:20 +0200 Subject: [PATCH 292/513] chore(main): release 9.4.0 (#1622) 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 40e3dd416c..ea72c8e66d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [9.4.0](https://github.com/LazyVim/LazyVim/compare/v9.3.1...v9.4.0) (2023-10-08) + + +### Features + +* **codeium:** add codeium extra ([#1619](https://github.com/LazyVim/LazyVim/issues/1619)) ([af9e452](https://github.com/LazyVim/LazyVim/commit/af9e4528543d98bccce333d39eccc34e433ef6dc)) +* **keymaps:** added support for lazy's per-mode keymap disabling ([1bc7827](https://github.com/LazyVim/LazyVim/commit/1bc78272da28821479e98df528d399214a8cdbee)) +* **nlua:** make lua dap keybindings buffer-local ([9372d78](https://github.com/LazyVim/LazyVim/commit/9372d78e7e4ed46612de9818868373da81b6f4f1)) + + +### Bug Fixes + +* **alpha:** reset laststatus when alpha unloads. Fixes [#1623](https://github.com/LazyVim/LazyVim/issues/1623) ([30d5735](https://github.com/LazyVim/LazyVim/commit/30d573502a2f9264273a14143e6bddb0b876a391)) + + +### Performance Improvements + +* **navic:** enable lazy_update_context option to update context on "CursorHold" instead of of using default "CursorMove" ([#1620](https://github.com/LazyVim/LazyVim/issues/1620)) ([3c92fa4](https://github.com/LazyVim/LazyVim/commit/3c92fa4eb04f827c79c095905ca9391d540fea79)) + ## [9.3.1](https://github.com/LazyVim/LazyVim/compare/v9.3.0...v9.3.1) (2023-10-07) From 25f3587f3f158cb878537112934c7a410d358583 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 10:27:59 +0200 Subject: [PATCH 293/513] refactor(keymaps): move safe keymap.set wrapper to util and add message not to use it in a personal config --- lua/lazyvim/config/keymaps.lua | 22 +++------------------- lua/lazyvim/util/init.lua | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 375f977563..e8307f4568 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -1,25 +1,9 @@ -- This file is automatically loaded by lazyvim.config.init local Util = require("lazyvim.util") -local function map(mode, lhs, rhs, opts) - local keys = require("lazy.core.handler").handlers.keys - ---@cast keys LazyKeysHandler - local modes = type(mode) == "string" and { mode } or mode - - modes = vim.tbl_filter(function(mode) - return not (keys.have and keys:have(lhs, mode)) - end, modes) - - -- do not create the keymap if a lazy keys handler exists - if #modes > 0 then - opts = opts or {} - opts.silent = opts.silent ~= false - if opts.remap and not vim.g.vscode then - opts.remap = nil - end - vim.keymap.set(modes, lhs, rhs, opts) - end -end +-- DO NOT USE THIS IN YOU OWN CONFIG!! +-- use `vim.keymap.set` instead +local map = Util.safe_keymap_set -- better up/down map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 2a2f69f3bc..cd92ac7052 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -320,4 +320,27 @@ function M.on_rename(from, to) end end +-- Wrapper around vim.keymap.set that will +-- not create a keymap if a lazy key handler exists. +-- It will also set `silent` to true by default. +function M.safe_keymap_set(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + local modes = type(mode) == "string" and { mode } or mode + + modes = vim.tbl_filter(function(mode) + return not (keys.have and keys:have(lhs, mode)) + end, modes) + + -- do not create the keymap if a lazy keys handler exists + if #modes > 0 then + opts = opts or {} + opts.silent = opts.silent ~= false + if opts.remap and not vim.g.vscode then + opts.remap = nil + end + vim.keymap.set(modes, lhs, rhs, opts) + end +end + return M From 21ee35f7108f4eefbce84d88a002572b168fc357 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 10:44:17 +0200 Subject: [PATCH 294/513] fix(util): fixed lsp willRenameFiles support check --- 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 cd92ac7052..cceca32212 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -304,7 +304,7 @@ end function M.on_rename(from, to) local clients = vim.lsp.get_active_clients() for _, client in ipairs(clients) do - if client:supports_method("workspace/willRenameFiles") then + if client.supports_method("workspace/willRenameFiles") then local resp = client.request_sync("workspace/willRenameFiles", { files = { { From 6b837e9165a02a334259b87fd251d617cffd9cdc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 10:45:38 +0200 Subject: [PATCH 295/513] style: lua annotations and handle deprecated methods --- lua/lazyvim/plugins/lsp/format.lua | 2 +- lua/lazyvim/plugins/lsp/keymaps.lua | 5 ++--- lua/lazyvim/util/init.lua | 26 +++++++++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 7d1c91092d..f507a38ad0 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -82,7 +82,7 @@ function M.get_formatters(bufnr) } ---@type lsp.Client[] - local clients = vim.lsp.get_active_clients({ bufnr = bufnr }) + local clients = require("lazyvim.util").get_clients({ bufnr = bufnr }) for _, client in ipairs(clients) do if M.supports_format(client) then if (#null_ls > 0 and client.name == "null-ls") or #null_ls == 0 then diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index dd48691a66..ad05b334ba 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -66,7 +66,7 @@ end ---@param method string function M.has(buffer, method) method = method:find("/") and method or "textDocument/" .. method - local clients = vim.lsp.get_active_clients({ bufnr = buffer }) + local clients = require("lazyvim.util").get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do if client.supports_method(method) then return true @@ -83,7 +83,7 @@ function M.resolve(buffer) end local spec = M.get() local opts = require("lazyvim.util").opts("nvim-lspconfig") - local clients = vim.lsp.get_active_clients({ bufnr = buffer }) + local clients = require("lazyvim.util").get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} vim.list_extend(spec, maps) @@ -98,7 +98,6 @@ function M.on_attach(_, buffer) for _, keys in pairs(keymaps) do if not keys.has or M.has(buffer, keys.has) then local opts = Keys.opts(keys) - ---@diagnostic disable-next-line: no-unknown opts.has = nil opts.silent = opts.silent ~= false opts.buffer = buffer diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index cceca32212..ff01a3d0d0 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -8,7 +8,7 @@ M.root_patterns = { ".git", "lua" } function M.on_attach(on_attach) vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) - local buffer = args.buf + local buffer = args.buf ---@type number local client = vim.lsp.get_client_by_id(args.data.client_id) on_attach(client, buffer) end, @@ -22,9 +22,11 @@ end function M.fg(name) ---@type {foreground?:number}? + ---@diagnostic disable-next-line: deprecated local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true) - local fg = hl and hl.fg or hl.foreground - return fg and { fg = string.format("#%06x", fg) } + ---@diagnostic disable-next-line: undefined-field + local fg = hl and (hl.fg or hl.foreground) + return fg and { fg = string.format("#%06x", fg) } or nil end ---@param fn fun() @@ -47,6 +49,8 @@ function M.opts(name) return Plugin.values(plugin, "opts", false) end +M.get_clients = vim.lsp.get_clients or vim.lsp_get_active_clients + -- returns the root directory based on: -- * lsp workspace folders -- * lsp root_dir @@ -60,7 +64,7 @@ function M.get_root() ---@type string[] local roots = {} if path then - for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do + for _, client in pairs(M.get_clients({ bufnr = 0 })) do local workspace = client.config.workspace_folders local paths = workspace and vim.tbl_map(function(ws) return vim.uri_to_fname(ws.uri) @@ -227,7 +231,7 @@ function M.lazy_notify() vim.notify = temp local timer = vim.loop.new_timer() - local check = vim.loop.new_check() + local check = assert(vim.loop.new_check()) local replay = function() timer:stop() @@ -253,6 +257,7 @@ function M.lazy_notify() timer:start(500, 0, replay) end +---@return _.lspconfig.options function M.lsp_get_config(server) local configs = require("lspconfig.configs") return rawget(configs, server) @@ -263,6 +268,7 @@ end function M.lsp_disable(server, cond) local util = require("lspconfig.util") local def = M.lsp_get_config(server) + ---@diagnostic disable-next-line: undefined-field def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir) if cond(root_dir, config) then config.enabled = false @@ -302,9 +308,10 @@ end ---@param from string ---@param to string function M.on_rename(from, to) - local clients = vim.lsp.get_active_clients() + local clients = M.get_clients() for _, client in ipairs(clients) do if client.supports_method("workspace/willRenameFiles") then + ---@diagnostic disable-next-line: invisible local resp = client.request_sync("workspace/willRenameFiles", { files = { { @@ -312,7 +319,7 @@ function M.on_rename(from, to) newUri = vim.uri_from_fname(to), }, }, - }, 1000) + }, 1000, 0) if resp and resp.result ~= nil then vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) end @@ -328,8 +335,9 @@ function M.safe_keymap_set(mode, lhs, rhs, opts) ---@cast keys LazyKeysHandler local modes = type(mode) == "string" and { mode } or mode - modes = vim.tbl_filter(function(mode) - return not (keys.have and keys:have(lhs, mode)) + ---@param m string + modes = vim.tbl_filter(function(m) + return not (keys.have and keys:have(lhs, m)) end, modes) -- do not create the keymap if a lazy keys handler exists From 4e0a05808cb0997e0ac7d939421f68e9dfa5d74d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 11:33:03 +0200 Subject: [PATCH 296/513] fix(config): dont append LazyVim early to the rtp when bootstrapping --- lua/lazyvim/config/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 739d093eff..0fb7ad673d 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -268,7 +268,10 @@ M.did_init = false function M.init() if not M.did_init then M.did_init = true - vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir) + local plugin = require("lazy.core.config").spec.plugins.LazyVim + if plugin then + vim.opt.rtp:append(plugin.dir) + end M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field From 6e3fb589d5aeb12f46fedf70dcd8c14e21afb8cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:42:13 +0200 Subject: [PATCH 297/513] chore(main): release 9.4.1 (#1628) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea72c8e66d..0683eac80e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [9.4.1](https://github.com/LazyVim/LazyVim/compare/v9.4.0...v9.4.1) (2023-10-08) + + +### Bug Fixes + +* **config:** dont append LazyVim early to the rtp when bootstrapping ([4e0a058](https://github.com/LazyVim/LazyVim/commit/4e0a05808cb0997e0ac7d939421f68e9dfa5d74d)) +* **util:** fixed lsp willRenameFiles support check ([21ee35f](https://github.com/LazyVim/LazyVim/commit/21ee35f7108f4eefbce84d88a002572b168fc357)) + ## [9.4.0](https://github.com/LazyVim/LazyVim/compare/v9.3.1...v9.4.0) (2023-10-08) From c9bbb922e58b223d49785cddbed2feeea536237e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 12:37:59 +0200 Subject: [PATCH 298/513] feat(treesitter): add diff, jsonc and yaml by default --- lua/lazyvim/plugins/treesitter.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index ed8bf964e2..65b84c1762 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -46,10 +46,12 @@ return { ensure_installed = { "bash", "c", + "diff", "html", "javascript", "jsdoc", "json", + "jsonc", "lua", "luadoc", "luap", @@ -58,6 +60,7 @@ return { "python", "query", "regex", + "toml", "tsx", "typescript", "vim", From eebdceca1723801e1889d2a65bd676d17139fc6c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 12:55:50 +0200 Subject: [PATCH 299/513] fix(util): fixup typo vim.lsp.get_active_clients --- 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 ff01a3d0d0..12b3c40957 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -49,7 +49,7 @@ function M.opts(name) return Plugin.values(plugin, "opts", false) end -M.get_clients = vim.lsp.get_clients or vim.lsp_get_active_clients +M.get_clients = vim.lsp.get_clients or vim.lsp.get_active_clients -- returns the root directory based on: -- * lsp workspace folders From 80e66963431e235baea04998384c41b0244c1f7e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:58:53 +0200 Subject: [PATCH 300/513] chore(main): release 9.5.0 (#1631) 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 0683eac80e..02bfe9b173 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [9.5.0](https://github.com/LazyVim/LazyVim/compare/v9.4.1...v9.5.0) (2023-10-08) + + +### Features + +* **treesitter:** add diff, jsonc and yaml by default ([c9bbb92](https://github.com/LazyVim/LazyVim/commit/c9bbb922e58b223d49785cddbed2feeea536237e)) + + +### Bug Fixes + +* **util:** fixup typo vim.lsp.get_active_clients ([eebdcec](https://github.com/LazyVim/LazyVim/commit/eebdceca1723801e1889d2a65bd676d17139fc6c)) + ## [9.4.1](https://github.com/LazyVim/LazyVim/compare/v9.4.0...v9.4.1) (2023-10-08) From 639a6e7545830602c09711b3757a28537baf8e75 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 13:45:54 +0200 Subject: [PATCH 301/513] feat(extra): add extra `util.dot` that configures multiple ft and treesitter langs when needed --- lua/lazyvim/plugins/extras/util/dot.lua | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/util/dot.lua diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua new file mode 100644 index 0000000000..159c942124 --- /dev/null +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -0,0 +1,62 @@ +---@type string +local xdg_config = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config" + +---@param path string +local function have(path) + return vim.loop.fs_stat(xdg_config .. "/" .. path) ~= nil +end + +return { + + -- Add Hyprland Parser + { + "luckasRanarison/tree-sitter-hypr", + enabled = have("hypr"), + event = "BufRead */hypr/*.conf", + config = function() + -- Fix ft detection for hyprland + vim.filetype.add({ + pattern = { [".*/hypr/.*%.conf"] = "hypr" }, + }) + require("nvim-treesitter.parsers").get_parser_configs().hypr = { + install_info = { + url = "https://github.com/luckasRanarison/tree-sitter-hypr", + files = { "src/parser.c" }, + branch = "master", + }, + filetype = "hypr", + } + end, + }, + + -- add some stuff to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + local function add(lang) + if type(opts.ensure_installed) ~= "table" then + table.insert(opts.ensure_installed, lang) + end + end + + vim.filetype.add({ + extension = { rasi = "rasi" }, + pattern = { + [".*/waybar/config"] = "jsonc", + [".*/mako/config"] = "dosini", + [".*/kitty/*.conf"] = "bash", + }, + }) + + add("git_config") + + if have("fish") then + add("fish") + end + + if have("rofi") or have("wofi") then + add("rasi") + end + end, + }, +} From e11a3cbe800a1216062f7cefd25827f6fdad9daa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 15:17:50 +0200 Subject: [PATCH 302/513] fix(config): trigger LazyFile additionally on BufWritePre for saving unnamed files --- lua/lazyvim/config/init.lua | 2 +- lua/lazyvim/plugins/treesitter.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 0fb7ad673d..9afe1c5a7e 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local M = {} M.lazy_version = ">=10.8.0" M.use_lazy_file = true -M.lazy_file_events = { "BufReadPost", "BufNewFile" } +M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } ---@class LazyVimOptions local defaults = { diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 65b84c1762..c06adbf0f5 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -40,6 +40,7 @@ return { { "", desc = "Decrement selection", mode = "x" }, }, ---@type TSConfig + ---@diagnostic disable-next-line: missing-fields opts = { highlight = { enable = true }, indent = { enable = true }, From 33c677a55e97ee115ad7050856856df7cd96b3e1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 19:29:00 +0200 Subject: [PATCH 303/513] fix(yaml): yaml schemas are a dict, not a list, so merge properly. Fixes #1636 --- lua/lazyvim/plugins/extras/lang/yaml.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 51f3d8246d..fdfba40481 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -35,8 +35,11 @@ return { }, -- lazy-load schemastore when needed on_new_config = function(new_config) - new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {} - vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas()) + new_config.settings.yaml.schemas = vim.tbl_deep_extend( + "force", + new_config.settings.yaml.schemas or {}, + require("schemastore").yaml.schemas() + ) end, settings = { redhat = { telemetry = { enabled = false } }, From 3f67ac3c739968f85ff0293666fc75f61ecffb5e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Oct 2023 19:53:20 +0200 Subject: [PATCH 304/513] chore(main): release 9.6.0 (#1632) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02bfe9b173..174f4466cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [9.6.0](https://github.com/LazyVim/LazyVim/compare/v9.5.0...v9.6.0) (2023-10-08) + + +### Features + +* **extra:** add extra `util.dot` that configures multiple ft and treesitter langs when needed ([639a6e7](https://github.com/LazyVim/LazyVim/commit/639a6e7545830602c09711b3757a28537baf8e75)) + + +### Bug Fixes + +* **config:** trigger LazyFile additionally on BufWritePre for saving unnamed files ([e11a3cb](https://github.com/LazyVim/LazyVim/commit/e11a3cbe800a1216062f7cefd25827f6fdad9daa)) +* **yaml:** yaml schemas are a dict, not a list, so merge properly. Fixes [#1636](https://github.com/LazyVim/LazyVim/issues/1636) ([33c677a](https://github.com/LazyVim/LazyVim/commit/33c677a55e97ee115ad7050856856df7cd96b3e1)) + ## [9.5.0](https://github.com/LazyVim/LazyVim/compare/v9.4.1...v9.5.0) (2023-10-08) From 1eac633c4f0621d5bd07db1ab7d563db5b342e82 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 20:22:47 +0200 Subject: [PATCH 305/513] perf(util): closure for get_clients to prevent loading vim.lsp cascade early --- lua/lazyvim/util/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 12b3c40957..ffa6df47e0 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -3,6 +3,10 @@ local Util = require("lazy.core.util") local M = {} M.root_patterns = { ".git", "lua" } +function M.get_clients(...) + local fn = vim.lsp.get_clients or vim.lsp.get_active_clients + return fn(...) +end ---@param on_attach fun(client, buffer) function M.on_attach(on_attach) @@ -49,8 +53,6 @@ function M.opts(name) return Plugin.values(plugin, "opts", false) end -M.get_clients = vim.lsp.get_clients or vim.lsp.get_active_clients - -- returns the root directory based on: -- * lsp workspace folders -- * lsp root_dir From 51e25a94b4ff2339028bdded993756360145d1b3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 20:23:22 +0200 Subject: [PATCH 306/513] fix(plugins): make sure init specs are loaded first --- lua/lazyvim/plugins/{core.lua => init.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lua/lazyvim/plugins/{core.lua => init.lua} (100%) diff --git a/lua/lazyvim/plugins/core.lua b/lua/lazyvim/plugins/init.lua similarity index 100% rename from lua/lazyvim/plugins/core.lua rename to lua/lazyvim/plugins/init.lua From 502d32490b29e7f52b2941cfa6a306b45633d63e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 20:23:49 +0200 Subject: [PATCH 307/513] fix(options): set sessionoptions the same as persistence --- lua/lazyvim/config/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index de54693f10..2e7e07c9f5 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -24,7 +24,7 @@ opt.pumblend = 10 -- Popup blend opt.pumheight = 10 -- Maximum number of entries in a popup opt.relativenumber = true -- Relative line numbers opt.scrolloff = 4 -- Lines of context -opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } +opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" } opt.shiftround = true -- Round indent opt.shiftwidth = 2 -- Size of an indent opt.shortmess:append({ W = true, I = true, c = true, C = true }) From de93848f584b3443204247f49b405b81b0a3d4c1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 22:32:03 +0200 Subject: [PATCH 308/513] fix(cmp): properly set cmp `group_index` to fix issues with copilot and other sources (#1639) --- lua/lazyvim/plugins/coding.lua | 12 ++++++------ lua/lazyvim/plugins/extras/coding/codeium.lua | 3 +-- lua/lazyvim/plugins/extras/coding/copilot.lua | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 122187f82c..511a3e7f70 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -67,12 +67,12 @@ return { select = true, }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }), + sources = { + { name = "nvim_lsp", group_index = 1 }, + { name = "luasnip", group_index = 1 }, + { name = "buffer", group_index = 2 }, + { name = "path", group_index = 2 }, + }, formatting = { format = function(_, item) local icons = require("lazyvim.config").icons.kinds diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index b55c5274cc..823568d391 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -17,9 +17,8 @@ return { }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - table.insert(opts.sources, 1, { name = "codeium", group_index = 2 }) + table.insert(opts.sources, 1, { name = "codeium", group_index = 1 }) opts.sorting = opts.sorting or require("cmp.config.default")().sorting end, }, - } diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index bed0d4e9c3..61989a0c95 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -70,7 +70,7 @@ return { }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - table.insert(opts.sources, 1, { name = "copilot", group_index = 2 }) + table.insert(opts.sources, 1, { name = "copilot", group_index = 1 }) opts.sorting = opts.sorting or require("cmp.config.default")().sorting table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize) end, From 5219cad564152337d5d48572466ac976f300a557 Mon Sep 17 00:00:00 2001 From: Markis Taylor Date: Sun, 8 Oct 2023 16:34:06 -0400 Subject: [PATCH 309/513] feat(black): added an extra for black with none-ls & conform.nvim (#1245) * feat(black): added an extra for black with null-ls * fix: update to none-ls/conform --- .../plugins/extras/formatting/black.lua | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/formatting/black.lua diff --git a/lua/lazyvim/plugins/extras/formatting/black.lua b/lua/lazyvim/plugins/extras/formatting/black.lua new file mode 100644 index 0000000000..d153be539b --- /dev/null +++ b/lua/lazyvim/plugins/extras/formatting/black.lua @@ -0,0 +1,25 @@ +return { + { + "williamboman/mason.nvim", + opts = function(_, opts) + table.insert(opts.ensure_installed, "black") + end, + }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + table.insert(opts.sources, nls.builtins.formatting.black) + end, + }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ["python"] = { { "blackd", "black" } }, + }, + }, + }, +} From 838ce85ad6ae2dc2fa1d7518b0c5eb1eb8fe29b2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 22:59:50 +0200 Subject: [PATCH 310/513] fix(bufferline): fix bufferline when restoring a session --- lua/lazyvim/plugins/ui.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 95c00eafc2..1d95448491 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -82,6 +82,17 @@ return { }, }, }, + config = function(_, opts) + require("bufferline").setup(opts) + -- Fix bufferline when restoring a session + vim.api.nvim_create_autocmd("BufAdd", { + callback = function() + vim.schedule(function() + pcall(nvim_bufferline) + end) + end, + }) + end, }, -- statusline From dd55cbdc99021267bee8260c224582a053552dfe Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 8 Oct 2023 23:27:46 +0200 Subject: [PATCH 311/513] fix(lualine): only show statusline as soon as lualine loads --- lua/lazyvim/plugins/extras/ui/dashboard.lua | 6 ++++++ lua/lazyvim/plugins/ui.lua | 16 ++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/dashboard.lua b/lua/lazyvim/plugins/extras/ui/dashboard.lua index cf7c88601c..23d208e6ff 100644 --- a/lua/lazyvim/plugins/extras/ui/dashboard.lua +++ b/lua/lazyvim/plugins/extras/ui/dashboard.lua @@ -18,6 +18,11 @@ return { local opts = { theme = "doom", + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, config = { header = vim.split(logo, "\n"), center = { @@ -52,6 +57,7 @@ return { end, }) end + return opts end, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 1d95448491..bec52d6916 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -99,10 +99,16 @@ return { { "nvim-lualine/lualine.nvim", event = "VeryLazy", + init = function() + vim.g.lualine_laststatus = vim.o.laststatus + vim.o.laststatus = 0 + end, opts = function() local icons = require("lazyvim.config").icons local Util = require("lazyvim.util") + vim.o.laststatus = vim.g.lualine_laststatus + return { options = { theme = "auto", @@ -327,8 +333,6 @@ return { return dashboard end, config = function(_, dashboard) - local laststatus = vim.o.laststatus - vim.o.laststatus = 0 -- close Lazy and re-open when the dashboard is ready if vim.o.filetype == "lazy" then vim.cmd.close() @@ -341,14 +345,6 @@ return { }) end - vim.api.nvim_create_autocmd("BufUnload", { - once = true, - buffer = vim.api.nvim_get_current_buf(), - callback = function() - vim.opt.laststatus = laststatus - end, - }) - require("alpha").setup(dashboard.opts) vim.api.nvim_create_autocmd("User", { From eddd3af3512133f22eb26dda81c3c6f871453276 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 00:06:58 +0200 Subject: [PATCH 312/513] feat(cmp): added custom comparator to prioritize AI sources like copilot and codeium --- lua/lazyvim/plugins/coding.lua | 20 +++++++++++++++++++ lua/lazyvim/plugins/extras/coding/codeium.lua | 2 +- lua/lazyvim/plugins/extras/coding/copilot.lua | 3 +-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 511a3e7f70..8ef48f16dc 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -45,6 +45,26 @@ return { vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") local defaults = require("cmp.config.default")() + + -- LazyVim extension to prioritise certain sources + defaults.sorting.primary = {} + + ---@param entry Cmp.Entry + local function is_primary(entry) + local config = require("cmp.config").global + return vim.tbl_contains(config.sorting.primary or {}, entry.source:get_debug_name()) + end + + table.insert(defaults.sorting.comparators, 1, function(a, b) + local aa = is_primary(a) + local bb = is_primary(b) + if aa and not bb then + return true + end + if not aa and bb then + return false + end + end) return { completion = { completeopt = "menu,menuone,noinsert", diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index 823568d391..13f43cc0cb 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -18,7 +18,7 @@ return { ---@param opts cmp.ConfigSchema opts = function(_, opts) table.insert(opts.sources, 1, { name = "codeium", group_index = 1 }) - opts.sorting = opts.sorting or require("cmp.config.default")().sorting + table.insert(opts.sorting.primary, "codeium") end, }, } diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 61989a0c95..16534f7917 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -71,8 +71,7 @@ return { ---@param opts cmp.ConfigSchema opts = function(_, opts) table.insert(opts.sources, 1, { name = "copilot", group_index = 1 }) - opts.sorting = opts.sorting or require("cmp.config.default")().sorting - table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize) + table.insert(opts.sorting.primary, "copilot") end, }, } From 302c1ff66e5b1d7bbe95f29e81c2d642e2cd4468 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 08:25:02 +0200 Subject: [PATCH 313/513] feat(codeium): use actual codeium icon --- lua/lazyvim/config/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 9afe1c5a7e..8d01fef4ef 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -46,7 +46,7 @@ local defaults = { Array = " ", Boolean = " ", Class = " ", - Codeium = " ", + Codeium = "󰘦 ", Color = " ", Constant = " ", Constructor = " ", From bff3a996971c1f526eb893d8e778daa19a4245b5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 09:12:29 +0200 Subject: [PATCH 314/513] feat(cmp): removed priority comparator in favor of source priorities for copilot/codeium --- lua/lazyvim/plugins/coding.lua | 20 ------------------- lua/lazyvim/plugins/extras/coding/codeium.lua | 19 +++++++++--------- lua/lazyvim/plugins/extras/coding/copilot.lua | 7 +++++-- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 8ef48f16dc..511a3e7f70 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -45,26 +45,6 @@ return { vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") local defaults = require("cmp.config.default")() - - -- LazyVim extension to prioritise certain sources - defaults.sorting.primary = {} - - ---@param entry Cmp.Entry - local function is_primary(entry) - local config = require("cmp.config").global - return vim.tbl_contains(config.sorting.primary or {}, entry.source:get_debug_name()) - end - - table.insert(defaults.sorting.comparators, 1, function(a, b) - local aa = is_primary(a) - local bb = is_primary(b) - if aa and not bb then - return true - end - if not aa and bb then - return false - end - end) return { completion = { completeopt = "menu,menuone,noinsert", diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index 13f43cc0cb..d809ab857e 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -1,24 +1,25 @@ return { - -- codeium - { - "Exafunction/codeium.nvim", - cmd = "Codeium", - build = ":Codeium Auth", - opts = {}, - }, -- codeium cmp source { "nvim-cmp", dependencies = { + -- codeium { "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = {}, }, }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - table.insert(opts.sources, 1, { name = "codeium", group_index = 1 }) - table.insert(opts.sorting.primary, "codeium") + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) end, }, + } diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 16534f7917..708446ed2b 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -70,8 +70,11 @@ return { }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - table.insert(opts.sources, 1, { name = "copilot", group_index = 1 }) - table.insert(opts.sorting.primary, "copilot") + table.insert(opts.sources, 1, { + name = "copilot", + group_index = 1, + priority = 100, + }) end, }, } From 22271cdbbc80277d0fff4ef1b5af41e17c7957de Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 09:12:48 +0200 Subject: [PATCH 315/513] refactor(copilot): dont use deprecated get_clients --- lua/lazyvim/plugins/extras/coding/copilot.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 708446ed2b..3863091741 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -33,7 +33,13 @@ return { return icon .. (status.message or "") end, cond = function() - local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 }) + if not package.loaded["copilot"] then + return + end + local ok, clients = pcall(require("lazyvim.util").get_clients, { name = "copilot", bufnr = 0 }) + if not ok then + return false + end return ok and #clients > 0 end, color = function() From b05783de8c518c8a6e5c3f648448c3a6f00d0050 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 09:13:14 +0200 Subject: [PATCH 316/513] feat(codeium): added lualine component with codeium status similar to copilot --- lua/lazyvim/plugins/extras/coding/codeium.lua | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index d809ab857e..f8d4c671ac 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -22,4 +22,48 @@ return { end, }, + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + local started = false + local function status() + if not package.loaded["cmp"] then + return + end + for _, s in ipairs(require("cmp").core.sources) do + if s.name == "codeium" then + if s.source:is_available() then + started = true + else + return started and "error" or nil + end + if s.status == s.SourceStatus.FETCHING then + return "pending" + end + return "ok" + end + end + end + + local Util = require("lazyvim.util") + local colors = { + ok = Util.fg("Special"), + error = Util.fg("DiagnosticError"), + pending = Util.fg("DiagnosticWarn"), + } + table.insert(opts.sections.lualine_x, 2, { + function() + return require("lazyvim.config").icons.kinds.Codeium + end, + cond = function() + return status() ~= nil + end, + color = function() + return colors[status()] or colors.ok + end, + }) + end, + }, } From cc8397ade365b9e9c4f41d071be5c72ede919409 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Oct 2023 07:14:25 +0000 Subject: [PATCH 317/513] 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 d29b094b09..ba1cbc6c36 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 08 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 09 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 177985842665921e11f9e9813348fd6bef852e27 Mon Sep 17 00:00:00 2001 From: jyuan0 Date: Mon, 9 Oct 2023 03:15:15 -0400 Subject: [PATCH 318/513] fix(black): remove unknown blackd from conform (#1640) --- lua/lazyvim/plugins/extras/formatting/black.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/formatting/black.lua b/lua/lazyvim/plugins/extras/formatting/black.lua index d153be539b..bfa383a849 100644 --- a/lua/lazyvim/plugins/extras/formatting/black.lua +++ b/lua/lazyvim/plugins/extras/formatting/black.lua @@ -18,7 +18,7 @@ return { optional = true, opts = { formatters_by_ft = { - ["python"] = { { "blackd", "black" } }, + ["python"] = { "black" }, }, }, }, From efbe4e57937f8540f0cc69bab0bdffec18338e02 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:18:33 +0200 Subject: [PATCH 319/513] chore(main): release 9.7.0 (#1638) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 174f4466cf..1c7d4e4d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## [9.7.0](https://github.com/LazyVim/LazyVim/compare/v9.6.0...v9.7.0) (2023-10-09) + + +### Features + +* **black:** added an extra for black with none-ls & conform.nvim ([#1245](https://github.com/LazyVim/LazyVim/issues/1245)) ([5219cad](https://github.com/LazyVim/LazyVim/commit/5219cad564152337d5d48572466ac976f300a557)) +* **cmp:** added custom comparator to prioritize AI sources like copilot and codeium ([eddd3af](https://github.com/LazyVim/LazyVim/commit/eddd3af3512133f22eb26dda81c3c6f871453276)) +* **cmp:** removed priority comparator in favor of source priorities for copilot/codeium ([bff3a99](https://github.com/LazyVim/LazyVim/commit/bff3a996971c1f526eb893d8e778daa19a4245b5)) +* **codeium:** added lualine component with codeium status similar to copilot ([b05783d](https://github.com/LazyVim/LazyVim/commit/b05783de8c518c8a6e5c3f648448c3a6f00d0050)) +* **codeium:** use actual codeium icon ([302c1ff](https://github.com/LazyVim/LazyVim/commit/302c1ff66e5b1d7bbe95f29e81c2d642e2cd4468)) + + +### Bug Fixes + +* **black:** remove unknown blackd from conform ([#1640](https://github.com/LazyVim/LazyVim/issues/1640)) ([1779858](https://github.com/LazyVim/LazyVim/commit/177985842665921e11f9e9813348fd6bef852e27)) +* **bufferline:** fix bufferline when restoring a session ([838ce85](https://github.com/LazyVim/LazyVim/commit/838ce85ad6ae2dc2fa1d7518b0c5eb1eb8fe29b2)) +* **cmp:** properly set cmp `group_index` to fix issues with copilot and other sources ([#1639](https://github.com/LazyVim/LazyVim/issues/1639)) ([de93848](https://github.com/LazyVim/LazyVim/commit/de93848f584b3443204247f49b405b81b0a3d4c1)) +* **lualine:** only show statusline as soon as lualine loads ([dd55cbd](https://github.com/LazyVim/LazyVim/commit/dd55cbdc99021267bee8260c224582a053552dfe)) +* **options:** set sessionoptions the same as persistence ([502d324](https://github.com/LazyVim/LazyVim/commit/502d32490b29e7f52b2941cfa6a306b45633d63e)) +* **plugins:** make sure init specs are loaded first ([51e25a9](https://github.com/LazyVim/LazyVim/commit/51e25a94b4ff2339028bdded993756360145d1b3)) + + +### Performance Improvements + +* **util:** closure for get_clients to prevent loading vim.lsp cascade early ([1eac633](https://github.com/LazyVim/LazyVim/commit/1eac633c4f0621d5bd07db1ab7d563db5b342e82)) + ## [9.6.0](https://github.com/LazyVim/LazyVim/compare/v9.5.0...v9.6.0) (2023-10-08) From d894556c375c1c2398f170c21f9323c9c1eba9d4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 09:51:53 +0200 Subject: [PATCH 320/513] feat(cmp): ctrl+CR will abort cmp and enter a new line --- lua/lazyvim/plugins/coding.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 511a3e7f70..c65158028e 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -66,6 +66,10 @@ return { behavior = cmp.ConfirmBehavior.Replace, select = true, }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + cmp.abort() + fallback() + end, }), sources = { { name = "nvim_lsp", group_index = 1 }, From 0a05888d992b37749f9aae25c7f63f2534ec1024 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 10:05:57 +0200 Subject: [PATCH 321/513] fix(cmp): set default group_index to 1 to prevent issues with custom sources --- lua/lazyvim/plugins/coding.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index c65158028e..c657143341 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -71,12 +71,13 @@ return { fallback() end, }), - sources = { - { name = "nvim_lsp", group_index = 1 }, - { name = "luasnip", group_index = 1 }, - { name = "buffer", group_index = 2 }, - { name = "path", group_index = 2 }, - }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), formatting = { format = function(_, item) local icons = require("lazyvim.config").icons.kinds @@ -94,6 +95,13 @@ return { sorting = defaults.sorting, } end, + ---@param opts cmp.ConfigSchema + config = function(_, opts) + for _, source in ipairs(opts.sources) do + source.group_index = source.group_index or 1 + end + require("cmp").setup(opts) + end, }, -- auto pairs From 4fe7ccae73b0924b48dd16d26bb1f89a643adc54 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 11:34:23 +0200 Subject: [PATCH 322/513] build(format): sort requires --- stylua.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stylua.toml b/stylua.toml index 5d6c50dce9..9732fe647a 100644 --- a/stylua.toml +++ b/stylua.toml @@ -1,3 +1,6 @@ indent_type = "Spaces" indent_width = 2 -column_width = 120 \ No newline at end of file +column_width = 120 +[sort_requires] +enabled = true + From 2c658a374dc9f25ff779605e62572b09130f4801 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 11:34:58 +0200 Subject: [PATCH 323/513] style(cmp): dont include cmp-nvim-lsp as a dep of lspconfig --- lua/lazyvim/plugins/lsp/init.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index ee8393a0c9..bdef1a744c 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -8,12 +8,6 @@ return { { "folke/neodev.nvim", opts = {} }, "mason.nvim", "williamboman/mason-lspconfig.nvim", - { - "hrsh7th/cmp-nvim-lsp", - cond = function() - return require("lazyvim.util").has("nvim-cmp") - end, - }, }, ---@class PluginLspOpts opts = { From 2abb5907efe1dbb6da731a907dd4555958eb91c7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 12:49:09 +0200 Subject: [PATCH 324/513] style(config): added tracking for colorscheme --- lua/lazyvim/config/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 8d01fef4ef..c0319dcf9a 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -1,3 +1,5 @@ +local Util = require("lazy.core.util") + ---@class LazyVimConfig: LazyVimOptions local M = {} @@ -160,7 +162,8 @@ function M.setup(opts) M.lazy_file() end - require("lazy.core.util").try(function() + Util.track("colorscheme") + Util.try(function() if type(M.colorscheme) == "function" then M.colorscheme() else @@ -169,10 +172,11 @@ function M.setup(opts) end, { msg = "Could not load your colorscheme", on_error = function(msg) - require("lazy.core.util").error(msg) + Util.error(msg) vim.cmd.colorscheme("habamax") end, }) + Util.track() end -- Properly load file based plugins without blocking the UI @@ -184,7 +188,6 @@ function M.lazy_file() return end local Event = require("lazy.core.handler.event") - local Util = require("lazy.core.util") vim.api.nvim_del_augroup_by_name("lazy_file") Util.track({ event = "LazyVim.lazy_file" }) @@ -236,7 +239,6 @@ end ---@param name "autocmds" | "options" | "keymaps" function M.load(name) - local Util = require("lazy.core.util") local function _load(mod) Util.try(function() require(mod) @@ -290,7 +292,7 @@ function M.init() Plugin.Spec.add = function(self, plugin, ...) if type(plugin) == "table" then if M.renames[plugin[1]] then - require("lazy.core.util").warn( + Util.warn( ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( plugin[1], M.renames[plugin[1]], From 9670c8a400100d38e15c9662f488232508bfb1bb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 12:49:33 +0200 Subject: [PATCH 325/513] feat(dashboard): show loaded/count plugins on dashboard instead of just count --- lua/lazyvim/plugins/extras/ui/dashboard.lua | 2 +- lua/lazyvim/plugins/ui.lua | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/dashboard.lua b/lua/lazyvim/plugins/extras/ui/dashboard.lua index 23d208e6ff..2c678f36bb 100644 --- a/lua/lazyvim/plugins/extras/ui/dashboard.lua +++ b/lua/lazyvim/plugins/extras/ui/dashboard.lua @@ -38,7 +38,7 @@ return { footer = function() local stats = require("lazy").stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - return { "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" } + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } end, }, } diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index bec52d6916..d4e8859b37 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -353,7 +353,13 @@ return { callback = function() local stats = require("lazy").stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" + dashboard.section.footer.val = "⚡ Neovim loaded " + .. stats.loaded + .. "/" + .. stats.count + .. " plugins in " + .. ms + .. "ms" pcall(vim.cmd.AlphaRedraw) end, }) From 6b857f1de648292f2410f9beaa95318bd30454d5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 17:49:00 +0200 Subject: [PATCH 326/513] feat(options): set `virtualedit=block` by default --- lua/lazyvim/config/options.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 2e7e07c9f5..f110f7fb50 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -43,6 +43,7 @@ opt.timeoutlen = 300 opt.undofile = true opt.undolevels = 10000 opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap From 5d44c976a746e29cfe52ceab93dd3de5db2eafa8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 20:11:05 +0200 Subject: [PATCH 327/513] fix(autocmds): extra check that we didn't do last_loc more than once for the buffer --- lua/lazyvim/config/autocmds.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 7d9feeddbc..9f4344cfa8 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -34,9 +34,10 @@ vim.api.nvim_create_autocmd("BufReadPost", { callback = function(event) local exclude = { "gitcommit" } local buf = event.buf - if vim.tbl_contains(exclude, vim.bo[buf].filetype) then + if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then return end + vim.b[buf].lazyvim_last_loc = true local mark = vim.api.nvim_buf_get_mark(buf, '"') local lcount = vim.api.nvim_buf_line_count(buf) if mark[1] > 0 and mark[1] <= lcount then From c0ce89fe62bffc0fe35bf76d3e5f501c8b5276c2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 20:11:45 +0200 Subject: [PATCH 328/513] feat(telescope): smarter way to determine the window to open a file in --- lua/lazyvim/plugins/editor.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index c26d00d5a3..9386495315 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -201,6 +201,19 @@ return { defaults = { prompt_prefix = " ", selection_caret = " ", + -- open files in the first window that is an actual file. + -- use the current window if no other window is available. + get_selection_window = function() + local wins = vim.api.nvim_list_wins() + table.insert(wins, 1, vim.api.nvim_get_current_win()) + for _, win in ipairs(wins) do + local buf = vim.api.nvim_win_get_buf(win) + if vim.bo[buf].buftype == "" then + return win + end + end + return 0 + end, mappings = { i = { [""] = open_with_trouble, From fb7017005809d6be06a1ece748ef2406c37a34d9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 20:12:07 +0200 Subject: [PATCH 329/513] feat(edgy): when edgy is enabled, use edgy's main window for Telescope to open results in --- lua/lazyvim/plugins/extras/ui/edgy.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index fdc0d33082..5d6eb9d846 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -118,6 +118,19 @@ return { end, }, + -- use edgy's selection window + { + "nvim-telescope/telescope.nvim", + opts = { + defaults = { + get_selecition_window = function() + require("edgy").goto_main() + return 0 + end, + }, + }, + }, + -- prevent neo-tree from opening files in edgy windows { "nvim-neo-tree/neo-tree.nvim", From 9357ea2881fdd57b028256597c01e15601c29aaf Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 20:12:45 +0200 Subject: [PATCH 330/513] fix(edgy): typo --- lua/lazyvim/plugins/extras/ui/edgy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 5d6eb9d846..2e0db1c126 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -123,7 +123,7 @@ return { "nvim-telescope/telescope.nvim", opts = { defaults = { - get_selecition_window = function() + get_selection_window = function() require("edgy").goto_main() return 0 end, From 9a4b9aa804cfa2c112b1ef50c68936421995b048 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 20:16:02 +0200 Subject: [PATCH 331/513] refactor(edgy): make telescope optional --- lua/lazyvim/plugins/extras/ui/edgy.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 2e0db1c126..8692d4812f 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -121,6 +121,7 @@ return { -- use edgy's selection window { "nvim-telescope/telescope.nvim", + optional = true, opts = { defaults = { get_selection_window = function() From 4e8a88fc1f28d0420aa3badb703296f344d89968 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 22:09:39 +0200 Subject: [PATCH 332/513] fix(util): dont schedule on_load --- lua/lazyvim/util/init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index ffa6df47e0..05bc815419 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -283,9 +283,7 @@ end function M.on_load(name, fn) local Config = require("lazy.core.config") if Config.plugins[name] and Config.plugins[name]._.loaded then - vim.schedule(function() - fn(name) - end) + fn(name) else vim.api.nvim_create_autocmd("User", { pattern = "LazyLoad", From 0955129796749651e1413006e36e9a1c6d3027f3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 22:11:17 +0200 Subject: [PATCH 333/513] fix(project): make sure to load telescope extension after telescope ran setup --- lua/lazyvim/plugins/extras/util/project.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index d6be2b9c74..0800e5d5fa 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -9,7 +9,9 @@ return { event = "VeryLazy", config = function(_, opts) require("project_nvim").setup(opts) - require("telescope").load_extension("projects") + require("lazyvim.util").on_load("telescope.nvim", function() + require("telescope").load_extension("projects") + end) end, keys = { { "fp", "Telescope projects", desc = "Projects" }, From 44984dcbe25c13e0e1bc582d5a51ccc2a4be8f70 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 22:28:09 +0200 Subject: [PATCH 334/513] feat(telescope): add telescope-fzf-native by default. Will only be enabled if `make` is on your system. --- lua/lazyvim/plugins/editor.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 9386495315..e8df2e0bbe 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -100,6 +100,18 @@ return { "nvim-telescope/telescope.nvim", cmd = "Telescope", version = false, -- telescope did only one release, so use HEAD for now + dependencies = { + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + enabled = vim.fn.executable("make") == 1, + config = function() + Util.on_load("telescope.nvim", function() + require("telescope").load_extension("fzf") + end) + end, + }, + }, keys = { { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, { "/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, From 02bc41412a14c1c0bb823421ef82ff5596f42571 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 23:32:34 +0200 Subject: [PATCH 335/513] fix(telescope): remove telescope folding hack since PR with fix has been merged upstream --- lua/lazyvim/config/autocmds.lua | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 9f4344cfa8..4cc6f1ec45 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -92,16 +92,3 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") end, }) - --- HACK: re-caclulate folds when entering a buffer through Telescope --- @see https://github.com/nvim-telescope/telescope.nvim/issues/699 -vim.api.nvim_create_autocmd("BufEnter", { - group = augroup("fix_folds"), - callback = function() - if vim.opt.foldmethod:get() == "expr" then - vim.schedule(function() - vim.opt.foldmethod = "expr" - end) - end - end, -}) From 23a0004a86071164e66b76c32459c9b45b0d1e3e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 00:13:40 +0200 Subject: [PATCH 336/513] chore(main): release 9.8.0 (#1642) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7d4e4d45..7f9d136fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [9.8.0](https://github.com/LazyVim/LazyVim/compare/v9.7.0...v9.8.0) (2023-10-09) + + +### Features + +* **cmp:** ctrl+CR will abort cmp and enter a new line ([d894556](https://github.com/LazyVim/LazyVim/commit/d894556c375c1c2398f170c21f9323c9c1eba9d4)) +* **dashboard:** show loaded/count plugins on dashboard instead of just count ([9670c8a](https://github.com/LazyVim/LazyVim/commit/9670c8a400100d38e15c9662f488232508bfb1bb)) +* **edgy:** when edgy is enabled, use edgy's main window for Telescope to open results in ([fb70170](https://github.com/LazyVim/LazyVim/commit/fb7017005809d6be06a1ece748ef2406c37a34d9)) +* **options:** set `virtualedit=block` by default ([6b857f1](https://github.com/LazyVim/LazyVim/commit/6b857f1de648292f2410f9beaa95318bd30454d5)) +* **telescope:** add telescope-fzf-native by default. Will only be enabled if `make` is on your system. ([44984dc](https://github.com/LazyVim/LazyVim/commit/44984dcbe25c13e0e1bc582d5a51ccc2a4be8f70)) +* **telescope:** smarter way to determine the window to open a file in ([c0ce89f](https://github.com/LazyVim/LazyVim/commit/c0ce89fe62bffc0fe35bf76d3e5f501c8b5276c2)) + + +### Bug Fixes + +* **autocmds:** extra check that we didn't do last_loc more than once for the buffer ([5d44c97](https://github.com/LazyVim/LazyVim/commit/5d44c976a746e29cfe52ceab93dd3de5db2eafa8)) +* **cmp:** set default group_index to 1 to prevent issues with custom sources ([0a05888](https://github.com/LazyVim/LazyVim/commit/0a05888d992b37749f9aae25c7f63f2534ec1024)) +* **edgy:** typo ([9357ea2](https://github.com/LazyVim/LazyVim/commit/9357ea2881fdd57b028256597c01e15601c29aaf)) +* **project:** make sure to load telescope extension after telescope ran setup ([0955129](https://github.com/LazyVim/LazyVim/commit/0955129796749651e1413006e36e9a1c6d3027f3)) +* **telescope:** remove telescope folding hack since PR with fix has been merged upstream ([02bc414](https://github.com/LazyVim/LazyVim/commit/02bc41412a14c1c0bb823421ef82ff5596f42571)) +* **util:** dont schedule on_load ([4e8a88f](https://github.com/LazyVim/LazyVim/commit/4e8a88fc1f28d0420aa3badb703296f344d89968)) + ## [9.7.0](https://github.com/LazyVim/LazyVim/compare/v9.6.0...v9.7.0) (2023-10-09) From 88d465c3efac065f912e1de162c9a48bbae15316 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 07:51:00 +0200 Subject: [PATCH 337/513] fix(hypr): automatically update/install hypr treesitter parser when needed --- lua/lazyvim/plugins/extras/util/dot.lua | 1 + lua/lazyvim/plugins/treesitter.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index 159c942124..6dda53d349 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -13,6 +13,7 @@ return { "luckasRanarison/tree-sitter-hypr", enabled = have("hypr"), event = "BufRead */hypr/*.conf", + build = ":TSUpdate hypr", config = function() -- Fix ft detection for hyprland vim.filetype.add({ diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index c06adbf0f5..68161f6c46 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -34,7 +34,7 @@ return { end, }, }, - cmd = { "TSUpdateSync" }, + cmd = { "TSUpdateSync", "TSUdate", "TSIntsall" }, keys = { { "", desc = "Increment selection" }, { "", desc = "Decrement selection", mode = "x" }, From 4719dadfdad49fdfbbb592434e17b5802d1c21c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 10 Oct 2023 05:51:42 +0000 Subject: [PATCH 338/513] 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 ba1cbc6c36..4bf837e5c8 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 09 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 10 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b1c9fd15bdbc0bae5bf1ba1efd88ce7355e7f2c1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 11:05:57 +0200 Subject: [PATCH 339/513] feat(dap): added run with args `leader-ca`. Fixes #1629 --- lua/lazyvim/plugins/extras/dap/core.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 3b623df535..1f079630fb 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -1,3 +1,14 @@ +---@param config {args?:string[]|fun():string[]?} +local function get_args(config) + local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + ---@cast args string[] + config.args = function() + local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] + return vim.split(vim.fn.expand(new_args) --[[@as string]], " ") + end + return config +end + return { "mfussenegger/nvim-dap", @@ -76,6 +87,7 @@ return { { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, { "dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" }, { "di", function() require("dap").step_into() end, desc = "Step Into" }, From 599798a366d5fead7e8486e1b02dd2362d2e6bd1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 11:07:58 +0200 Subject: [PATCH 340/513] fix(treesitter): typo with commands --- lua/lazyvim/plugins/treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 68161f6c46..47e58f1d49 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -34,7 +34,7 @@ return { end, }, }, - cmd = { "TSUpdateSync", "TSUdate", "TSIntsall" }, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, keys = { { "", desc = "Increment selection" }, { "", desc = "Decrement selection", mode = "x" }, From e8c26c70e27d468cec11926890105d61f99f9218 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 11:54:33 +0200 Subject: [PATCH 341/513] refactor(eslint): use util.get_clients instead of deprecated method --- lua/lazyvim/plugins/extras/linting/eslint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 32498cb59b..1fea3c8ce1 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -21,7 +21,7 @@ return { return end - local client = vim.lsp.get_active_clients({ bufnr = event.buf, name = "eslint" })[1] + local client = require("lazyvim.util").get_clients({ bufnr = event.buf, name = "eslint" })[1] if client then local diag = vim.diagnostic.get(event.buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) if #diag > 0 then From 28b7a5add22a2f94dc75ba9f99fdc0c0bbd63d66 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:39:44 +0200 Subject: [PATCH 342/513] chore(main): release 9.9.0 (#1648) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9d136fd9..0163c09c69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [9.9.0](https://github.com/LazyVim/LazyVim/compare/v9.8.0...v9.9.0) (2023-10-10) + + +### Features + +* **dap:** added run with args `leader-ca`. Fixes [#1629](https://github.com/LazyVim/LazyVim/issues/1629) ([b1c9fd1](https://github.com/LazyVim/LazyVim/commit/b1c9fd15bdbc0bae5bf1ba1efd88ce7355e7f2c1)) + + +### Bug Fixes + +* **hypr:** automatically update/install hypr treesitter parser when needed ([88d465c](https://github.com/LazyVim/LazyVim/commit/88d465c3efac065f912e1de162c9a48bbae15316)) +* **treesitter:** typo with commands ([599798a](https://github.com/LazyVim/LazyVim/commit/599798a366d5fead7e8486e1b02dd2362d2e6bd1)) + ## [9.8.0](https://github.com/LazyVim/LazyVim/compare/v9.7.0...v9.8.0) (2023-10-09) From 8e88aa51f4d104e9da4ced0b4e9ae05d91565a36 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Oct 2023 12:42:26 +0000 Subject: [PATCH 343/513] 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 4bf837e5c8..a950794a12 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 10 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 11 ============================================================================== Table of Contents *LazyVim-table-of-contents* From ee7a401388f2933729afcd7090fb8e69631b912f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 14:46:05 +0200 Subject: [PATCH 344/513] fix(config): disable LazyFile till v10.0 --- lua/lazyvim/config/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index c0319dcf9a..d993ac1937 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -278,6 +278,7 @@ function M.init() M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil + M.use_lazy_file = false -- disablle for now till v10.0 -- delay notifications till vim.notify was replaced or after 500ms require("lazyvim.util").lazy_notify() @@ -314,6 +315,7 @@ function M.init() events[#events + 1] = event end end + plugin.event = events end end end From 61f1c308bf6b87c51a2b49c314c7c7379f19a27e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:00:18 +0200 Subject: [PATCH 345/513] chore(main): release 9.9.1 (#1661) 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 0163c09c69..c1136f07a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [9.9.1](https://github.com/LazyVim/LazyVim/compare/v9.9.0...v9.9.1) (2023-10-11) + + +### Bug Fixes + +* **config:** disable LazyFile till v10.0 ([ee7a401](https://github.com/LazyVim/LazyVim/commit/ee7a401388f2933729afcd7090fb8e69631b912f)) + ## [9.9.0](https://github.com/LazyVim/LazyVim/compare/v9.8.0...v9.9.0) (2023-10-10) From 5f5acb5b88789f4eae4781d3bf2ab52f880b3b86 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 14:56:29 +0200 Subject: [PATCH 346/513] Revert "fix(config): disable LazyFile till v10.0" This reverts commit ee7a401388f2933729afcd7090fb8e69631b912f. --- lua/lazyvim/config/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index d993ac1937..c0319dcf9a 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -278,7 +278,6 @@ function M.init() M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil - M.use_lazy_file = false -- disablle for now till v10.0 -- delay notifications till vim.notify was replaced or after 500ms require("lazyvim.util").lazy_notify() @@ -315,7 +314,6 @@ function M.init() events[#events + 1] = event end end - plugin.event = events end end end From c8c929c9fdc44cc69cb034c47bd89d2bc4e4a429 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 19:29:24 +0200 Subject: [PATCH 347/513] perf(util): split lazyvim.util in smaller separate modules --- lua/lazyvim/config/init.lua | 27 +- lua/lazyvim/config/keymaps.lua | 12 +- lua/lazyvim/config/options.lua | 4 +- lua/lazyvim/plugins/editor.lua | 6 +- lua/lazyvim/plugins/extras/coding/codeium.lua | 6 +- lua/lazyvim/plugins/extras/coding/copilot.lua | 12 +- .../plugins/extras/editor/mini-files.lua | 2 +- lua/lazyvim/plugins/extras/lang/go.lua | 2 +- lua/lazyvim/plugins/extras/lang/python.lua | 2 +- lua/lazyvim/plugins/extras/lang/yaml.lua | 2 +- lua/lazyvim/plugins/lsp/init.lua | 13 +- lua/lazyvim/plugins/lsp/keymaps.lua | 4 +- lua/lazyvim/plugins/ui.lua | 12 +- lua/lazyvim/util/init.lua | 284 +++--------------- lua/lazyvim/util/lsp.lua | 112 +++++++ lua/lazyvim/util/root.lua | 49 +++ lua/lazyvim/util/telescope.lua | 53 ++++ lua/lazyvim/util/terminal.lua | 55 ++++ lua/lazyvim/util/toggle.lua | 62 ++++ lua/lazyvim/util/ui.lua | 10 + 20 files changed, 444 insertions(+), 285 deletions(-) create mode 100644 lua/lazyvim/util/lsp.lua create mode 100644 lua/lazyvim/util/root.lua create mode 100644 lua/lazyvim/util/telescope.lua create mode 100644 lua/lazyvim/util/terminal.lua create mode 100644 lua/lazyvim/util/toggle.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index c0319dcf9a..23ca90d431 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -1,4 +1,4 @@ -local Util = require("lazy.core.util") +local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} @@ -155,6 +155,7 @@ function M.setup(opts) M.load("autocmds") end M.load("keymaps") + Util.format.setup() end, }) @@ -240,18 +241,11 @@ end ---@param name "autocmds" | "options" | "keymaps" function M.load(name) local function _load(mod) - Util.try(function() - require(mod) - end, { - msg = "Failed loading " .. mod, - on_error = function(msg) - local info = require("lazy.core.cache").find(mod) - if info == nil or (type(info) == "table" and #info == 0) then - return - end - Util.error(msg) - end, - }) + if require("lazy.core.cache").find(mod)[1] then + Util.try(function() + require(mod) + end, { msg = "Failed loading " .. mod }) + end end -- always load lazyvim, then user file if M.defaults[name] or name == "options" then @@ -275,6 +269,11 @@ function M.init() vim.opt.rtp:append(plugin.dir) end + package.preload["lazyvim.plugins.lsp.format"] = function() + Util.deprecate([[require("lazyvim.plugins.lsp.format")]], [[require("lazyvim.util").format]]) + return Util.format + end + M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil @@ -285,7 +284,7 @@ function M.init() -- load options here, before lazy init while sourcing plugin modules -- this is needed to make sure options will be correctly applied -- after installing missing plugins - require("lazyvim.config").load("options") + M.load("options") local Plugin = require("lazy.core.plugin") local add = Plugin.Spec.add ---@diagnostic disable-next-line: duplicate-set-field diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index e8307f4568..b60aa43e72 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -105,8 +105,8 @@ map("n", "uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "T map("n", "us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) map("n", "uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) map("n", "uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) -map("n", "ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" }) -map("n", "ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" }) +map("n", "ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" }) +map("n", "ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" }) local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) if vim.lsp.inlay_hint then @@ -114,8 +114,8 @@ if vim.lsp.inlay_hint then end -- lazygit -map("n", "gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) -map("n", "gG", function() Util.float_term({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) +map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root.get(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) +map("n", "gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) -- quit map("n", "qq", "qa", { desc = "Quit all" }) @@ -127,9 +127,9 @@ map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) map("n", "L", Util.changelog, {desc = "LazyVim Changelog"}) -- floating terminal -local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end +local lazyterm = function() Util.terminal(nil, { cwd = Util.root.get() }) end map("n", "ft", lazyterm, { desc = "Terminal (root dir)" }) -map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) +map("n", "fT", function() Util.terminal() end, { desc = "Terminal (cwd)" }) map("n", "", lazyterm, { desc = "Terminal (root dir)" }) map("n", "", lazyterm, { desc = "which_key_ignore" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index f110f7fb50..e2ae948546 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -63,10 +63,10 @@ end -- Folding vim.opt.foldlevel = 99 -vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()" +vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" if vim.fn.has("nvim-0.9.0") == 1 then - vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]] + vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] end -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index e8df2e0bbe..0fb6394430 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -11,7 +11,7 @@ return { { "fe", function() - require("neo-tree.command").execute({ toggle = true, dir = require("lazyvim.util").get_root() }) + require("neo-tree.command").execute({ toggle = true, dir = Util.root.get() }) end, desc = "Explorer NeoTree (root dir)", }, @@ -60,7 +60,7 @@ return { }, config = function(_, opts) local function on_move(data) - Util.on_rename(data.source, data.destination) + Util.lsp.on_rename(data.source, data.destination) end local events = require("neo-tree.events") @@ -270,7 +270,7 @@ return { "nvim-telescope/telescope.nvim", optional = true, opts = function(_, opts) - if not require("lazyvim.util").has("flash.nvim") then + if not Util.has("flash.nvim") then return end local function flash(prompt_bufnr) diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index f8d4c671ac..457535cd2c 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -49,9 +49,9 @@ return { local Util = require("lazyvim.util") local colors = { - ok = Util.fg("Special"), - error = Util.fg("DiagnosticError"), - pending = Util.fg("DiagnosticWarn"), + ok = Util.ui.fg("Special"), + error = Util.ui.fg("DiagnosticError"), + pending = Util.ui.fg("DiagnosticWarn"), } table.insert(opts.sections.lualine_x, 2, { function() diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 3863091741..279a974f0a 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -21,10 +21,10 @@ return { opts = function(_, opts) local Util = require("lazyvim.util") local colors = { - [""] = Util.fg("Special"), - ["Normal"] = Util.fg("Special"), - ["Warning"] = Util.fg("DiagnosticError"), - ["InProgress"] = Util.fg("DiagnosticWarn"), + [""] = Util.ui.fg("Special"), + ["Normal"] = Util.ui.fg("Special"), + ["Warning"] = Util.ui.fg("DiagnosticError"), + ["InProgress"] = Util.ui.fg("DiagnosticWarn"), } table.insert(opts.sections.lualine_x, 2, { function() @@ -36,7 +36,7 @@ return { if not package.loaded["copilot"] then return end - local ok, clients = pcall(require("lazyvim.util").get_clients, { name = "copilot", bufnr = 0 }) + local ok, clients = pcall(require("lazyvim.util").lsp.get_clients, { name = "copilot", bufnr = 0 }) if not ok then return false end @@ -66,7 +66,7 @@ return { copilot_cmp.setup(opts) -- attach cmp source whenever copilot attaches -- fixes lazy-loading issues with the copilot cmp source - require("lazyvim.util").on_attach(function(client) + require("lazyvim.util").lsp.on_attach(function(client) if client.name == "copilot" then copilot_cmp._on_insert_enter({}) end diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index c3ddd2734d..55fc768c38 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -57,7 +57,7 @@ return { vim.api.nvim_create_autocmd("User", { pattern = "MiniFilesActionRename", callback = function(event) - require("lazyvim.util").on_rename(event.data.from, event.data.to) + require("lazyvim.util").lsp.on_rename(event.data.from, event.data.to) end, }) end, diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index b9966b7e56..39410353cf 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -61,7 +61,7 @@ return { gopls = function(_, opts) -- workaround for gopls not supporting semanticTokensProvider -- https://github.com/golang/go/issues/54531#issuecomment-1464982242 - require("lazyvim.util").on_attach(function(client, _) + require("lazyvim.util").lsp.on_attach(function(client, _) if client.name == "gopls" then if not client.server_capabilities.semanticTokensProvider then local semantic = client.config.capabilities.textDocument.semanticTokens diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index ff4267fbb9..835c9da8fb 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -16,7 +16,7 @@ return { }, setup = { ruff_lsp = function() - require("lazyvim.util").on_attach(function(client, _) + require("lazyvim.util").lsp.on_attach(function(client, _) if client.name == "ruff_lsp" then -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index fdfba40481..5afe1b8300 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -64,7 +64,7 @@ return { yamlls = function() -- Neovim < 0.10 does not have dynamic registration for formatting if vim.fn.has("nvim-0.10") == 0 then - require("lazyvim.util").on_attach(function(client, _) + require("lazyvim.util").lsp.on_attach(function(client, _) if client.name == "yamlls" then client.server_capabilities.documentFormattingProvider = true end diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index bdef1a744c..f18eed4f0e 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -1,3 +1,5 @@ +local Util = require("lazyvim.util") + return { -- lspconfig { @@ -88,6 +90,8 @@ return { require("lazyvim.plugins.lsp.format").setup(opts) -- setup formatting and keymaps Util.on_attach(function(client, buffer) + -- setup keymaps + Util.lsp.on_attach(function(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) end) @@ -112,7 +116,7 @@ return { local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint if opts.inlay_hints.enabled and inlay_hint then - Util.on_attach(function(client, buffer) + Util.lsp.on_attach(function(client, buffer) if client.supports_method("textDocument/inlayHint") then inlay_hint(buffer, true) end @@ -184,10 +188,10 @@ return { mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } }) end - if Util.lsp_get_config("denols") and Util.lsp_get_config("tsserver") then + if Util.lsp.get_config("denols") and Util.lsp.get_config("tsserver") then local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc") - Util.lsp_disable("tsserver", is_deno) - Util.lsp_disable("denols", function(root_dir) + Util.lsp.disable("tsserver", is_deno) + Util.lsp.disable("denols", function(root_dir) return not is_deno(root_dir) end) end @@ -208,7 +212,6 @@ return { nls.builtins.diagnostics.fish, nls.builtins.formatting.stylua, nls.builtins.formatting.shfmt, - -- nls.builtins.diagnostics.flake8, }, } end, diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index ad05b334ba..7b9c218987 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -66,7 +66,7 @@ end ---@param method string function M.has(buffer, method) method = method:find("/") and method or "textDocument/" .. method - local clients = require("lazyvim.util").get_clients({ bufnr = buffer }) + local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do if client.supports_method(method) then return true @@ -83,7 +83,7 @@ function M.resolve(buffer) end local spec = M.get() local opts = require("lazyvim.util").opts("nvim-lspconfig") - local clients = require("lazyvim.util").get_clients({ bufnr = buffer }) + local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} vim.list_extend(spec, maps) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index d4e8859b37..f1bac0312b 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -141,21 +141,21 @@ return { { function() return require("noice").api.status.command.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, - color = Util.fg("Statement"), + color = Util.ui.fg("Statement"), }, -- stylua: ignore { function() return require("noice").api.status.mode.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, - color = Util.fg("Constant"), + color = Util.ui.fg("Constant"), }, -- stylua: ignore { function() return " " .. require("dap").status() end, cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, - color = Util.fg("Debug"), + color = Util.ui.fg("Debug"), }, - { require("lazy.status").updates, cond = require("lazy.status").has_updates, color = Util.fg("Special") }, + { require("lazy.status").updates, cond = require("lazy.status").has_updates, color = Util.ui.fg("Special") }, { "diff", symbols = { @@ -374,8 +374,8 @@ return { lazy = true, init = function() vim.g.navic_silence = true - require("lazyvim.util").on_attach(function(client, buffer) - if client.server_capabilities.documentSymbolProvider then + require("lazyvim.util").lsp.on_attach(function(client, buffer) + if client.supports_method("textDocument/documentSymbol") then require("nvim-navic").attach(client, buffer) end end) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 05bc815419..146e73e20b 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -1,38 +1,54 @@ -local Util = require("lazy.core.util") - +local LazyUtil = require("lazy.core.util") + +---@class lazyvim.util: LazyUtilCore +---@field ui lazyvim.util.ui +---@field lsp lazyvim.util.lsp +---@field root lazyvim.util.root +---@field telescope lazyvim.util.telescope +---@field terminal lazyvim.util.terminal +---@field toggle lazyvim.util.toggle +---@field format lazyvim.util.format local M = {} -M.root_patterns = { ".git", "lua" } -function M.get_clients(...) - local fn = vim.lsp.get_clients or vim.lsp.get_active_clients - return fn(...) -end - ----@param on_attach fun(client, buffer) -function M.on_attach(on_attach) - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local buffer = args.buf ---@type number - local client = vim.lsp.get_client_by_id(args.data.client_id) - on_attach(client, buffer) - end, - }) -end +---@type table +local deprecated = { + get_clients = "lsp", + on_attach = "lsp", + on_rename = "lsp", + root_patterns = { "root", "patterns" }, + get_root = { "root", "get" }, + float_term = { "terminal", "open" }, + toggle = { "toggle", "option" }, + toggle_diagnostics = { "toggle", "diagnostics" }, + toggle_number = { "toggle", "number" }, + fg = "ui", +} + +setmetatable(M, { + __index = function(t, k) + if LazyUtil[k] then + return LazyUtil[k] + end + local dep = deprecated[k] + if dep then + local mod = type(dep) == "table" and dep[1] or dep + local key = type(dep) == "table" and dep[2] or k + M.deprecate([[require("lazyvim.util").]] .. k, [[require("lazyvim.util").]] .. mod .. "." .. key) + ---@diagnostic disable-next-line: no-unknown + t[mod] = require("lazyvim.util." .. mod) -- load here to prevent loops + return t[mod][key] + end + ---@diagnostic disable-next-line: no-unknown + t[k] = require("lazyvim.util." .. k) + return t[k] + end, +}) ---@param plugin string function M.has(plugin) return require("lazy.core.config").spec.plugins[plugin] ~= nil end -function M.fg(name) - ---@type {foreground?:number}? - ---@diagnostic disable-next-line: deprecated - local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true) - ---@diagnostic disable-next-line: undefined-field - local fg = hl and (hl.fg or hl.foreground) - return fg and { fg = string.format("#%06x", fg) } or nil -end - ---@param fn fun() function M.on_very_lazy(fn) vim.api.nvim_create_autocmd("User", { @@ -53,173 +69,13 @@ function M.opts(name) return Plugin.values(plugin, "opts", false) end --- returns the root directory based on: --- * lsp workspace folders --- * lsp root_dir --- * root pattern of filename of the current buffer --- * root pattern of cwd ----@return string -function M.get_root() - ---@type string? - local path = vim.api.nvim_buf_get_name(0) - path = path ~= "" and vim.loop.fs_realpath(path) or nil - ---@type string[] - local roots = {} - if path then - for _, client in pairs(M.get_clients({ bufnr = 0 })) do - local workspace = client.config.workspace_folders - local paths = workspace and vim.tbl_map(function(ws) - return vim.uri_to_fname(ws.uri) - end, workspace) or client.config.root_dir and { client.config.root_dir } or {} - for _, p in ipairs(paths) do - local r = vim.loop.fs_realpath(p) - if path:find(r, 1, true) then - roots[#roots + 1] = r - end - end - end - end - table.sort(roots, function(a, b) - return #a > #b - end) - ---@type string? - local root = roots[1] - if not root then - path = path and vim.fs.dirname(path) or vim.loop.cwd() - ---@type string? - root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1] - root = root and vim.fs.dirname(root) or vim.loop.cwd() - end - ---@cast root string - return root -end - --- this will return a function that calls telescope. --- cwd will default to lazyvim.util.get_root --- for `files`, git_files or find_files will be chosen depending on .git -function M.telescope(builtin, opts) - local params = { builtin = builtin, opts = opts } - return function() - builtin = params.builtin - opts = params.opts - opts = vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {}) - if builtin == "files" then - if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then - opts.show_untracked = true - builtin = "git_files" - else - builtin = "find_files" - end - end - if opts.cwd and opts.cwd ~= vim.loop.cwd() then - opts.attach_mappings = function(_, map) - map("i", "", function() - local action_state = require("telescope.actions.state") - local line = action_state.get_current_line() - M.telescope( - params.builtin, - vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line }) - )() - end) - return true - end - end - - require("telescope.builtin")[builtin](opts) - end -end - ----@type table -local terminals = {} - --- Opens a floating terminal (interactive by default) ----@param cmd? string[]|string ----@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false, ctrl_hjkl?:false} -function M.float_term(cmd, opts) - opts = vim.tbl_deep_extend("force", { - ft = "lazyterm", - size = { width = 0.9, height = 0.9 }, - }, opts or {}, { persistent = true }) - ---@cast opts LazyCmdOptions|{interactive?:boolean, esc_esc?:false} - - local termkey = vim.inspect({ cmd = cmd or "shell", cwd = opts.cwd, env = opts.env, count = vim.v.count1 }) - - if terminals[termkey] and terminals[termkey]:buf_valid() then - terminals[termkey]:toggle() - else - terminals[termkey] = require("lazy.util").float_term(cmd, opts) - local buf = terminals[termkey].buf - vim.b[buf].lazyterm_cmd = cmd - if opts.esc_esc == false then - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - end - if opts.ctrl_hjkl == false then - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - end - - vim.api.nvim_create_autocmd("BufEnter", { - buffer = buf, - callback = function() - vim.cmd.startinsert() - end, - }) - end - - return terminals[termkey] -end - ----@param silent boolean? ----@param values? {[1]:any, [2]:any} -function M.toggle(option, silent, values) - if values then - if vim.opt_local[option]:get() == values[1] then - vim.opt_local[option] = values[2] - else - vim.opt_local[option] = values[1] - end - return Util.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" }) - end - vim.opt_local[option] = not vim.opt_local[option]:get() - if not silent then - if vim.opt_local[option]:get() then - Util.info("Enabled " .. option, { title = "Option" }) - else - Util.warn("Disabled " .. option, { title = "Option" }) - end - end -end - -local nu = { number = true, relativenumber = true } -function M.toggle_number() - if vim.opt_local.number:get() or vim.opt_local.relativenumber:get() then - nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() } - vim.opt_local.number = false - vim.opt_local.relativenumber = false - Util.warn("Disabled line numbers", { title = "Option" }) - else - vim.opt_local.number = nu.number - vim.opt_local.relativenumber = nu.relativenumber - Util.info("Enabled line numbers", { title = "Option" }) - end -end - -local enabled = true -function M.toggle_diagnostics() - enabled = not enabled - if enabled then - vim.diagnostic.enable() - Util.info("Enabled diagnostics", { title = "Diagnostics" }) - else - vim.diagnostic.disable() - Util.warn("Disabled diagnostics", { title = "Diagnostics" }) - end -end - function M.deprecate(old, new) - Util.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), { title = "LazyVim" }) + M.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), { + title = "LazyVim", + once = true, + stacktrace = true, + stacklevel = 6, + }) end -- delay notifications till vim.notify was replaced or after 500ms @@ -259,25 +115,6 @@ function M.lazy_notify() timer:start(500, 0, replay) end ----@return _.lspconfig.options -function M.lsp_get_config(server) - local configs = require("lspconfig.configs") - return rawget(configs, server) -end - ----@param server string ----@param cond fun( root_dir, config): boolean -function M.lsp_disable(server, cond) - local util = require("lspconfig.util") - local def = M.lsp_get_config(server) - ---@diagnostic disable-next-line: undefined-field - def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir) - if cond(root_dir, config) then - config.enabled = false - end - end) -end - ---@param name string ---@param fn fun(name:string) function M.on_load(name, fn) @@ -305,28 +142,6 @@ function M.changelog() vim.diagnostic.disable(float.buf) end ----@param from string ----@param to string -function M.on_rename(from, to) - local clients = M.get_clients() - for _, client in ipairs(clients) do - if client.supports_method("workspace/willRenameFiles") then - ---@diagnostic disable-next-line: invisible - local resp = client.request_sync("workspace/willRenameFiles", { - files = { - { - oldUri = vim.uri_from_fname(from), - newUri = vim.uri_from_fname(to), - }, - }, - }, 1000, 0) - if resp and resp.result ~= nil then - vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) - end - end - end -end - -- Wrapper around vim.keymap.set that will -- not create a keymap if a lazy key handler exists. -- It will also set `silent` to true by default. @@ -345,6 +160,7 @@ function M.safe_keymap_set(mode, lhs, rhs, opts) opts = opts or {} opts.silent = opts.silent ~= false if opts.remap and not vim.g.vscode then + ---@diagnostic disable-next-line: no-unknown opts.remap = nil end vim.keymap.set(modes, lhs, rhs, opts) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua new file mode 100644 index 0000000000..d5903cd859 --- /dev/null +++ b/lua/lazyvim/util/lsp.lua @@ -0,0 +1,112 @@ +---@class lazyvim.util.lsp +local M = {} + +function M.get_clients(...) + ---@diagnostic disable-next-line: deprecated + local fn = vim.lsp.get_clients or vim.lsp.get_active_clients + return fn(...) +end + +---@param on_attach fun(client, buffer) +function M.on_attach(on_attach) + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf ---@type number + local client = vim.lsp.get_client_by_id(args.data.client_id) + on_attach(client, buffer) + end, + }) +end + +---@param from string +---@param to string +function M.on_rename(from, to) + local clients = M.get_clients() + for _, client in ipairs(clients) do + if client.supports_method("workspace/willRenameFiles") then + ---@diagnostic disable-next-line: invisible + local resp = client.request_sync("workspace/willRenameFiles", { + files = { + { + oldUri = vim.uri_from_fname(from), + newUri = vim.uri_from_fname(to), + }, + }, + }, 1000, 0) + if resp and resp.result ~= nil then + vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) + end + end + end +end + +---@return _.lspconfig.options +function M.get_config(server) + local configs = require("lspconfig.configs") + return rawget(configs, server) +end + +---@param server string +---@param cond fun( root_dir, config): boolean +function M.disable(server, cond) + local util = require("lspconfig.util") + local def = M.get_config(server) + ---@diagnostic disable-next-line: undefined-field + def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir) + if cond(root_dir, config) then + config.enabled = false + end + end) +end + +---@alias lsp.Client.filter fun(client: lsp.Client): boolean + +---@param name string +---@return lsp.Client.filter +function M.filter(name) + return function(client) + return client.name == name + end +end + +---@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter), bufnr?: number} +function M.formatter(opts) + opts = opts or {} + local filter = opts.filter + filter = type(filter) == "string" and M.filter(filter) or filter + ---@cast filter lsp.Client.filter? + ---@type LazyFormatter + local ret = { + name = "LSP", + primary = true, + priority = 1, + format = function(buf) + M.format({ bufnr = buf, filter = filter }) + end, + sources = function(buf) + local clients = M.get_clients({ bufnr = buf }) + ---@param client lsp.Client + local ret = vim.tbl_filter(function(client) + return (not filter or filter(client)) + and ( + client.supports_method("textDocument/formatting") + or client.supports_method("textDocument/rangeFormatting") + ) + end, clients) + ---@param client lsp.Client + return vim.tbl_map(function(client) + return client.name + end, ret) + end, + } + return vim.tbl_deep_extend("force", ret, opts) --[[@as LazyFormatter]] +end + +---@param opts? {filter?: lsp.Client.filter, bufnr?: number} +function M.format(opts) + vim.lsp.buf.format( + vim.tbl_deep_extend("force", opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {}) + ) +end + +return M diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua new file mode 100644 index 0000000000..296e045b03 --- /dev/null +++ b/lua/lazyvim/util/root.lua @@ -0,0 +1,49 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.root +local M = {} + +M.patterns = { ".git", "lua" } + +-- returns the root directory based on: +-- * lsp workspace folders +-- * lsp root_dir +-- * root pattern of filename of the current buffer +-- * root pattern of cwd +---@return string +function M.get() + ---@type string? + local path = vim.api.nvim_buf_get_name(0) + path = path ~= "" and vim.loop.fs_realpath(path) or nil + ---@type string[] + local roots = {} + if path then + for _, client in pairs(Util.lsp.get_clients({ bufnr = 0 })) do + local workspace = client.config.workspace_folders + local paths = workspace and vim.tbl_map(function(ws) + return vim.uri_to_fname(ws.uri) + end, workspace) or client.config.root_dir and { client.config.root_dir } or {} + for _, p in ipairs(paths) do + local r = vim.loop.fs_realpath(p) + if path:find(r, 1, true) then + roots[#roots + 1] = r + end + end + end + end + table.sort(roots, function(a, b) + return #a > #b + end) + ---@type string? + local root = roots[1] + if not root then + path = path and vim.fs.dirname(path) or vim.loop.cwd() + ---@type string? + root = vim.fs.find(M.patterns, { path = path, upward = true })[1] + root = root and vim.fs.dirname(root) or vim.loop.cwd() + end + ---@cast root string + return root +end + +return M diff --git a/lua/lazyvim/util/telescope.lua b/lua/lazyvim/util/telescope.lua new file mode 100644 index 0000000000..2aae403dfd --- /dev/null +++ b/lua/lazyvim/util/telescope.lua @@ -0,0 +1,53 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.telescope.opts +---@field cwd? string|boolean +---@field show_untracked? boolean + +---@class lazyvim.util.telescope +---@overload fun(builtin:string, opts?:lazyvim.util.telescope.opts) +local M = setmetatable({}, { + __call = function(m, ...) + return m.telescope(...) + end, +}) + +-- this will return a function that calls telescope. +-- cwd will default to lazyvim.util.get_root +-- for `files`, git_files or find_files will be chosen depending on .git +---@param builtin string +---@param opts? lazyvim.util.telescope.opts +function M.telescope(builtin, opts) + local params = { builtin = builtin, opts = opts } + return function() + builtin = params.builtin + opts = params.opts + opts = vim.tbl_deep_extend("force", { cwd = Util.root.get() }, opts or {}) --[[@as lazyvim.util.telescope.opts]] + if builtin == "files" then + if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then + opts.show_untracked = true + builtin = "git_files" + else + builtin = "find_files" + end + end + if opts.cwd and opts.cwd ~= vim.loop.cwd() then + ---@diagnostic disable-next-line: inject-field + opts.attach_mappings = function(_, map) + map("i", "", function() + local action_state = require("telescope.actions.state") + local line = action_state.get_current_line() + M.telescope( + params.builtin, + vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line }) + )() + end) + return true + end + end + + require("telescope.builtin")[builtin](opts) + end +end + +return M diff --git a/lua/lazyvim/util/terminal.lua b/lua/lazyvim/util/terminal.lua new file mode 100644 index 0000000000..7787615b92 --- /dev/null +++ b/lua/lazyvim/util/terminal.lua @@ -0,0 +1,55 @@ +---@class lazyvim.util.terminal +---@overload fun(cmd: string|string[], opts: LazyTermOpts): LazyFloat +local M = setmetatable({}, { + __call = function(m, ...) + return m.open(...) + end, +}) + +---@type table +local terminals = {} + +---@class LazyTermOpts: LazyCmdOptions +---@field interactive? boolean +---@field esc_esc? boolean +---@field ctrl_hjkl? boolean + +-- Opens a floating terminal (interactive by default) +---@param cmd? string[]|string +---@param opts? LazyTermOpts +function M.open(cmd, opts) + opts = vim.tbl_deep_extend("force", { + ft = "lazyterm", + size = { width = 0.9, height = 0.9 }, + }, opts or {}, { persistent = true }) --[[@as LazyTermOpts]] + + local termkey = vim.inspect({ cmd = cmd or "shell", cwd = opts.cwd, env = opts.env, count = vim.v.count1 }) + + if terminals[termkey] and terminals[termkey]:buf_valid() then + terminals[termkey]:toggle() + else + terminals[termkey] = require("lazy.util").float_term(cmd, opts) + local buf = terminals[termkey].buf + vim.b[buf].lazyterm_cmd = cmd + if opts.esc_esc == false then + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + end + if opts.ctrl_hjkl == false then + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + end + + vim.api.nvim_create_autocmd("BufEnter", { + buffer = buf, + callback = function() + vim.cmd.startinsert() + end, + }) + end + + return terminals[termkey] +end + +return M diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua new file mode 100644 index 0000000000..b520070b74 --- /dev/null +++ b/lua/lazyvim/util/toggle.lua @@ -0,0 +1,62 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.toggle +local M = {} + +---@param silent boolean? +---@param values? {[1]:any, [2]:any} +function M.option(option, silent, values) + if values then + if vim.opt_local[option]:get() == values[1] then + ---@diagnostic disable-next-line: no-unknown + vim.opt_local[option] = values[2] + else + ---@diagnostic disable-next-line: no-unknown + vim.opt_local[option] = values[1] + end + return Util.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" }) + end + ---@diagnostic disable-next-line: no-unknown + vim.opt_local[option] = not vim.opt_local[option]:get() + if not silent then + if vim.opt_local[option]:get() then + Util.info("Enabled " .. option, { title = "Option" }) + else + Util.warn("Disabled " .. option, { title = "Option" }) + end + end +end + +local nu = { number = true, relativenumber = true } +function M.number() + if vim.opt_local.number:get() or vim.opt_local.relativenumber:get() then + nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() } + vim.opt_local.number = false + vim.opt_local.relativenumber = false + Util.warn("Disabled line numbers", { title = "Option" }) + else + vim.opt_local.number = nu.number + vim.opt_local.relativenumber = nu.relativenumber + Util.info("Enabled line numbers", { title = "Option" }) + end +end + +local enabled = true +function M.diagnostics() + enabled = not enabled + if enabled then + vim.diagnostic.enable() + Util.info("Enabled diagnostics", { title = "Diagnostics" }) + else + vim.diagnostic.disable() + Util.warn("Disabled diagnostics", { title = "Diagnostics" }) + end +end + +setmetatable(M, { + __call = function(m, ...) + return m.option(...) + end, +}) + +return M diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 66ec4bcaf9..22b70e4b6e 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,3 +1,4 @@ +---@class lazyvim.util.ui local M = {} ---@alias Sign {name:string, text:string, texthl:string, priority:number} @@ -119,4 +120,13 @@ function M.statuscolumn() }, "") end +function M.fg(name) + ---@type {foreground?:number}? + ---@diagnostic disable-next-line: deprecated + local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true) + ---@diagnostic disable-next-line: undefined-field + local fg = hl and (hl.fg or hl.foreground) + return fg and { fg = string.format("#%06x", fg) } or nil +end + return M From f1a8f24a361d0de198f6b1458168652a6835c932 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 19:31:08 +0200 Subject: [PATCH 348/513] feat(format): new LazyVim formatter with integrations for lsp/none-ls/conform/eslint/... --- lua/lazyvim/config/keymaps.lua | 5 +- lua/lazyvim/config/options.lua | 3 + .../plugins/extras/formatting/conform.lua | 17 +- lua/lazyvim/plugins/extras/linting/eslint.lua | 35 +++-- lua/lazyvim/plugins/lsp/format.lua | 126 --------------- lua/lazyvim/plugins/lsp/init.lua | 40 ++++- lua/lazyvim/util/format.lua | 147 ++++++++++++++++++ 7 files changed, 225 insertions(+), 148 deletions(-) delete mode 100644 lua/lazyvim/plugins/lsp/format.lua create mode 100644 lua/lazyvim/util/format.lua diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index b60aa43e72..ced9cdf7f3 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -95,13 +95,14 @@ end -- formatting map({ "n", "v" }, "cf", function() - require("lazyvim.plugins.lsp.format").format({ force = true }) + Util.format({ force = true }) end, { desc = "Format" }) -- stylua: ignore start -- toggle options -map("n", "uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" }) +map("n", "uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" }) +map("n", "uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" }) map("n", "us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) map("n", "uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) map("n", "uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index e2ae948546..1649896bdb 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -2,6 +2,9 @@ vim.g.mapleader = " " vim.g.maplocalleader = "\\" +-- Enable LazyVim auto format +vim.g.autoformat = true + local opt = vim.opt opt.autowrite = true -- Enable auto write diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/extras/formatting/conform.lua index 601967c59d..855e356e25 100644 --- a/lua/lazyvim/plugins/extras/formatting/conform.lua +++ b/lua/lazyvim/plugins/extras/formatting/conform.lua @@ -18,9 +18,20 @@ return { vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" -- Install the conform formatter on VeryLazy require("lazyvim.util").on_very_lazy(function() - require("lazyvim.plugins.lsp.format").custom_format = function(buf) - return require("conform").format({ bufnr = buf }) - end + require("lazyvim.util").format.register({ + name = "conform.nvim", + priority = 100, + primary = true, + format = function(buf) + require("conform").format({ bufnr = buf }) + end, + sources = function(buf) + local ret = require("conform").list_formatters(buf) + return vim.tbl_map(function(v) + return v.name + end, ret) + end, + }) end) end, opts = { diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 1fea3c8ce1..9537303d59 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -14,22 +14,37 @@ return { }, setup = { eslint = function() - vim.api.nvim_create_autocmd("BufWritePre", { - callback = function(event) - if not require("lazyvim.plugins.lsp.format").enabled() then - -- exit early if autoformat is not enabled - return - end + local function get_client(buf) + return require("lazyvim.util").lsp.get_clients({ name = "eslint", bufnr = buf })[1] + end + + local formatter = require("lazyvim.util").lsp.formatter({ + name = "eslint: lsp", + primary = false, + priority = 200, + filter = "eslint", + }) - local client = require("lazyvim.util").get_clients({ bufnr = event.buf, name = "eslint" })[1] + -- Use EslintFixAll on Neovim < 0.10.0 + if not pcall(require, "vim.lsp._dynamic") then + formatter.name = "eslint: EslintFixAll" + formatter.sources = function(buf) + local client = get_client(buf) + return client and { "eslint" } or {} + end + formatter.format = function(buf) + local client = get_client(buf) if client then - local diag = vim.diagnostic.get(event.buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) + local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) if #diag > 0 then vim.cmd("EslintFixAll") end end - end, - }) + end + end + + -- register the formatter with LazyVim + require("lazyvim.util").format.register(formatter) end, }, }, diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua deleted file mode 100644 index f507a38ad0..0000000000 --- a/lua/lazyvim/plugins/lsp/format.lua +++ /dev/null @@ -1,126 +0,0 @@ -local Util = require("lazy.core.util") - -local M = {} - ----@type PluginLspOpts -M.opts = nil - --- Allow plugins to set a custom formatter for a buffer. --- See the conform extra for an example. ----@type fun(bufnr:number):boolean -M.custom_format = nil - -function M.enabled() - return M.opts.autoformat -end - -function M.toggle() - if vim.b.autoformat == false then - vim.b.autoformat = nil - M.opts.autoformat = true - else - M.opts.autoformat = not M.opts.autoformat - end - if M.opts.autoformat then - Util.info("Enabled format on save", { title = "Format" }) - else - Util.warn("Disabled format on save", { title = "Format" }) - end -end - ----@param opts? {force?:boolean} -function M.format(opts) - local buf = vim.api.nvim_get_current_buf() - if vim.b.autoformat == false and not (opts and opts.force) then - return - end - - if - M.custom_format - and Util.try(function() - return M.custom_format(buf) - end, { msg = "Custom formatter failed" }) - then - return - end - - local formatters = M.get_formatters(buf) - local client_ids = vim.tbl_map(function(client) - return client.id - end, formatters.active) - - if #client_ids == 0 then - if opts and opts.force then - Util.warn("No formatter available", { title = "LazyVim" }) - end - return - end - - vim.lsp.buf.format(vim.tbl_deep_extend("force", { - bufnr = buf, - filter = function(client) - return vim.tbl_contains(client_ids, client.id) - end, - }, require("lazyvim.util").opts("nvim-lspconfig").format or {})) -end - --- Gets all lsp clients that support formatting. --- When a null-ls formatter is available for the current filetype, --- only null-ls formatters are returned. -function M.get_formatters(bufnr) - local ft = vim.bo[bufnr].filetype - -- check if we have any null-ls formatters for the current filetype - local null_ls = package.loaded["null-ls"] and require("null-ls.sources").get_available(ft, "NULL_LS_FORMATTING") or {} - - ---@class LazyVimFormatters - local ret = { - ---@type lsp.Client[] - active = {}, - ---@type lsp.Client[] - available = {}, - null_ls = null_ls, - } - - ---@type lsp.Client[] - local clients = require("lazyvim.util").get_clients({ bufnr = bufnr }) - for _, client in ipairs(clients) do - if M.supports_format(client) then - if (#null_ls > 0 and client.name == "null-ls") or #null_ls == 0 then - table.insert(ret.active, client) - else - table.insert(ret.available, client) - end - end - end - - return ret -end - --- Gets all lsp clients that support formatting --- and have not disabled it in their client config ----@param client lsp.Client -function M.supports_format(client) - if - client.config - and client.config.capabilities - and client.config.capabilities.documentFormattingProvider == false - then - return false - end - return client.supports_method("textDocument/formatting") or client.supports_method("textDocument/rangeFormatting") -end - ----@param opts PluginLspOpts -function M.setup(opts) - M.opts = opts - vim.api.nvim_create_autocmd("BufWritePre", { - group = vim.api.nvim_create_augroup("LazyVimFormat", {}), - callback = function() - if M.opts.autoformat then - M.format() - end - end, - }) -end - -return M diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index f18eed4f0e..b9e38e8bb9 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -35,8 +35,6 @@ return { }, -- add any global capabilities here capabilities = {}, - -- Automatically format on save - autoformat = true, -- options for vim.lsp.buf.format -- `bufnr` and `filter` is handled by the LazyVim formatter, -- but can be also overridden when specified @@ -80,16 +78,20 @@ return { }, ---@param opts PluginLspOpts config = function(_, opts) - local Util = require("lazyvim.util") - if Util.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)) end + -- setup autoformat - require("lazyvim.plugins.lsp.format").setup(opts) - -- setup formatting and keymaps - Util.on_attach(function(client, buffer) + Util.format.register(Util.lsp.formatter()) + + -- deprectaed options + if opts.autoformat ~= nil then + vim.g.autoformat = opts.autoformat + Util.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat") + end + -- setup keymaps Util.lsp.on_attach(function(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) @@ -215,6 +217,30 @@ return { }, } end, + config = function(_, opts) + require("null-ls").setup(opts) + + -- register the formatter with LazyVim + require("lazyvim.util").format.register({ + name = "none-ls.nvim", + priority = 50, + primary = true, + format = function(buf) + return Util.lsp.format({ + bufnr = buf, + filter = function(client) + return client.name == "null-ls" + end, + }) + end, + sources = function(buf) + local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {} + return vim.tbl_map(function(source) + return source.name + end, ret) + end, + }) + end, }, -- cmdline tools and lsp servers diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua new file mode 100644 index 0000000000..05f5f5fd6f --- /dev/null +++ b/lua/lazyvim/util/format.lua @@ -0,0 +1,147 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.format +---@overload fun(opts?: {force?:boolean}) +local M = setmetatable({}, { + __call = function(m, ...) + return m.format(...) + end, +}) + +---@class LazyFormatter +---@field name string +---@field primary? boolean +---@field format fun(bufnr:number) +---@field sources fun(bufnr:number):string[] +---@field priority number + +M.formatters = {} ---@type LazyFormatter[] + +---@param formatter LazyFormatter +function M.register(formatter) + M.formatters[#M.formatters + 1] = formatter + table.sort(M.formatters, function(a, b) + return a.priority > b.priority + end) +end + +---@param buf? number +---@return (LazyFormatter|{active:boolean,resolved:string[]})[] +function M.resolve(buf) + buf = buf or vim.api.nvim_get_current_buf() + local have_primary = false + ---@param formatter LazyFormatter + return vim.tbl_map(function(formatter) + local sources = formatter.sources(buf) + local active = #sources > 0 and (not formatter.primary or not have_primary) + have_primary = have_primary or (active and formatter.primary) or false + return setmetatable({ + active = active, + resolved = sources, + }, { __index = formatter }) + end, M.formatters) +end + +---@param buf? number +function M.info(buf) + buf = buf or vim.api.nvim_get_current_buf() + local gaf = vim.g.autoformat == nil or vim.g.autoformat + local baf = vim.b[buf].autoformat + local enabled = M.enabled(buf) + local lines = { + "# Status", + ("- [%s] global **%s**"):format(gaf and "x" or " ", gaf and "enabled" or "disabled"), + ("- [%s] buffer **%s**"):format( + enabled and "x" or " ", + baf == nil and "inherit" or baf and "enabled" or "disabled" + ), + } + local have = false + for _, formatter in ipairs(M.resolve(buf)) do + if #formatter.resolved > 0 then + have = true + lines[#lines + 1] = "\n# " .. formatter.name .. (formatter.active and " ***(active)***" or "") + for _, line in ipairs(formatter.resolved) do + lines[#lines + 1] = ("- [%s] **%s**"):format(formatter.active and "x" or " ", line) + end + end + end + if not have then + lines = { "\nNo formatters available for this buffer" } + end + Util[enabled and "info" or "warn"]( + table.concat(lines, "\n"), + { title = "LazyFormat (" .. (enabled and "enabled" or "disabled") .. ")" } + ) +end + +---@param buf? number +function M.enabled(buf) + buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf + local gaf = vim.g.autoformat + local baf = vim.b[buf].autoformat + + -- If the buffer has a local value, use that + if baf ~= nil then + return baf + end + + -- Otherwise use the global value if set, or true by default + return gaf == nil or gaf +end + +---@param buf? boolean +function M.toggle(buf) + if buf then + vim.b.autoformat = not M.enabled() + else + vim.g.autoformat = not M.enabled() + vim.b.autoformat = nil + end + M.info() +end + +---@param opts? {force?:boolean, buf?:number} +function M.format(opts) + opts = opts or {} + local buf = opts.buf or vim.api.nvim_get_current_buf() + if not ((opts and opts.force) or M.enabled(buf)) then + return + end + + local done = false + for _, formatter in ipairs(M.resolve(buf)) do + if formatter.active then + done = true + Util.try(function() + return formatter.format(buf) + end, { msg = "Formatter `" .. formatter.name .. "` failed" }) + end + end + + if not done and opts and opts.force then + Util.warn("No formatter available", { title = "LazyVim" }) + end +end + +function M.setup() + -- Autoformat autocmd + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("LazyFormat", {}), + callback = function(event) + M.format({ buf = event.buf }) + end, + }) + + -- Manual format + vim.api.nvim_create_user_command("LazyFormat", function() + M.format({ force = true }) + end, { desc = "Format selection or buffer" }) + + -- Format info + vim.api.nvim_create_user_command("LazyFormatInfo", function() + M.info() + end, { desc = "Show info about the formatters for the current buffer" }) +end + +return M From 70f91956e7f03e740b51cbc14c87df6a6f74538f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 21:51:09 +0200 Subject: [PATCH 349/513] perf(plugin): move all lazy.nvim related code to `lazyvim.util.plugin` --- lua/lazyvim/config/init.lua | 196 ++++------------------------------- lua/lazyvim/plugins/init.lua | 10 ++ lua/lazyvim/util/init.lua | 1 + lua/lazyvim/util/plugin.lua | 148 ++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 175 deletions(-) create mode 100644 lua/lazyvim/util/plugin.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 23ca90d431..201629fa58 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,10 +3,6 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.lazy_version = ">=10.8.0" -M.use_lazy_file = true -M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } - ---@class LazyVimOptions local defaults = { -- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme @@ -85,61 +81,13 @@ local defaults = { }, } -M.renames = { - ["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre", - ["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim", - ["null-ls.nvim"] = "none-ls.nvim", -} - ---@type LazyVimOptions local options ----@param lines {[1]:string, [2]:string}[] -function M.msg(lines) - vim.cmd([[clear]]) - vim.api.nvim_echo(lines, true, {}) - vim.fn.getchar() -end - ---@param opts? LazyVimOptions function M.setup(opts) options = vim.tbl_deep_extend("force", defaults, opts or {}) or {} - if vim.fn.has("nvim-0.9.0") == 0 then - M.msg({ - { - "LazyVim requires Neovim >= 0.9.0\n", - "ErrorMsg", - }, - { "Press any key to exit", "MoreMsg" }, - }) - vim.cmd([[quit]]) - return - end - - if not M.has() then - M.msg({ - { - "LazyVim requires lazy.nvim " .. M.lazy_version .. "\n", - "WarningMsg", - }, - { "Press any key to attempt an upgrade", "MoreMsg" }, - }) - - vim.api.nvim_create_autocmd("User", { - pattern = "LazyVimStarted", - callback = function() - require("lazy").update({ plugins = { "lazy.nvim" }, wait = true }) - M.msg({ - { - "**lazy.nvim** has been upgraded.\nPlease restart **Neovim**", - "WarningMsg", - }, - }) - end, - }) - end - -- autocmds can be loaded lazily when not opening a file local lazy_autocmds = vim.fn.argc(-1) == 0 if not lazy_autocmds then @@ -159,10 +107,6 @@ function M.setup(opts) end, }) - if M.use_lazy_file then - M.lazy_file() - end - Util.track("colorscheme") Util.try(function() if type(M.colorscheme) == "function" then @@ -180,64 +124,6 @@ function M.setup(opts) Util.track() end --- Properly load file based plugins without blocking the UI -function M.lazy_file() - local events = {} ---@type {event: string, buf: number, data?: any}[] - - local function load() - if #events == 0 then - return - end - local Event = require("lazy.core.handler.event") - vim.api.nvim_del_augroup_by_name("lazy_file") - - Util.track({ event = "LazyVim.lazy_file" }) - - ---@type table - local skips = {} - for _, event in ipairs(events) do - skips[event.event] = skips[event.event] or Event.get_augroups(event.event) - end - - vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) - for _, event in ipairs(events) do - 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 - vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) - events = {} - Util.track() - 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, - }) -end - ----@param range? string -function M.has(range) - local Semver = require("lazy.manage.semver") - return Semver.range(range or M.lazy_version):matches(require("lazy.core.config").version or "0.0.0") -end - ---@param name "autocmds" | "options" | "keymaps" function M.load(name) local function _load(mod) @@ -262,71 +148,31 @@ end M.did_init = false function M.init() - if not M.did_init then - M.did_init = true - local plugin = require("lazy.core.config").spec.plugins.LazyVim - if plugin then - vim.opt.rtp:append(plugin.dir) - end - - package.preload["lazyvim.plugins.lsp.format"] = function() - Util.deprecate([[require("lazyvim.plugins.lsp.format")]], [[require("lazyvim.util").format]]) - return Util.format - end + if M.did_init then + return + end + M.did_init = true + local plugin = require("lazy.core.config").spec.plugins.LazyVim + if plugin then + vim.opt.rtp:append(plugin.dir) + end - M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 - ---@diagnostic disable-next-line: undefined-field - M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil + package.preload["lazyvim.plugins.lsp.format"] = function() + Util.deprecate([[require("lazyvim.plugins.lsp.format")]], [[require("lazyvim.util").format]]) + return Util.format + end - -- delay notifications till vim.notify was replaced or after 500ms - require("lazyvim.util").lazy_notify() + -- delay notifications till vim.notify was replaced or after 500ms + require("lazyvim.util").lazy_notify() - -- load options here, before lazy init while sourcing plugin modules - -- this is needed to make sure options will be correctly applied - -- after installing missing plugins - M.load("options") - local Plugin = require("lazy.core.plugin") - local add = Plugin.Spec.add - ---@diagnostic disable-next-line: duplicate-set-field - Plugin.Spec.add = function(self, plugin, ...) - if type(plugin) == "table" then - if M.renames[plugin[1]] then - Util.warn( - ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( - plugin[1], - M.renames[plugin[1]], - self.importing or "LazyVim" - ), - { title = "LazyVim" } - ) - plugin[1] = M.renames[plugin[1]] - end - if not M.use_lazy_file and plugin.event then - if plugin.event == "LazyFile" then - plugin.event = M.lazy_file_events - elseif type(plugin.event) == "table" then - local events = {} ---@type string[] - for _, event in ipairs(plugin.event) do - if event == "LazyFile" then - vim.list_extend(events, M.lazy_file_events) - else - events[#events + 1] = event - end - end - end - end - end - return add(self, plugin, ...) - end + -- load options here, before lazy init while sourcing plugin modules + -- this is needed to make sure options will be correctly applied + -- after installing missing plugins + M.load("options") - -- Add support for the LazyFile event - local Event = require("lazy.core.handler.event") - local _event = Event._event - ---@diagnostic disable-next-line: duplicate-set-field - Event._event = function(self, value) - return value == "LazyFile" and "User LazyFile" or _event(self, value) - end - end + Util.plugin.fix_imports() + Util.plugin.fix_renames() + Util.plugin.lazy_file() end setmetatable(M, { diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index 847d84700e..8c7b5fa139 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -1,3 +1,13 @@ +if vim.fn.has("nvim-0.9.0") == 0 then + vim.api.nvim_echo({ + { "LazyVim requires Neovim >= 0.9.0\n", "ErrorMsg" }, + { "Press any key to exit", "MoreMsg" }, + }, true, {}) + vim.fn.getchar() + vim.cmd([[quit]]) + return {} +end + require("lazyvim.config").init() return { diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 146e73e20b..c46ac22e5a 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -8,6 +8,7 @@ local LazyUtil = require("lazy.core.util") ---@field terminal lazyvim.util.terminal ---@field toggle lazyvim.util.toggle ---@field format lazyvim.util.format +---@field plugin lazyvim.util.plugin local M = {} ---@type table diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua new file mode 100644 index 0000000000..a9d6ccd256 --- /dev/null +++ b/lua/lazyvim/util/plugin.lua @@ -0,0 +1,148 @@ +local Plugin = require("lazy.core.plugin") +local Util = require("lazyvim.util") + +---@class lazyvim.util.plugin +local M = {} + +M.use_lazy_file = true +M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } + +---@type table +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.", +} + +---@type table +M.renames = { + ["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre", + ["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim", + ["null-ls.nvim"] = "none-ls.nvim", +} + +-- 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 + ---@diagnostic disable-next-line: undefined-field + M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil + M.use_lazy_file = false + + M.fix_lazy_file() + + if not M.use_lazy_file then + return + end + + local events = {} ---@type {event: string, buf: number, data?: any}[] + + local function load() + if #events == 0 then + return + end + local Event = require("lazy.core.handler.event") + vim.api.nvim_del_augroup_by_name("lazy_file") + + Util.track({ event = "LazyVim.lazy_file" }) + + ---@type table + local skips = {} + for _, event in ipairs(events) do + skips[event.event] = skips[event.event] or Event.get_augroups(event.event) + end + + vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) + for _, event in ipairs(events) do + 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 + vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) + events = {} + Util.track() + 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, + }) +end + +function M.fix_imports() + local import = Plugin.Spec.import + ---@diagnostic disable-next-line: duplicate-set-field + function Plugin.Spec:import(spec) + local dep = M.deprecated_extras[spec and spec.import] + if dep then + dep = dep .. "\n" .. "Please remove the extra to hide this warning." + Util.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 }) + return + end + return import(self, spec) + end +end + +function M.fix_renames() + local add = Plugin.Spec.add + ---@diagnostic disable-next-line: duplicate-set-field + Plugin.Spec.add = function(self, plugin, ...) + if type(plugin) == "table" then + if M.renames[plugin[1]] then + Util.warn( + ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( + plugin[1], + M.renames[plugin[1]], + self.importing or "LazyVim" + ), + { title = "LazyVim" } + ) + plugin[1] = M.renames[plugin[1]] + end + end + return add(self, plugin, ...) + end +end + +function M.fix_lazy_file() + local Config = require("lazyvim.config") + -- Add support for the LazyFile event + local Handler = require("lazy.core.handler") + local Event = require("lazy.core.handler.event") + if M.use_lazy_file then + local _event = Event._event + ---@diagnostic disable-next-line: duplicate-set-field + Event._event = function(self, value) + return value == "LazyFile" and "User LazyFile" or _event(self, value) + end + else + ---@param plugin LazyPlugin + function Event:values(plugin) + local ret = Handler.values(self, plugin) + if ret["LazyFile"] or ret["User LazyFile"] then + for _, event in ipairs(M.lazy_file_events) do + ret[event] = event + end + ret["LazyFile"] = nil + ret["User LazyFile"] = nil + end + return ret + end + end +end + +return M From 14c091b1fc6b0dc0b22ac49ccac69f8a02e3844c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 22:12:33 +0200 Subject: [PATCH 350/513] feat!: make `conform.nvim` and `nvim-lint` the default formatters/linters --- .../plugins/extras/formatting/black.lua | 1 + .../plugins/extras/formatting/prettier.lua | 1 + lua/lazyvim/plugins/extras/lang/cmake.lua | 3 +- lua/lazyvim/plugins/extras/lang/docker.lua | 3 +- lua/lazyvim/plugins/extras/lang/elixir.lua | 3 +- lua/lazyvim/plugins/extras/lang/go.lua | 14 ++-- lua/lazyvim/plugins/extras/lang/omnisharp.lua | 1 + lua/lazyvim/plugins/extras/lang/terraform.lua | 12 ++-- lua/lazyvim/plugins/extras/lsp/none-ls.lua | 45 +++++++++++++ .../formatting/conform.lua => formatting.lua} | 0 lua/lazyvim/plugins/linting.lua | 67 +++++++++++++++++++ lua/lazyvim/plugins/lsp/init.lua | 43 ------------ lua/lazyvim/util/format.lua | 19 ++++++ 13 files changed, 148 insertions(+), 64 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/lsp/none-ls.lua rename lua/lazyvim/plugins/{extras/formatting/conform.lua => formatting.lua} (100%) create mode 100644 lua/lazyvim/plugins/linting.lua diff --git a/lua/lazyvim/plugins/extras/formatting/black.lua b/lua/lazyvim/plugins/extras/formatting/black.lua index bfa383a849..769c300904 100644 --- a/lua/lazyvim/plugins/extras/formatting/black.lua +++ b/lua/lazyvim/plugins/extras/formatting/black.lua @@ -10,6 +10,7 @@ return { optional = true, opts = function(_, opts) local nls = require("null-ls") + opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.black) end, }, diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 81fc1939d8..6f1f3b58ef 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -10,6 +10,7 @@ return { optional = true, opts = function(_, opts) local nls = require("null-ls") + opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.prettierd) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index bc7b235a3f..404a072a3a 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -12,8 +12,7 @@ return { optional = true, opts = function(_, opts) local nls = require("null-ls") - opts.sources = opts.sources or {} - vim.list_extend(opts.sources, { + opts.sources = vim.list_extend(opts.sources or {}, { nls.builtins.diagnostics.cmake_lint, }) end, diff --git a/lua/lazyvim/plugins/extras/lang/docker.lua b/lua/lazyvim/plugins/extras/lang/docker.lua index 86c7175ba8..da9605ec14 100644 --- a/lua/lazyvim/plugins/extras/lang/docker.lua +++ b/lua/lazyvim/plugins/extras/lang/docker.lua @@ -19,8 +19,7 @@ return { optional = true, opts = function(_, opts) local nls = require("null-ls") - opts.sources = opts.sources or {} - vim.list_extend(opts.sources, { + opts.sources = vim.list_extend(opts.sources or {}, { nls.builtins.diagnostics.hadolint, }) end, diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index 53454c37a8..f60dc18ed2 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -37,8 +37,7 @@ return { return end local nls = require("null-ls") - opts.sources = opts.sources or {} - vim.list_extend(opts.sources, { + opts.sources = vim.list_extend(opts.sources or {}, { nls.builtins.diagnostics.credo, }) end, diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 39410353cf..7e87678b79 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -86,14 +86,12 @@ return { "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) - if type(opts.sources) == "table" then - local nls = require("null-ls") - vim.list_extend(opts.sources, { - nls.builtins.code_actions.gomodifytags, - nls.builtins.code_actions.impl, - nls.builtins.formatting.goimports, - }) - end + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.code_actions.gomodifytags, + nls.builtins.code_actions.impl, + nls.builtins.formatting.goimports, + }) end, }, { diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index d244fd77f6..31162e0c04 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -13,6 +13,7 @@ return { optional = true, opts = function(_, opts) local nls = require("null-ls") + opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.csharpier) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 6e368ff31b..ea7bd5ded6 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -28,13 +28,11 @@ return { "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) - if type(opts.sources) == "table" then - local null_ls = require("null-ls") - vim.list_extend(opts.sources, { - null_ls.builtins.formatting.terraform_fmt, - null_ls.builtins.diagnostics.terraform_validate, - }) - end + local null_ls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + null_ls.builtins.formatting.terraform_fmt, + null_ls.builtins.diagnostics.terraform_validate, + }) end, }, { diff --git a/lua/lazyvim/plugins/extras/lsp/none-ls.lua b/lua/lazyvim/plugins/extras/lsp/none-ls.lua new file mode 100644 index 0000000000..aa907b8e28 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lsp/none-ls.lua @@ -0,0 +1,45 @@ +local Util = require("lazyvim.util") + +return { + -- none-ls + { + "nvimtools/none-ls.nvim", + event = "LazyFile", + dependencies = { "mason.nvim" }, + init = function() + Util.on_very_lazy(function() + -- register the formatter with LazyVim + require("lazyvim.util").format.register({ + name = "none-ls.nvim", + priority = 200, -- set higher than conform, the builtin formatter + primary = true, + format = function(buf) + return Util.lsp.format({ + bufnr = buf, + filter = function(client) + return client.name == "null-ls" + end, + }) + end, + sources = function(buf) + local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {} + return vim.tbl_map(function(source) + return source.name + end, ret) + end, + }) + end) + end, + opts = function(_, opts) + local nls = require("null-ls") + opts.root_dir = opts.root_dir + or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.formatting.fish_indent, + nls.builtins.diagnostics.fish, + nls.builtins.formatting.stylua, + nls.builtins.formatting.shfmt, + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/formatting/conform.lua b/lua/lazyvim/plugins/formatting.lua similarity index 100% rename from lua/lazyvim/plugins/extras/formatting/conform.lua rename to lua/lazyvim/plugins/formatting.lua diff --git a/lua/lazyvim/plugins/linting.lua b/lua/lazyvim/plugins/linting.lua new file mode 100644 index 0000000000..1fb7ab5dff --- /dev/null +++ b/lua/lazyvim/plugins/linting.lua @@ -0,0 +1,67 @@ +return { + { + "mfussenegger/nvim-lint", + event = "LazyFile", + opts = { + -- Event to trigger linters + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + fish = { "fish" }, + }, + -- LazyVim extension to easily override linter options + -- or add custom linters. + ---@type table + linters = { + -- -- Example of using selene only when a selene.toml file is present + -- selene = { + -- -- `condition` is another LazyVim extension that allows you to + -- -- dynamically enable/disable linters based on the context. + -- condition = function(ctx) + -- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + }, + }, + config = function(_, opts) + local M = {} + + local lint = require("lint") + for name, linter in pairs(opts.linters) do + if type(linter) == "table" and type(lint.linters) == "table" then + lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) + end + end + lint.linters_by_ft = opts.linters_by_ft + + function M.debounce(ms, fn) + local timer = vim.loop.new_timer() + return function(...) + local argv = { ... } + timer:start(ms, 0, function() + timer:stop() + vim.schedule_wrap(fn)(unpack(argv)) + end) + end + end + + function M.lint() + local names = lint.linters_by_ft[vim.bo.filetype] or {} + local ctx = { filename = vim.api.nvim_buf_get_name(0) } + ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") + names = vim.tbl_filter(function(name) + local linter = lint.linters[name] + return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) + end, names) + + if #names > 0 then + lint.try_lint(names) + end + end + + vim.api.nvim_create_autocmd(opts.events, { + group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }), + callback = M.debounce(100, M.lint), + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index b9e38e8bb9..165367bfcc 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -200,49 +200,6 @@ return { end, }, - -- formatters - { - "nvimtools/none-ls.nvim", - event = "LazyFile", - dependencies = { "mason.nvim" }, - opts = function() - local nls = require("null-ls") - return { - root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"), - sources = { - nls.builtins.formatting.fish_indent, - nls.builtins.diagnostics.fish, - nls.builtins.formatting.stylua, - nls.builtins.formatting.shfmt, - }, - } - end, - config = function(_, opts) - require("null-ls").setup(opts) - - -- register the formatter with LazyVim - require("lazyvim.util").format.register({ - name = "none-ls.nvim", - priority = 50, - primary = true, - format = function(buf) - return Util.lsp.format({ - bufnr = buf, - filter = function(client) - return client.name == "null-ls" - end, - }) - end, - sources = function(buf) - local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {} - return vim.tbl_map(function(source) - return source.name - end, ret) - end, - }) - end, - }, - -- cmdline tools and lsp servers { diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua index 05f5f5fd6f..b9822a952c 100644 --- a/lua/lazyvim/util/format.lua +++ b/lua/lazyvim/util/format.lua @@ -124,7 +124,26 @@ function M.format(opts) end end +function M.health() + local Config = require("lazy.core.config") + local has_plugin = Config.spec.plugins["none-ls.nvim"] + local has_extra = vim.tbl_contains(Config.spec.modules, "lazyvim.plugins.extras.lsp.none-ls") + if has_plugin and not has_extra then + Util.warn({ + "`conform.nvim` and `nvim-lint` are now the default forrmatters and linters in LazyVim.", + "", + "You can use those plugins together with `none-ls.nvim`,", + "but you need to enable the `lazyvim.plugins.extras.lsp.none-ls` extra,", + "for formatting to work correctly.", + "", + "In case you no longer want to use `none-ls.nvim`, just remove the spec from your config.", + }) + end +end + function M.setup() + M.health() + -- Autoformat autocmd vim.api.nvim_create_autocmd("BufWritePre", { group = vim.api.nvim_create_augroup("LazyFormat", {}), From 4cbe42cd247c72dfc70c3fcddfa3fb6b5e6485e0 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 22:41:34 +0200 Subject: [PATCH 351/513] feat(starter)!: `dashboard.nvim` is now the default starter. To keep using `alpha.nvim`, enable the extra. --- lua/lazyvim/plugins/extras/ui/alpha.lua | 77 ++++++++++ lua/lazyvim/plugins/extras/ui/dashboard.lua | 64 --------- lua/lazyvim/plugins/ui.lua | 151 ++++++++++---------- lua/lazyvim/util/plugin.lua | 1 + 4 files changed, 157 insertions(+), 136 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/ui/alpha.lua delete mode 100644 lua/lazyvim/plugins/extras/ui/dashboard.lua diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua new file mode 100644 index 0000000000..38019498c2 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -0,0 +1,77 @@ +return { + + { "glepnir/dashboard-nvim", enabled = false }, + { "echasnovski/mini.starter", enabled = false }, + -- Dashboard. This runs when neovim starts, and is what displays + -- the "LAZYVIM" banner. + { + "goolord/alpha-nvim", + event = "VimEnter", + enabled = true, + init = false, + opts = function() + local dashboard = require("alpha.themes.dashboard") + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + dashboard.section.header.val = vim.split(logo, "\n") + dashboard.section.buttons.val = { + dashboard.button("f", " " .. " Find file", " Telescope find_files "), + dashboard.button("n", " " .. " New file", " ene startinsert "), + dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), + dashboard.button("g", " " .. " Find text", " Telescope live_grep "), + dashboard.button("c", " " .. " Config", " e $MYVIMRC "), + dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), + dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), + dashboard.button("q", " " .. " Quit", " qa "), + } + for _, button in ipairs(dashboard.section.buttons.val) do + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + end + dashboard.section.header.opts.hl = "AlphaHeader" + dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.section.footer.opts.hl = "AlphaFooter" + dashboard.opts.layout[1].val = 8 + return dashboard + end, + config = function(_, dashboard) + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + once = true, + pattern = "AlphaReady", + callback = function() + require("lazy").show() + end, + }) + end + + require("alpha").setup(dashboard.opts) + + vim.api.nvim_create_autocmd("User", { + once = true, + pattern = "LazyVimStarted", + callback = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + dashboard.section.footer.val = "⚡ Neovim loaded " + .. stats.loaded + .. "/" + .. stats.count + .. " plugins in " + .. ms + .. "ms" + pcall(vim.cmd.AlphaRedraw) + end, + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/dashboard.lua b/lua/lazyvim/plugins/extras/ui/dashboard.lua deleted file mode 100644 index 2c678f36bb..0000000000 --- a/lua/lazyvim/plugins/extras/ui/dashboard.lua +++ /dev/null @@ -1,64 +0,0 @@ -return { - { "goolord/alpha-nvim", enabled = false }, - { "echasnovski/mini.starter", enabled = false }, - { - "glepnir/dashboard-nvim", - event = "VimEnter", - opts = function() - local logo = [[ - ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z - ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z - ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z - ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z - ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] - - logo = string.rep("\n", 8) .. logo .. "\n\n" - - local opts = { - theme = "doom", - hide = { - -- this is taken care of by lualine - -- enabling this messes up the actual laststatus setting after loading a file - statusline = false, - }, - config = { - header = vim.split(logo, "\n"), - center = { - { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, - { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, - { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, - { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = "qa", desc = " Quit", icon = " ", key = "q" }, - }, - footer = function() - local stats = require("lazy").stats() - local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } - end, - }, - } - - for _, button in ipairs(opts.config.center) do - button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - end - - -- close Lazy and re-open when the dashboard is ready - if vim.o.filetype == "lazy" then - vim.cmd.close() - vim.api.nvim_create_autocmd("User", { - pattern = "DashboardLoaded", - callback = function() - require("lazy").show() - end, - }) - end - - return opts - end, - }, -} diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index f1bac0312b..9cb5237b2a 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -155,7 +155,11 @@ return { cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, color = Util.ui.fg("Debug"), }, - { require("lazy.status").updates, cond = require("lazy.status").has_updates, color = Util.ui.fg("Special") }, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = Util.ui.fg("Special"), + }, { "diff", symbols = { @@ -295,77 +299,6 @@ return { }, }, - -- Dashboard. This runs when neovim starts, and is what displays - -- the "LAZYVIM" banner. - { - "goolord/alpha-nvim", - event = "VimEnter", - opts = function() - local dashboard = require("alpha.themes.dashboard") - local logo = [[ - ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z - ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z - ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z - ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z - ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] - - dashboard.section.header.val = vim.split(logo, "\n") - dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", " Telescope find_files "), - dashboard.button("n", " " .. " New file", " ene startinsert "), - dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), - dashboard.button("g", " " .. " Find text", " Telescope live_grep "), - dashboard.button("c", " " .. " Config", " e $MYVIMRC "), - dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), - dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), - dashboard.button("q", " " .. " Quit", " qa "), - } - for _, button in ipairs(dashboard.section.buttons.val) do - button.opts.hl = "AlphaButtons" - button.opts.hl_shortcut = "AlphaShortcut" - end - dashboard.section.header.opts.hl = "AlphaHeader" - dashboard.section.buttons.opts.hl = "AlphaButtons" - dashboard.section.footer.opts.hl = "AlphaFooter" - dashboard.opts.layout[1].val = 8 - return dashboard - end, - config = function(_, dashboard) - -- close Lazy and re-open when the dashboard is ready - if vim.o.filetype == "lazy" then - vim.cmd.close() - vim.api.nvim_create_autocmd("User", { - once = true, - pattern = "AlphaReady", - callback = function() - require("lazy").show() - end, - }) - end - - require("alpha").setup(dashboard.opts) - - vim.api.nvim_create_autocmd("User", { - once = true, - pattern = "LazyVimStarted", - callback = function() - local stats = require("lazy").stats() - local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - dashboard.section.footer.val = "⚡ Neovim loaded " - .. stats.loaded - .. "/" - .. stats.count - .. " plugins in " - .. ms - .. "ms" - pcall(vim.cmd.AlphaRedraw) - end, - }) - end, - }, - -- lsp symbol navigation for lualine. This shows where -- in the code structure you are - within functions, classes, -- etc - in the statusline. @@ -396,4 +329,78 @@ return { -- ui components { "MunifTanjim/nui.nvim", lazy = true }, + + { + "goolord/alpha-nvim", + optional = true, + enabled = function() + require("lazyvim.util").warn({ + "`dashboard.nvim` is now the default LazyVim starter plugin.", + "", + "To keep using `alpha.nvim`, please enable the `lazyvim.plugins.extras.ui.alpha` extra.", + "Or to hide this message, remove the alpha spec from your config.", + }) + return false + end, + }, + { + "glepnir/dashboard-nvim", + event = "VimEnter", + opts = function() + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep("\n", 8) .. logo .. "\n\n" + + local opts = { + theme = "doom", + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, + config = { + header = vim.split(logo, "\n"), + center = { + { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, + { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) + end + + return opts + end, + }, } diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index a9d6ccd256..ca6a162b6e 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -11,6 +11,7 @@ M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } 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.", } ---@type table From e6d294df6fbd973644d4b7f9691d5f48cc5efdde Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Oct 2023 23:02:59 +0200 Subject: [PATCH 352/513] fix(ui): dont show left signs on virtual line numbers (wrap). Fixes #1654 --- lua/lazyvim/util/ui.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 22b70e4b6e..6c5a3c1f1f 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -101,6 +101,10 @@ function M.statuscolumn() end end + if vim.v.virtnum ~= 0 then + left = nil + end + vim.api.nvim_win_call(win, function() if vim.fn.foldclosed(vim.v.lnum) >= 0 then fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } From a2d604928b5629d14797437a26022065f7385216 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 08:59:18 +0200 Subject: [PATCH 353/513] feat(root): customizable root detection and `:LazyRoot` command --- lua/lazyvim/config/init.lua | 1 + lua/lazyvim/config/keymaps.lua | 4 +- lua/lazyvim/config/options.lua | 4 + lua/lazyvim/plugins/editor.lua | 2 +- lua/lazyvim/util/root.lua | 151 +++++++++++++++++++++++++-------- lua/lazyvim/util/telescope.lua | 2 +- 6 files changed, 126 insertions(+), 38 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 201629fa58..9319a67d56 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -104,6 +104,7 @@ function M.setup(opts) end M.load("keymaps") Util.format.setup() + Util.root.setup() end, }) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index ced9cdf7f3..79c0ee0614 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -115,7 +115,7 @@ if vim.lsp.inlay_hint then end -- lazygit -map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root.get(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) +map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) map("n", "gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) -- quit @@ -128,7 +128,7 @@ map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) map("n", "L", Util.changelog, {desc = "LazyVim Changelog"}) -- floating terminal -local lazyterm = function() Util.terminal(nil, { cwd = Util.root.get() }) end +local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end map("n", "ft", lazyterm, { desc = "Terminal (root dir)" }) map("n", "fT", function() Util.terminal() end, { desc = "Terminal (cwd)" }) map("n", "", lazyterm, { desc = "Terminal (root dir)" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 1649896bdb..630fce4285 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -5,6 +5,10 @@ vim.g.maplocalleader = "\\" -- Enable LazyVim auto format vim.g.autoformat = true +-- LazyVim root dir detection +-- Each entry can be a detector function like `lsp` or `cwd`, or a pattern like `.git` or `lua`. +vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } + local opt = vim.opt opt.autowrite = true -- Enable auto write diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 0fb6394430..dabcb8de56 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -11,7 +11,7 @@ return { { "fe", function() - require("neo-tree.command").execute({ toggle = true, dir = Util.root.get() }) + require("neo-tree.command").execute({ toggle = true, dir = Util.root() }) end, desc = "Explorer NeoTree (root dir)", }, diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 296e045b03..c97ecf8821 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -1,9 +1,122 @@ local Util = require("lazyvim.util") ---@class lazyvim.util.root -local M = {} +---@overload fun(): string +local M = setmetatable({}, { + __call = function(m) + return m.get() + end, +}) -M.patterns = { ".git", "lua" } +---@class LazyRoot +---@field paths string[] +---@field spec LazyRootSpec + +---@alias LazyRootSpec string|string[] + +---@type LazyRootSpec[] +M.spec = { "lsp", { ".git", "lua" }, "cwd" } + +M.detectors = {} + +function M.detectors.cwd() + return { vim.loop.cwd() } +end + +function M.detectors.lsp(buf) + if not M.bufpath(buf) then + return {} + end + local roots = {} ---@type string[] + for _, client in pairs(Util.lsp.get_clients({ bufnr = buf })) do + local workspace = client.config.workspace_folders + for _, ws in pairs(workspace or {}) do + roots[#roots + 1] = vim.uri_to_fname(ws.uri) + end + if client.config.root_dir then + roots[#roots + 1] = client.config.root_dir + end + end + return roots +end + +---@param patterns string[]|string +function M.detectors.pattern(buf, patterns) + patterns = type(patterns) == "string" and { patterns } or patterns + local path = M.bufpath(buf) or vim.loop.cwd() + local pattern = vim.fs.find(patterns, { path = path, upward = true })[1] + return pattern and { vim.fs.dirname(pattern) } or {} +end + +function M.bufpath(buf) + return M.realpath(vim.api.nvim_buf_get_name(assert(buf))) +end + +function M.realpath(path) + if path == "" or path == nil then + return nil + end + path = vim.loop.fs_realpath(path) or path + return Util.norm(path) +end + +---@param opts? { buf?: number, spec?: LazyRootSpec[], all?: boolean } +function M.detect(opts) + opts = opts or {} + opts.spec = opts.spec or type(vim.g.root_spec) == "table" and vim.g.root_spec or M.spec + opts.buf = (opts.buf == nil or opts.buf == 0) and vim.api.nvim_get_current_buf() or opts.buf + + local ret = {} ---@type LazyRoot[] + for _, spec in ipairs(opts.spec) do + local paths = M.detectors[spec] and M.detectors[spec](opts.buf) or M.detectors.pattern(opts.buf, spec) + local roots = {} ---@type string[] + for _, p in ipairs(paths) do + local pp = M.realpath(p) + if pp and not vim.tbl_contains(roots, pp) then + roots[#roots + 1] = pp + end + end + table.sort(roots, function(a, b) + return #a > #b + end) + if #roots > 0 then + ret[#ret + 1] = { spec = spec, paths = roots } + if opts.all == false then + break + end + end + end + return ret +end + +function M.setup() + vim.api.nvim_create_user_command("LazyRoot", function() + M.info() + end, { desc = "LazyVim roots for the current buffer" }) +end + +function M.info() + local spec = type(vim.g.root_spec) == "table" and vim.g.root_spec or M.spec + + local roots = M.detect({ all = true }) + local lines = {} ---@type string[] + local first = true + for _, root in ipairs(roots) do + for _, path in ipairs(root.paths) do + lines[#lines + 1] = ("- [%s] `%s` **(%s)**"):format( + first and "x" or " ", + path, + type(root.spec) == "table" and table.concat(root.spec, ", ") or root.spec + ) + first = false + end + end + lines[#lines + 1] = "```lua" + lines[#lines + 1] = "vim.g.root_spec = " .. vim.inspect(spec) + lines[#lines + 1] = "```" + require("lazyvim.util").info(lines, { title = "LazyVim Roots" }) + return roots[1] and roots[1].paths[1] or vim.loop.cwd() +end -- returns the root directory based on: -- * lsp workspace folders @@ -12,38 +125,8 @@ M.patterns = { ".git", "lua" } -- * root pattern of cwd ---@return string function M.get() - ---@type string? - local path = vim.api.nvim_buf_get_name(0) - path = path ~= "" and vim.loop.fs_realpath(path) or nil - ---@type string[] - local roots = {} - if path then - for _, client in pairs(Util.lsp.get_clients({ bufnr = 0 })) do - local workspace = client.config.workspace_folders - local paths = workspace and vim.tbl_map(function(ws) - return vim.uri_to_fname(ws.uri) - end, workspace) or client.config.root_dir and { client.config.root_dir } or {} - for _, p in ipairs(paths) do - local r = vim.loop.fs_realpath(p) - if path:find(r, 1, true) then - roots[#roots + 1] = r - end - end - end - end - table.sort(roots, function(a, b) - return #a > #b - end) - ---@type string? - local root = roots[1] - if not root then - path = path and vim.fs.dirname(path) or vim.loop.cwd() - ---@type string? - root = vim.fs.find(M.patterns, { path = path, upward = true })[1] - root = root and vim.fs.dirname(root) or vim.loop.cwd() - end - ---@cast root string - return root + local roots = M.detect({ all = false }) + return roots[1] and roots[1].paths[1] or vim.loop.cwd() end return M diff --git a/lua/lazyvim/util/telescope.lua b/lua/lazyvim/util/telescope.lua index 2aae403dfd..6891634115 100644 --- a/lua/lazyvim/util/telescope.lua +++ b/lua/lazyvim/util/telescope.lua @@ -22,7 +22,7 @@ function M.telescope(builtin, opts) return function() builtin = params.builtin opts = params.opts - opts = vim.tbl_deep_extend("force", { cwd = Util.root.get() }, opts or {}) --[[@as lazyvim.util.telescope.opts]] + opts = vim.tbl_deep_extend("force", { cwd = Util.root() }, opts or {}) --[[@as lazyvim.util.telescope.opts]] if builtin == "files" then if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then opts.show_untracked = true From f59cdff4d9f04ff349cefdee0b363d573954ce0d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 09:15:50 +0200 Subject: [PATCH 354/513] fix(plugin): enable lazy_file --- 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 ca6a162b6e..d22e7cb0fb 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -26,7 +26,6 @@ function M.lazy_file() M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0 ---@diagnostic disable-next-line: undefined-field M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil - M.use_lazy_file = false M.fix_lazy_file() From c33e7489ecdaef7295a63079410f2f24a1cbc9b6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 09:38:34 +0200 Subject: [PATCH 355/513] feat(root): allow custom functions as part of `vim.g.root_spec` --- lua/lazyvim/config/options.lua | 5 ++++- lua/lazyvim/util/root.lua | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 630fce4285..5a071a15c9 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -6,7 +6,10 @@ vim.g.maplocalleader = "\\" vim.g.autoformat = true -- LazyVim root dir detection --- Each entry can be a detector function like `lsp` or `cwd`, or a pattern like `.git` or `lua`. +-- Each entry can be: +-- * the name of a detector function like `lsp` or `cwd` +-- * a pattern or array of patterns like `.git` or `lua`. +-- * a function with signature `function(buf) -> string|string[]` vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } local opt = vim.opt diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index c97ecf8821..fe263a7c31 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -12,7 +12,9 @@ local M = setmetatable({}, { ---@field paths string[] ---@field spec LazyRootSpec ----@alias LazyRootSpec string|string[] +---@alias LazyRootFn fun(buf: number): (string|string[]) + +---@alias LazyRootSpec string|string[]|LazyRootFn ---@type LazyRootSpec[] M.spec = { "lsp", { ".git", "lua" }, "cwd" } @@ -60,6 +62,19 @@ function M.realpath(path) return Util.norm(path) end +---@param spec LazyRootSpec +---@return LazyRootFn +function M.resolve(spec) + if M.detectors[spec] then + return M.detectors[spec] + elseif type(spec) == "function" then + return spec + end + return function(buf) + return M.detectors.pattern(buf, spec) + end +end + ---@param opts? { buf?: number, spec?: LazyRootSpec[], all?: boolean } function M.detect(opts) opts = opts or {} @@ -68,7 +83,9 @@ function M.detect(opts) local ret = {} ---@type LazyRoot[] for _, spec in ipairs(opts.spec) do - local paths = M.detectors[spec] and M.detectors[spec](opts.buf) or M.detectors.pattern(opts.buf, spec) + local paths = M.resolve(spec)(opts.buf) + paths = paths or {} + paths = type(paths) == "table" and paths or { paths } local roots = {} ---@type string[] for _, p in ipairs(paths) do local pp = M.realpath(p) From a4abbdc89bd1d49378ac5873db1279e7e5398927 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 09:51:12 +0200 Subject: [PATCH 356/513] fix(format): always show formatter status even when no sources available --- lua/lazyvim/util/format.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua index b9822a952c..af64a6f5e5 100644 --- a/lua/lazyvim/util/format.lua +++ b/lua/lazyvim/util/format.lua @@ -67,7 +67,7 @@ function M.info(buf) end end if not have then - lines = { "\nNo formatters available for this buffer" } + lines[#lines+1] = "\n***No formatters available for this buffer.***" end Util[enabled and "info" or "warn"]( table.concat(lines, "\n"), From 83734675b0f93fbd11a350ee0662c09995836b59 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 14:26:16 +0200 Subject: [PATCH 357/513] fix(lualine): when opening nvim with a file, show an empty statusline till lualine loads --- lua/lazyvim/plugins/ui.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 9cb5237b2a..3259b4eb3e 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -101,7 +101,13 @@ return { event = "VeryLazy", init = function() vim.g.lualine_laststatus = vim.o.laststatus - vim.o.laststatus = 0 + if vim.fn.argc(-1) > 0 then + -- set an empty statusline till lualine loads + vim.o.statusline = " " + else + -- hide the statusline on the starter page + vim.o.laststatus = 0 + end end, opts = function() local icons = require("lazyvim.config").icons From 4ea1c6865e6d877207de8626e11a5a863950ae55 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 14:27:10 +0200 Subject: [PATCH 358/513] feat(config): use lazy's new custom events (`Event.mappings`) for a better `LazyFile` --- lua/lazyvim/util/plugin.lua | 45 +++++++++---------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index d22e7cb0fb..b3650eaa9f 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -24,12 +24,18 @@ M.renames = { -- 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 - ---@diagnostic disable-next-line: undefined-field - M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil - M.fix_lazy_file() + -- Add support for the LazyFile event + local Event = require("lazy.core.handler.event") - if not M.use_lazy_file then + 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 @@ -39,11 +45,8 @@ function M.lazy_file() if #events == 0 then return end - local Event = require("lazy.core.handler.event") vim.api.nvim_del_augroup_by_name("lazy_file") - Util.track({ event = "LazyVim.lazy_file" }) - ---@type table local skips = {} for _, event in ipairs(events) do @@ -67,7 +70,6 @@ function M.lazy_file() end vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) events = {} - Util.track() end -- schedule wrap so that nested autocmds are executed @@ -118,31 +120,4 @@ function M.fix_renames() end end -function M.fix_lazy_file() - local Config = require("lazyvim.config") - -- Add support for the LazyFile event - local Handler = require("lazy.core.handler") - local Event = require("lazy.core.handler.event") - if M.use_lazy_file then - local _event = Event._event - ---@diagnostic disable-next-line: duplicate-set-field - Event._event = function(self, value) - return value == "LazyFile" and "User LazyFile" or _event(self, value) - end - else - ---@param plugin LazyPlugin - function Event:values(plugin) - local ret = Handler.values(self, plugin) - if ret["LazyFile"] or ret["User LazyFile"] then - for _, event in ipairs(M.lazy_file_events) do - ret[event] = event - end - ret["LazyFile"] = nil - ret["User LazyFile"] = nil - end - return ret - end - end -end - return M From 8fbde2c3668960ed085f9225bb4650aca77cc495 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 14:27:41 +0200 Subject: [PATCH 359/513] fix(neo-tree): during init check global argslist instead of window-local --- lua/lazyvim/plugins/editor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index dabcb8de56..e2c08b98af 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -29,7 +29,7 @@ return { vim.cmd([[Neotree close]]) end, init = function() - if vim.fn.argc() == 1 then + if vim.fn.argc(-1) == 1 then local stat = vim.loop.fs_stat(vim.fn.argv(0)) if stat and stat.type == "directory" then require("neo-tree") From 54fa9ce584b9d029fb9f016f1e3be5daca29beaa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 15:25:29 +0200 Subject: [PATCH 360/513] ci: let release-please manage the version in the config file --- .github/workflows/ci.yml | 2 ++ lua/lazyvim/config/init.lua | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 964a780f82..2ffff686fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,8 @@ jobs: with: release-type: simple package-name: LazyVim + extra-files: | + lua/lazyvim/config/init.lua - uses: actions/checkout@v3 - name: tag stable versions if: ${{ steps.release.outputs.release_created }} diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 9319a67d56..5cf7feff07 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,6 +3,8 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} +M.version = "10.0.0" -- x-release-please-version + ---@class LazyVimOptions local defaults = { -- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme From 7fb79486ed1b251b98b95a44ef50b3742edd708d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 17:39:46 +0200 Subject: [PATCH 361/513] fix(notify): set default zindex=100 --- lua/lazyvim/plugins/ui.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 3259b4eb3e..c22e079122 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -19,6 +19,9 @@ return { max_width = function() return math.floor(vim.o.columns * 0.75) end, + on_open = function(win) + vim.api.nvim_win_set_config(win, { zindex = 100 }) + end, }, init = function() -- when noice is not enabled, install notify on VeryLazy From 11d66e713467410add9ad5a7a68a3bca0aa24082 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 17:47:16 +0200 Subject: [PATCH 362/513] feat(config): load/save some data in lazyvim.json --- lua/lazyvim/config/init.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 5cf7feff07..92bd1f69c2 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -83,6 +83,35 @@ local defaults = { }, } +M.json = { + data = { + version = nil, ---@type string? + extras = {}, ---@type string[] + }, +} + +function M.json.load() + local path = vim.fn.stdpath("config") .. "/lazyvim.json" + local f = io.open(path, "r") + if f then + local data = f:read("*a") + f:close() + local ok, json = pcall(vim.json.decode, data, { luanil = { object = true, array = true } }) + if ok then + M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {}) + end + end +end + +function M.json.save() + local path = vim.fn.stdpath("config") .. "/lazyvim.json" + local f = io.open(path, "w") + if f then + f:write(vim.json.encode(M.json.data)) + f:close() + end +end + ---@type LazyVimOptions local options @@ -176,6 +205,7 @@ function M.init() Util.plugin.fix_imports() Util.plugin.fix_renames() Util.plugin.lazy_file() + M.json.load() end setmetatable(M, { From c4e55e4d67a7195b7aa9160cd8ece3ddc2f6cb51 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 17:48:40 +0200 Subject: [PATCH 363/513] feat(ui): added `:LazyExtras` to manage enabled extras in LazyVim --- lua/lazyvim/config/init.lua | 10 +- .../plugins/extras/linting/nvim-lint.lua | 67 ------ lua/lazyvim/plugins/xtras.lua | 6 + lua/lazyvim/util/extras.lua | 202 ++++++++++++++++++ lua/lazyvim/util/init.lua | 1 + lua/lazyvim/util/root.lua | 6 - 6 files changed, 218 insertions(+), 74 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/linting/nvim-lint.lua create mode 100644 lua/lazyvim/plugins/xtras.lua create mode 100644 lua/lazyvim/util/extras.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 92bd1f69c2..076a003e54 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -134,8 +134,16 @@ function M.setup(opts) M.load("autocmds") end M.load("keymaps") + Util.format.setup() - Util.root.setup() + + vim.api.nvim_create_user_command("LazyRoot", function() + Util.root.info() + end, { desc = "LazyVim roots for the current buffer" }) + + vim.api.nvim_create_user_command("LazyExtras", function() + Util.extras.show() + end, { desc = "Manage LazyVim extras" }) end, }) diff --git a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua b/lua/lazyvim/plugins/extras/linting/nvim-lint.lua deleted file mode 100644 index 1fb7ab5dff..0000000000 --- a/lua/lazyvim/plugins/extras/linting/nvim-lint.lua +++ /dev/null @@ -1,67 +0,0 @@ -return { - { - "mfussenegger/nvim-lint", - event = "LazyFile", - opts = { - -- Event to trigger linters - events = { "BufWritePost", "BufReadPost", "InsertLeave" }, - linters_by_ft = { - fish = { "fish" }, - }, - -- LazyVim extension to easily override linter options - -- or add custom linters. - ---@type table - linters = { - -- -- Example of using selene only when a selene.toml file is present - -- selene = { - -- -- `condition` is another LazyVim extension that allows you to - -- -- dynamically enable/disable linters based on the context. - -- condition = function(ctx) - -- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] - -- end, - -- }, - }, - }, - config = function(_, opts) - local M = {} - - local lint = require("lint") - for name, linter in pairs(opts.linters) do - if type(linter) == "table" and type(lint.linters) == "table" then - lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) - end - end - lint.linters_by_ft = opts.linters_by_ft - - function M.debounce(ms, fn) - local timer = vim.loop.new_timer() - return function(...) - local argv = { ... } - timer:start(ms, 0, function() - timer:stop() - vim.schedule_wrap(fn)(unpack(argv)) - end) - end - end - - function M.lint() - local names = lint.linters_by_ft[vim.bo.filetype] or {} - local ctx = { filename = vim.api.nvim_buf_get_name(0) } - ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") - names = vim.tbl_filter(function(name) - local linter = lint.linters[name] - return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) - end, names) - - if #names > 0 then - lint.try_lint(names) - end - end - - vim.api.nvim_create_autocmd(opts.events, { - group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }), - callback = M.debounce(100, M.lint), - }) - end, - }, -} diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua new file mode 100644 index 0000000000..0a6ed6143a --- /dev/null +++ b/lua/lazyvim/plugins/xtras.lua @@ -0,0 +1,6 @@ +local Config = require("lazyvim.config") + +---@param extra string +return vim.tbl_map(function(extra) + return { import = "lazyvim.plugins.extras." .. extra } +end, Config.json.data.extras) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua new file mode 100644 index 0000000000..6e7bb74207 --- /dev/null +++ b/lua/lazyvim/util/extras.lua @@ -0,0 +1,202 @@ +local Config = require("lazyvim.config") +local Float = require("lazy.view.float") +local LazyConfig = require("lazy.core.config") +local Plugin = require("lazy.core.plugin") +local Text = require("lazy.view.text") +local Util = require("lazyvim.util") + +---@class LazyExtra +---@field name string +---@field enabled boolean +---@field managed boolean +---@field row? number +---@field plugins string[] + +---@class lazyvim.util.extras +local M = {} + +M.prios = { + ["editor.aerial"] = 100, + ["test.core"] = 1, + ["dap.core"] = 1, +} + +M.ns = vim.api.nvim_create_namespace("lazyvim.extras") +---@type string[] +M.state = nil + +---@return LazyExtra[] +function M.get() + M.state = M.state or LazyConfig.spec.modules + local root = LazyConfig.plugins.LazyVim.dir .. "/lua/lazyvim/plugins/extras" + local extras = {} ---@type string[] + + Util.walk(root, function(path, name, type) + if type == "file" and name:match("%.lua$") then + local extra = path:sub(#root + 2, -5):gsub("/", ".") + extras[#extras + 1] = extra + end + end) + table.sort(extras) + + ---@param extra string + return vim.tbl_map(function(extra) + local modname = "lazyvim.plugins.extras." .. extra + local enabled = vim.tbl_contains(M.state, modname) + local spec = Plugin.Spec.new({ import = "lazyvim.plugins.extras." .. extra }, { optional = false }) + return { + name = extra, + enabled = enabled, + managed = vim.tbl_contains(Config.json.data.extras, extra) or not enabled, + plugins = vim.tbl_keys(spec.plugins), + } + end, extras) +end + +---@class LazyExtraView +---@field float LazyFloat +---@field text Text +---@field extras LazyExtra[] +---@field diag LazyDiagnostic[] +local X = {} + +---@return LazyExtraView +function X.new() + local self = setmetatable({}, { __index = X }) + self.float = Float.new({ title = "LazyVim Extras" }) + self.float:on_key("x", function() + self:toggle() + end, "Toggle extra") + self.diag = {} + self:update() + return self +end + +---@param diag LazyDiagnostic +function X:diagnostic(diag) + diag.row = diag.row or self.text:row() + diag.severity = diag.severity or vim.diagnostic.severity.INFO + table.insert(self.diag, diag) +end + +function X:toggle() + local pos = vim.api.nvim_win_get_cursor(self.float.win) + for _, extra in ipairs(self.extras) do + if extra.row == pos[1] then + if not extra.managed then + Util.error( + "Not managed by LazyExtras. Remove from your config to enable/disable here.", + { title = "LazyExtras" } + ) + return + end + extra.enabled = not extra.enabled + Config.json.data.extras = vim.tbl_filter(function(name) + return name ~= extra.name + end, Config.json.data.extras) + M.state = vim.tbl_filter(function(name) + return name ~= "lazyvim.plugins.extras." .. extra.name + end, M.state) + if extra.enabled then + table.insert(Config.json.data.extras, extra.name) + M.state[#M.state + 1] = "lazyvim.plugins.extras." .. extra.name + end + table.sort(Config.json.data.extras, function(a, b) + local pa = M.prios[a] or 10 + local pb = M.prios[b] or 10 + if pa == pb then + return a < b + end + return pa < pb + end) + Config.json.save() + Util.info( + "`" + .. extra.name + .. "`" + .. " " + .. (extra.enabled and "**enabled**" or "**disabled**") + .. "\nPlease restart LazyVim to apply the changes.", + { title = "LazyExtras" } + ) + self:update() + return + end + end +end + +function X:update() + self.diag = {} + self.extras = M.get() + self.text = Text.new() + self.text.padding = 2 + self:render() + self.text:trim() + vim.bo[self.float.buf].modifiable = true + self.text:render(self.float.buf) + vim.bo[self.float.buf].modifiable = false + vim.diagnostic.set( + M.ns, + self.float.buf, + ---@param diag LazyDiagnostic + vim.tbl_map(function(diag) + diag.col = 0 + diag.lnum = diag.row - 1 + return diag + end, self.diag), + { signs = false, virtual_text = true } + ) +end + +function X:render() + self.text:nl():nl():append("LazyVim Extras", "LazyH1"):nl():nl() + self.text + :append("Enable/disable extras with the ", "LazyComment") + :append("", "LazySpecial") + :append(" key", "LazyComment") + :nl() + self:section({ enabled = true, title = "Enabled" }) + self:section({ enabled = false, title = "Disabled" }) +end + +---@param extra LazyExtra +function X:extra(extra) + if not extra.managed then + self:diagnostic({ + message = "Not managed by LazyExtras (config)", + severity = vim.diagnostic.severity.WARN, + }) + end + extra.row = self.text:row() + local hl = extra.managed and "LazySpecial" or "LazyLocal" + if extra.enabled then + self.text:append(" " .. LazyConfig.options.ui.icons.loaded .. " ", hl) + else + self.text:append(" " .. LazyConfig.options.ui.icons.not_loaded .. " ", hl) + end + self.text:append(extra.name) + for _, plugin in ipairs(extra.plugins) do + self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin") + end + self.text:nl() +end + +---@param opts {enabled?:boolean, title?:string} +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 + end, self.extras) + + self.text:nl():append(opts.title .. ":", "LazyH2"):append(" (" .. #extras .. ")", "LazyComment"):nl() + for _, extra in ipairs(extras) do + self:extra(extra) + end +end + +function M.show() + return X.new() +end + +return M diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index c46ac22e5a..90f9a89e65 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -9,6 +9,7 @@ local LazyUtil = require("lazy.core.util") ---@field toggle lazyvim.util.toggle ---@field format lazyvim.util.format ---@field plugin lazyvim.util.plugin +---@field extras lazyvim.util.extras local M = {} ---@type table diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index fe263a7c31..707ba5f82b 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -106,12 +106,6 @@ function M.detect(opts) return ret end -function M.setup() - vim.api.nvim_create_user_command("LazyRoot", function() - M.info() - end, { desc = "LazyVim roots for the current buffer" }) -end - function M.info() local spec = type(vim.g.root_spec) == "table" and vim.g.root_spec or M.spec From 5bb74205a06a89f048902ba142473dd679b228b8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 18:10:04 +0200 Subject: [PATCH 364/513] feat(dashboard): added LazyExtras shortcut to dashboard/alpha --- lua/lazyvim/plugins/extras/ui/alpha.lua | 1 + lua/lazyvim/plugins/ui.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index 38019498c2..8778ab354f 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -28,6 +28,7 @@ return { dashboard.button("g", " " .. " Find text", " Telescope live_grep "), dashboard.button("c", " " .. " Config", " e $MYVIMRC "), dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), + dashboard.button("e", " " .. " LazyExtras", " LazyExtras "), dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), dashboard.button("q", " " .. " Quit", " qa "), } diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index c22e079122..3fff80825c 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -383,6 +383,7 @@ return { { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " LazyExtras", icon = " ", key = "e" }, { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, { action = "qa", desc = " Quit", icon = " ", key = "q" }, }, From 592f3b03bb3cd01df42ee5db4cd6ba43937f067e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 18:38:29 +0200 Subject: [PATCH 365/513] fix(root): only use workspace folders that contain the buffer --- lua/lazyvim/util/root.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 707ba5f82b..54f44169ca 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -26,7 +26,8 @@ function M.detectors.cwd() end function M.detectors.lsp(buf) - if not M.bufpath(buf) then + local bufpath = M.bufpath(buf) + if not bufpath then return {} end local roots = {} ---@type string[] @@ -39,7 +40,10 @@ function M.detectors.lsp(buf) roots[#roots + 1] = client.config.root_dir end end - return roots + return vim.tbl_filter(function(path) + path = Util.norm(path) + return path and bufpath:find(path, 1, true) == 1 + end, roots) end ---@param patterns string[]|string From 305e82f2cacd5d0074027ea545a87a41379afc88 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 22:36:45 +0200 Subject: [PATCH 366/513] feat(navic): moved navic to extras --- lua/lazyvim/plugins/extras/editor/navic.lua | 42 +++++++++++++++++++++ lua/lazyvim/plugins/ui.lua | 27 ------------- 2 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/editor/navic.lua diff --git a/lua/lazyvim/plugins/extras/editor/navic.lua b/lua/lazyvim/plugins/extras/editor/navic.lua new file mode 100644 index 0000000000..359c42d4ca --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/navic.lua @@ -0,0 +1,42 @@ +return { + -- lsp symbol navigation for lualine. This shows where + -- in the code structure you are - within functions, classes, + -- etc - in the statusline. + { + "SmiteshP/nvim-navic", + lazy = true, + init = function() + vim.g.navic_silence = true + require("lazyvim.util").lsp.on_attach(function(client, buffer) + if client.supports_method("textDocument/documentSymbol") then + require("nvim-navic").attach(client, buffer) + end + end) + end, + opts = function() + return { + separator = " ", + highlight = true, + depth_limit = 5, + icons = require("lazyvim.config").icons.kinds, + lazy_update_context = true, + } + end, + }, + + -- lualine integration + { + "nvim-lualine/lualine.nvim", + optional = true, + opts = function(_, opts) + table.insert(opts.sections.lualine_c, { + function() + return require("nvim-navic").get_location() + end, + cond = function() + return package.loaded["nvim-navic"] and require("nvim-navic").is_available() + end, + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 3fff80825c..4ab461fa61 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -141,8 +141,6 @@ return { { "filename", path = 1, symbols = { modified = "  ", readonly = "", unnamed = "" } }, -- stylua: ignore { - function() return require("nvim-navic").get_location() end, - cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end, }, }, lualine_x = { @@ -308,31 +306,6 @@ return { }, }, - -- lsp symbol navigation for lualine. This shows where - -- in the code structure you are - within functions, classes, - -- etc - in the statusline. - { - "SmiteshP/nvim-navic", - lazy = true, - init = function() - vim.g.navic_silence = true - require("lazyvim.util").lsp.on_attach(function(client, buffer) - if client.supports_method("textDocument/documentSymbol") then - require("nvim-navic").attach(client, buffer) - end - end) - end, - opts = function() - return { - separator = " ", - highlight = true, - depth_limit = 5, - icons = require("lazyvim.config").icons.kinds, - lazy_update_context = true, - } - end, - }, - -- icons { "nvim-tree/nvim-web-devicons", lazy = true }, From 8d7361c4602993a7ea119cb7ce78d421b6787dfb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 22:37:28 +0200 Subject: [PATCH 367/513] feat(root): cached pretty path function for statuslines --- lua/lazyvim/plugins/ui.lua | 5 +++-- lua/lazyvim/util/root.lua | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 4ab461fa61..a364d4600b 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -138,9 +138,10 @@ return { }, }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, - { "filename", path = 1, symbols = { modified = "  ", readonly = "", unnamed = "" } }, - -- stylua: ignore { + function() + return Util.root.pretty_path() + end, }, }, lualine_x = { diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 54f44169ca..d799fe441c 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -144,4 +144,38 @@ function M.get() return roots[1] and roots[1].paths[1] or vim.loop.cwd() end +M.pretty_cache = {} ---@type table +function M.pretty_path() + local path = vim.fn.expand("%:p") --[[@as string]] + if path == "" then + return "" + end + + path = Util.norm(path) + if M.pretty_cache[path] then + return M.pretty_cache[path] + end + local cache_key = path + local cwd = M.realpath(vim.loop.cwd()) or "" + + if path:find(cwd, 1, true) == 1 then + path = path:sub(#cwd + 2) + else + local roots = M.detect({ spec = { ".git" } }) + local root = roots[1] and roots[1].paths[1] or nil + if root then + path = path:sub(#vim.fs.dirname(root) + 2) + end + end + + local sep = package.config:sub(1, 1) + local parts = vim.split(path, "[\\/]") + if #parts > 3 then + parts = { parts[1], "…", parts[#parts - 1], parts[#parts] } + end + local ret = table.concat(parts, sep) + M.pretty_cache[cache_key] = ret + return ret +end + return M From e239235cd34ac9c286eac1e620670784566ef673 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 22:38:10 +0200 Subject: [PATCH 368/513] feat(util): inject module --- lua/lazyvim/config/init.lua | 4 +--- lua/lazyvim/util/init.lua | 1 + lua/lazyvim/util/inject.lua | 20 ++++++++++++++++++++ lua/lazyvim/util/plugin.lua | 22 +++++++++++----------- 4 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 lua/lazyvim/util/inject.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 076a003e54..04c43f05e0 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -210,9 +210,7 @@ function M.init() -- after installing missing plugins M.load("options") - Util.plugin.fix_imports() - Util.plugin.fix_renames() - Util.plugin.lazy_file() + Util.plugin.setup() M.json.load() end diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 90f9a89e65..5cfd4e77ec 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -10,6 +10,7 @@ local LazyUtil = require("lazy.core.util") ---@field format lazyvim.util.format ---@field plugin lazyvim.util.plugin ---@field extras lazyvim.util.extras +---@field inject lazyvim.util.inject local M = {} ---@type table diff --git a/lua/lazyvim/util/inject.lua b/lua/lazyvim/util/inject.lua new file mode 100644 index 0000000000..bf0d11f3ed --- /dev/null +++ b/lua/lazyvim/util/inject.lua @@ -0,0 +1,20 @@ +---@class lazyvim.util.inject +local M = {} + +---@generic A: any +---@generic B: any +---@generic C: any +---@generic F: function +---@param fn F|fun(a:A, b:B, c:C) +---@param wrapper fun(a:A, b:B, c:C): boolean? +---@return F +function M.args(fn, wrapper) + return function(...) + if wrapper(...) == false then + return + end + return fn(...) + end +end + +return M diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index b3650eaa9f..7491ca7d74 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -21,6 +21,12 @@ M.renames = { ["null-ls.nvim"] = "none-ls.nvim", } +function M.setup() + M.fix_imports() + M.fix_renames() + M.lazy_file() +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 @@ -86,23 +92,18 @@ function M.lazy_file() end function M.fix_imports() - local import = Plugin.Spec.import - ---@diagnostic disable-next-line: duplicate-set-field - function Plugin.Spec:import(spec) + Plugin.Spec.import = Util.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." Util.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 }) - return + return false end - return import(self, spec) - end + end) end function M.fix_renames() - local add = Plugin.Spec.add - ---@diagnostic disable-next-line: duplicate-set-field - Plugin.Spec.add = function(self, plugin, ...) + Plugin.Spec.add = Util.inject.args(Plugin.Spec.add, function(self, plugin) if type(plugin) == "table" then if M.renames[plugin[1]] then Util.warn( @@ -116,8 +117,7 @@ function M.fix_renames() plugin[1] = M.renames[plugin[1]] end end - return add(self, plugin, ...) - end + end) end return M From d8250910bdc4fce7ede914811f786d75ca028b48 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 22:38:38 +0200 Subject: [PATCH 369/513] style(config): mini.align icons --- lua/lazyvim/config/init.lua | 91 +++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 04c43f05e0..b3146eef3a 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -20,65 +20,68 @@ local defaults = { -- if you want to disable loading options, add `package.loaded["lazyvim.config.options"] = true` to the top of your init.lua }, -- icons used by other plugins + -- stylua: ignore icons = { misc = { dots = "󰇘", }, dap = { - Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, - Breakpoint = " ", + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", BreakpointCondition = " ", - BreakpointRejected = { " ", "DiagnosticError" }, - LogPoint = ".>", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", }, diagnostics = { Error = " ", - Warn = " ", - Hint = " ", - Info = " ", + Warn = " ", + Hint = " ", + Info = " ", }, git = { - added = " ", + added = " ", modified = " ", - removed = " ", + removed = " ", }, kinds = { - Array = " ", - Boolean = " ", - Class = " ", - Codeium = "󰘦 ", - Color = " ", - Constant = " ", - Constructor = " ", - Copilot = " ", - Enum = " ", - EnumMember = " ", - Event = " ", - Field = " ", - File = " ", - Folder = " ", - Function = " ", - Interface = " ", - Key = " ", - Keyword = " ", - Method = " ", - Module = " ", - Namespace = " ", - Null = " ", - Number = " ", - Object = " ", - Operator = " ", - Package = " ", - Property = " ", - Reference = " ", - Snippet = " ", - String = " ", - Struct = " ", - Text = " ", + Array = " ", + Boolean = "󰨙 ", + Class = " ", + Codeium = "󰘦 ", + Color = " ", + Control = " ", + Collapsed = " ", + Constant = "󰏿 ", + Constructor = " ", + Copilot = " ", + Enum = " ", + EnumMember = " ", + Event = " ", + Field = " ", + File = " ", + Folder = " ", + Function = "󰊕 ", + Interface = " ", + Key = " ", + Keyword = " ", + Method = "󰊕 ", + Module = " ", + Namespace = "󰦮 ", + Null = " ", + Number = "󰎠 ", + Object = " ", + Operator = " ", + Package = " ", + Property = " ", + Reference = " ", + Snippet = " ", + String = " ", + Struct = "󰆼 ", + Text = " ", TypeParameter = " ", - Unit = " ", - Value = " ", - Variable = " ", + Unit = " ", + Value = " ", + Variable = "󰀫 ", }, }, } From cb7f5aca7a04cf2d1d06397e9a80fe078d17976b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Oct 2023 22:39:24 +0200 Subject: [PATCH 370/513] feat(treesitter): install nvim-ts-autotag by default --- lua/lazyvim/plugins/treesitter.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 47e58f1d49..e4b5096649 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -103,4 +103,10 @@ return { require("nvim-treesitter.configs").setup(opts) end, }, + -- Automatically add closing tags for HTML and JSX + { + "windwp/nvim-ts-autotag", + event = "InsertEnter", + opts = {}, + }, } From eb7a7d7a8e586d30ed6839f4a621e0f019d32410 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 00:09:04 +0200 Subject: [PATCH 371/513] feat(config): make kind filter configurable for telescope/aerial/... --- lua/lazyvim/config/init.lua | 31 +++++++++++++++++++++++++ lua/lazyvim/plugins/editor.lua | 42 ++++++++-------------------------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index b3146eef3a..217f0d5348 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -84,6 +84,26 @@ local defaults = { Variable = "󰀫 ", }, }, + ---@type table? + kind_filter = { + default = { + "Class", + "Constructor", + "Enum", + "Field", + "Function", + "Interface", + "Method", + "Module", + "Property", + "Struct", + "Trait", + }, + -- you can specify a different filter for each filetype + -- lua = { + -- "Function", + -- }, + }, } M.json = { @@ -167,6 +187,17 @@ function M.setup(opts) Util.track() end +---@param buf? number +---@return string[]? +function M.get_kind_filter(buf) + buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf + local ft = vim.bo[buf].filetype + if M.kind_filter == false then + return + end + return M.kind_filter[ft] or M.kind_filter.default +end + ---@param name "autocmds" | "options" | "keymaps" function M.load(name) local function _load(mod) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index e2c08b98af..6e1d63b64e 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -150,42 +150,20 @@ return { { "uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" }, { "ss", - Util.telescope("lsp_document_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - "Enum", - "Constant", - }, - }), + function() + require("telescope.builtin").lsp_document_symbols({ + symbols = require("lazyvim.config").get_kind_filter(), + }) + end, desc = "Goto Symbol", }, { "sS", - Util.telescope("lsp_dynamic_workspace_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - "Enum", - "Constant", - }, - }), + function() + require("telescope.builtin").lsp_dynamic_workspace_symbols({ + symbols = require("lazyvim.config").get_kind_filter(), + }) + end, desc = "Goto Symbol (Workspace)", }, }, From 13dbe4ad55a4e4b9a3dd345521b359411cdc5879 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 00:09:38 +0200 Subject: [PATCH 372/513] perf(lualine): get rid of lualine's weird lualine_require --- lua/lazyvim/plugins/ui.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index a364d4600b..bef741ec69 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -113,6 +113,10 @@ return { end end, opts = function() + -- PERF: we don't need this lualine require madness 🤷 + local lualine_require = require("lualine_require") + lualine_require.require = require + local icons = require("lazyvim.config").icons local Util = require("lazyvim.util") From 7b2c31740782fb0754ce715be6ea128083e48c4f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 00:11:12 +0200 Subject: [PATCH 373/513] feat(treesitter): add nvim-treesitter-context by default --- lua/lazyvim/plugins/treesitter.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index e4b5096649..c833a707a1 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -103,6 +103,15 @@ return { require("nvim-treesitter.configs").setup(opts) end, }, + + -- Show context of the current function + { + "nvim-treesitter/nvim-treesitter-context", + event = "LazyFile", + enabled = true, + opts = { mode = "cursor" }, + }, + -- Automatically add closing tags for HTML and JSX { "windwp/nvim-ts-autotag", From b43c57d943b2a13460d45f01a288e98cb54f2c1f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 00:11:33 +0200 Subject: [PATCH 374/513] feat: added aerial extra with integrations for edgy, telescope and lualine --- lua/lazyvim/plugins/extras/editor/aerial.lua | 133 +++++++++++++++++++ lua/lazyvim/util/plugin.lua | 9 ++ 2 files changed, 142 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/editor/aerial.lua diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua new file mode 100644 index 0000000000..2d86d0d06b --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -0,0 +1,133 @@ +local Config = require("lazyvim.config") +local Util = require("lazyvim.util") + +return { + { + "stevearc/aerial.nvim", + event = "LazyFile", + opts = function() + ---@diagnostic disable-next-line: no-unknown + local lualine = require("lualine.components.aerial") + + -- Strip trailing spaces from symbols in statusline + ---@param _ any + ---@param symbols {icon?:string}[] + lualine.format_status = Util.inject.args(lualine.format_status, function(_, symbols) + for _, s in ipairs(symbols) do + s.icon = s.icon and s.icon:gsub("%s*$", "") or nil + end + end) + + local icons = vim.deepcopy(Config.icons.kinds) + + -- HACK: fix lua's weird choice for `Package` for control + -- structures like if/else/for/etc. + icons.lua = { Package = icons.Control } + + ---@type table|false + local filter_kind = false + if Config.kind_filter then + filter_kind = assert(vim.deepcopy(Config.kind_filter)) + filter_kind._ = filter_kind.default + filter_kind.default = nil + end + + local opts = { + attach_mode = "global", + backends = { "lsp", "treesitter", "markdown", "man" }, + show_guides = true, + layout = { + resize_to_content = false, + win_opts = { + winhl = "Normal:NormalFloat,FloatBorder:NormalFloat,SignColumn:SignColumnSB", + signcolumn = "yes", + statuscolumn = " ", + }, + }, + icons = icons, + filter_kind = filter_kind, + -- stylua: ignore + guides = { + mid_item = "├╴", + last_item = "└╴", + nested_top = "│ ", + whitespace = " ", + }, + } + return opts + end, + keys = { + { "cs", "SymbolsOutline", desc = "Symbols Outline" }, + }, + }, + + -- Telescope integration + { + "nvim-telescope/telescope.nvim", + opts = function() + Util.on_load("telescope.nvim", function() + require("telescope").load_extension("aerial") + end) + end, + keys = { + { + "ss", + "Telescope aerial", + desc = "Goto Symbol (Aerial)", + }, + }, + }, + + -- edgy integration + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + local edgy_idx = Util.plugin.extra_idx("ui.edgy") + local aerial_idx = Util.plugin.extra_idx("editor.aerial") + + if edgy_idx and edgy_idx > aerial_idx then + Util.warn("The `edgy.nvim` extra must be **imported** before the `aerial.nvim` extra to work properly.", { + title = "LazyVim", + }) + end + + opts.right = opts.right or {} + table.insert(opts.right, { + title = "Aerial", + ft = "aerial", + pinned = true, + open = "AerialOpen", + }) + end, + }, + + -- lualine integration + { + "nvim-lualine/lualine.nvim", + optional = true, + opts = function(_, opts) + table.insert(opts.sections.lualine_c, { + "aerial", + -- The separator to be used to separate symbols in status line. + sep = " ", + + -- The number of symbols to render top-down. In order to render only 'N' last + -- symbols, negative numbers may be supplied. For instance, 'depth = -1' can + -- be used in order to render only current symbol. + depth = 5, + + -- When 'dense' mode is on, icons are not rendered near their symbols. Only + -- a single icon that represents the kind of current symbol is rendered at + -- the beginning of status line. + dense = false, + + -- The separator to be used to separate symbols in dense mode. + dense_sep = ".", + + -- Color the symbol icons. + colored = true, + }) + end, + }, +} diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 7491ca7d74..c022758f41 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -27,6 +27,15 @@ function M.setup() M.lazy_file() end +function M.extra_idx(name) + local Config = require("lazy.core.config") + for i, extra in ipairs(Config.spec.modules) do + if extra == "lazyvim.plugins.extras." .. name then + return i + end + 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 From eedb4a34050443448d0b752e22803d5b1278b419 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 00:20:32 +0200 Subject: [PATCH 375/513] feat(ui): show optional plugins in a different color --- lua/lazyvim/plugins/extras/editor/aerial.lua | 1 + lua/lazyvim/util/extras.lua | 25 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua index 2d86d0d06b..9f0abdcb01 100644 --- a/lua/lazyvim/plugins/extras/editor/aerial.lua +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -64,6 +64,7 @@ return { -- Telescope integration { "nvim-telescope/telescope.nvim", + optional = true, opts = function() Util.on_load("telescope.nvim", function() require("telescope").load_extension("aerial") diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 6e7bb74207..c3c2e52bb3 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -11,6 +11,7 @@ local Util = require("lazyvim.util") ---@field managed boolean ---@field row? number ---@field plugins string[] +---@field optional string[] ---@class lazyvim.util.extras local M = {} @@ -43,12 +44,25 @@ function M.get() return vim.tbl_map(function(extra) local modname = "lazyvim.plugins.extras." .. extra local enabled = vim.tbl_contains(M.state, modname) - local spec = Plugin.Spec.new({ import = "lazyvim.plugins.extras." .. extra }, { optional = false }) + local spec = Plugin.Spec.new({ import = "lazyvim.plugins.extras." .. extra }, { optional = true }) + local plugins = {} ---@type string[] + local optional = {} ---@type string[] + for _, p in pairs(spec.plugins) do + if p.optional then + optional[#optional + 1] = p.name + else + plugins[#plugins + 1] = p.name + end + end + table.sort(plugins) + table.sort(optional) + return { name = extra, enabled = enabled, managed = vim.tbl_contains(Config.json.data.extras, extra) or not enabled, - plugins = vim.tbl_keys(spec.plugins), + plugins = plugins, + optional = optional, } end, extras) end @@ -151,6 +165,10 @@ end function X:render() self.text:nl():nl():append("LazyVim Extras", "LazyH1"):nl():nl() self.text + :append("This is a list of all enabled/disabled LazyVim extras.", "LazyComment") + :nl() + :append("Each extra shows the required and optional plugins it may install.", "LazyComment") + :nl() :append("Enable/disable extras with the ", "LazyComment") :append("", "LazySpecial") :append(" key", "LazyComment") @@ -178,6 +196,9 @@ function X:extra(extra) for _, plugin in ipairs(extra.plugins) do self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin") end + for _, plugin in ipairs(extra.optional) do + self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonRequire") + end self.text:nl() end From 1c34af7f0138323d9f465437d0bcef621a8dbe94 Mon Sep 17 00:00:00 2001 From: Bassam Data <105807570+bassamsdata@users.noreply.github.com> Date: Thu, 12 Oct 2023 01:28:49 -0400 Subject: [PATCH 376/513] feat(mini.starter): adding mini.starter to lualine disabled files (#1667) --- 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 bef741ec69..7f8b29c570 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -126,7 +126,7 @@ return { options = { theme = "auto", globalstatus = true, - disabled_filetypes = { statusline = { "dashboard", "alpha" } }, + disabled_filetypes = { statusline = { "dashboard", "alpha", "starter"} }, }, sections = { lualine_a = { "mode" }, From c7720275c3fa8b19c9ad7e05bfb6ed5c510bf2bb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 07:30:40 +0200 Subject: [PATCH 377/513] fix(aerial): keymap --- lua/lazyvim/plugins/extras/editor/aerial.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua index 9f0abdcb01..d46149b1ab 100644 --- a/lua/lazyvim/plugins/extras/editor/aerial.lua +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -57,7 +57,7 @@ return { return opts end, keys = { - { "cs", "SymbolsOutline", desc = "Symbols Outline" }, + { "cs", "AerialToggle", desc = "Aerial (Symbols)" }, }, }, From 85215f396b6fd4de24636a202ec1149dafa5f7b5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 09:42:31 +0200 Subject: [PATCH 378/513] fix(nlua): make nlua dap work with regular continue. Fixes #1666 --- lua/lazyvim/plugins/extras/dap/core.lua | 1 - lua/lazyvim/plugins/extras/dap/nlua.lua | 49 +++++++++++++++++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 1f079630fb..72aabdedd7 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -54,7 +54,6 @@ return { opts = { defaults = { ["d"] = { name = "+debug" }, - ["da"] = { name = "+adapters" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/dap/nlua.lua b/lua/lazyvim/plugins/extras/dap/nlua.lua index 21a9e51dac..12bf63eaf2 100644 --- a/lua/lazyvim/plugins/extras/dap/nlua.lua +++ b/lua/lazyvim/plugins/extras/dap/nlua.lua @@ -1,24 +1,59 @@ +local Util = require("lazyvim.util") + return { "mfussenegger/nvim-dap", + launch = function(host, port) + if vim.g.nlua then + return + end + vim.o.cmdheight = 10 + local osv = require("osv") + osv.launch({ + port = port, + host = host, + args = { "--cmd", "lua vim.g.nlua = true", "--cmd", "set cmdheight=10" }, + }) + vim.defer_fn(function() + vim.cmd([[luafile %]]) + end, 2000) + end, + dependencies = { { "jbyuki/one-small-step-for-vimkind", -- stylua: ignore - keys = { - { "daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server", ft = "lua" }, - { "dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" }, - }, config = function() local dap = require("dap") - dap.adapters.nlua = function(callback, config) - callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 }) + dap.adapters.nlua = function(callback, conf) + local adapter = { + type = "server", + host = conf.host or "127.0.0.1", + port = conf.port or 8086, + } + if conf.start_neovim then + local dap_run = dap.run + dap.run = function(c) + adapter.port = c.port + adapter.host = c.host + end + require("osv").run_this() + dap.run = dap_run + end + callback(adapter) end dap.configurations.lua = { { type = "nlua", request = "attach", - name = "Attach to running Neovim instance", + name = "Run this file", + start_neovim = {}, + }, + { + type = "nlua", + request = "attach", + name = "Attach to running Neovim instance (port = 8086)", + port = 8086, }, } end, From 14f3f036e9223315f310ba9d35182690638e7bd7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 09:42:48 +0200 Subject: [PATCH 379/513] feat(inject): util method to get upvalue --- lua/lazyvim/util/inject.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/lazyvim/util/inject.lua b/lua/lazyvim/util/inject.lua index bf0d11f3ed..81e0f57a66 100644 --- a/lua/lazyvim/util/inject.lua +++ b/lua/lazyvim/util/inject.lua @@ -17,4 +17,18 @@ function M.args(fn, wrapper) end end +function M.get_upvalue(func, name) + local i = 1 + while true do + local n, v = debug.getupvalue(func, i) + if not n then + break + end + if n == name then + return v + end + i = i + 1 + end +end + return M From ba4b8dfecbd79f4498b04a3899a11f948c026244 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 09:43:24 +0200 Subject: [PATCH 380/513] refactor(nlua): cleanup --- lua/lazyvim/plugins/extras/dap/nlua.lua | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/nlua.lua b/lua/lazyvim/plugins/extras/dap/nlua.lua index 12bf63eaf2..9cf0e63d7a 100644 --- a/lua/lazyvim/plugins/extras/dap/nlua.lua +++ b/lua/lazyvim/plugins/extras/dap/nlua.lua @@ -1,24 +1,5 @@ -local Util = require("lazyvim.util") - return { "mfussenegger/nvim-dap", - - launch = function(host, port) - if vim.g.nlua then - return - end - vim.o.cmdheight = 10 - local osv = require("osv") - osv.launch({ - port = port, - host = host, - args = { "--cmd", "lua vim.g.nlua = true", "--cmd", "set cmdheight=10" }, - }) - vim.defer_fn(function() - vim.cmd([[luafile %]]) - end, 2000) - end, - dependencies = { { "jbyuki/one-small-step-for-vimkind", From 72f3cc684bd1e8f19b2d3c56da3f359032b8c5dc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 10:18:50 +0200 Subject: [PATCH 381/513] fix(dap): copy config before overriding args --- lua/lazyvim/plugins/extras/dap/core.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 72aabdedd7..c9aa291a5f 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -1,6 +1,7 @@ ---@param config {args?:string[]|fun():string[]?} local function get_args(config) local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + config = vim.deepcopy(config) ---@cast args string[] config.args = function() local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] From db5d28b039f656ccb47d3b9f787e8bb482cc6ec1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 10:35:47 +0200 Subject: [PATCH 382/513] fix(plugin): add nvim-treesitter-context rename warning --- lua/lazyvim/util/plugin.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index c022758f41..75d4989939 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -19,6 +19,7 @@ M.renames = { ["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre", ["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim", ["null-ls.nvim"] = "none-ls.nvim", + ["romgrk/nvim-treesitter-context"] = "nvim-treesitter/nvim-treesitter-context", } function M.setup() From 3256abda65ae03358ecdbef1c7789782440fe39e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 10:36:15 +0200 Subject: [PATCH 383/513] fix(plugin): show warning of removed core plugin when trying to load them without having the extra --- lua/lazyvim/util/plugin.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 75d4989939..f23bec3bcb 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -14,6 +14,12 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.", } +M.deprecated_modules = { + ["null-ls"] = "lsp.none-ls", + ["nvim-navic.lib"] = "editor.navic", + ["nvim-navic"] = "editor.navic", +} + ---@type table M.renames = { ["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre", @@ -26,6 +32,18 @@ function M.setup() M.fix_imports() M.fix_renames() M.lazy_file() + table.insert(package.loaders, function(module) + if M.deprecated_modules[module] then + Util.warn( + ("`%s` is no longer included by default in **LazyVim**.\nPlease install the `%s` extra if you still want to use it."):format( + module, + M.deprecated_modules[module] + ), + { title = "LazyVim" } + ) + return function() end + end + end) end function M.extra_idx(name) From a4e393154f61b95da5835b6461e211eb94740268 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 11:14:02 +0200 Subject: [PATCH 384/513] fix(extras): make sure we use priorities to import extras in correct order --- lua/lazyvim/plugins/xtras.lua | 17 +++++++++++++++++ lua/lazyvim/util/extras.lua | 15 +-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 0a6ed6143a..009bb6fa56 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -1,5 +1,22 @@ local Config = require("lazyvim.config") +-- Some extras need to be loaded before others +local prios = { + ["editor.aerial"] = 100, + ["editor.symbols-outline"] = 100, + ["test.core"] = 1, + ["dap.core"] = 1, +} + +table.sort(Config.json.data.extras, function(a, b) + local pa = prios[a] or 10 + local pb = prios[b] or 10 + if pa == pb then + return a < b + end + return pa < pb +end) + ---@param extra string return vim.tbl_map(function(extra) return { import = "lazyvim.plugins.extras." .. extra } diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index c3c2e52bb3..c71e328c96 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -16,12 +16,6 @@ local Util = require("lazyvim.util") ---@class lazyvim.util.extras local M = {} -M.prios = { - ["editor.aerial"] = 100, - ["test.core"] = 1, - ["dap.core"] = 1, -} - M.ns = vim.api.nvim_create_namespace("lazyvim.extras") ---@type string[] M.state = nil @@ -115,14 +109,7 @@ function X:toggle() table.insert(Config.json.data.extras, extra.name) M.state[#M.state + 1] = "lazyvim.plugins.extras." .. extra.name end - table.sort(Config.json.data.extras, function(a, b) - local pa = M.prios[a] or 10 - local pb = M.prios[b] or 10 - if pa == pb then - return a < b - end - return pa < pb - end) + table.sort(Config.json.data.extras) Config.json.save() Util.info( "`" From f64039f54620fe3fc9e8f464e35b184c6834ed6e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 11:14:23 +0200 Subject: [PATCH 385/513] feat(config): better kind filter default for lua to deal with luals weirdness --- lua/lazyvim/config/init.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 217f0d5348..2f7e018472 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -95,14 +95,28 @@ local defaults = { "Interface", "Method", "Module", + "Namespace", + "Package", "Property", "Struct", "Trait", }, -- you can specify a different filter for each filetype - -- lua = { - -- "Function", - -- }, + lua = { + "Class", + "Constructor", + "Enum", + "Field", + "Function", + "Interface", + "Method", + "Module", + "Namespace", + -- "Package", -- remove package since luals uses it for control flow structures + "Property", + "Struct", + "Trait", + }, }, } From b4ba5d881dcb801d3c502665f9767d2f75ca1110 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 11:14:44 +0200 Subject: [PATCH 386/513] feat(extras): added extra for `symbols-outline.nvim` --- .../plugins/extras/editor/symbols-outline.lua | 55 +++++++++++++++++++ lua/lazyvim/plugins/extras/ui/edgy.lua | 9 --- 2 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/editor/symbols-outline.lua diff --git a/lua/lazyvim/plugins/extras/editor/symbols-outline.lua b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua new file mode 100644 index 0000000000..f0b0ba922b --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua @@ -0,0 +1,55 @@ +local Util = require("lazyvim.util") + +return { + { + "simrat39/symbols-outline.nvim", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + cmd = "SymbolsOutline", + opts = function() + local Config = require("lazyvim.config") + local defaults = require("symbols-outline.config").defaults + local opts = { + symbols = {}, + symbol_blacklist = {}, + } + + for kind, symbol in pairs(defaults.symbols) do + opts.symbols[kind] = { + icon = Config.icons.kinds[kind] or symbol.icon, + hl = symbol.hl, + } + if not vim.tbl_contains(Config.kind_filter.default, kind) then + table.insert(opts.symbol_blacklist, kind) + end + end + return opts + end, + }, + + -- edgy integration + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + local edgy_idx = Util.plugin.extra_idx("ui.edgy") + local symbols_idx = Util.plugin.extra_idx("editor.symbols-outline") + + if edgy_idx and edgy_idx > symbols_idx then + Util.warn( + "The `edgy.nvim` extra must be **imported** before the `symbols-outline.nvim` extra to work properly.", + { + title = "LazyVim", + } + ) + end + + opts.right = opts.right or {} + table.insert(opts.right, { + title = "Symbols Outline", + ft = "Outline", + pinned = true, + open = "SymbolsOutline", + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 8692d4812f..64e6237ae5 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -105,15 +105,6 @@ return { end, }, } - local Util = require("lazyvim.util") - if Util.has("symbols-outline.nvim") then - table.insert(opts.left, { - title = "Outline", - ft = "Outline", - pinned = true, - open = "SymbolsOutline", - }) - end return opts end, }, From ce74e28464daa7d694f9ab4e41fae3174e30c8b3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 11:20:46 +0200 Subject: [PATCH 387/513] feat(starter): added Lazy Extras to `mini.starter` --- lua/lazyvim/plugins/extras/ui/alpha.lua | 17 +++++++++-------- .../plugins/extras/ui/mini-starter.lua | 15 ++++++++------- lua/lazyvim/plugins/ui.lua | 19 ++++++++++--------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index 8778ab354f..d05c941cc2 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -21,16 +21,17 @@ return { ]] dashboard.section.header.val = vim.split(logo, "\n") + -- stylua: ignore dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", " Telescope find_files "), - dashboard.button("n", " " .. " New file", " ene startinsert "), - dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), - dashboard.button("g", " " .. " Find text", " Telescope live_grep "), - dashboard.button("c", " " .. " Config", " e $MYVIMRC "), + dashboard.button("f", " " .. " Find file", " Telescope find_files "), + dashboard.button("n", " " .. " New file", " ene startinsert "), + dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), + dashboard.button("g", " " .. " Find text", " Telescope live_grep "), + dashboard.button("c", " " .. " Config", " e $MYVIMRC "), dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), - dashboard.button("e", " " .. " LazyExtras", " LazyExtras "), - dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), - dashboard.button("q", " " .. " Quit", " qa "), + dashboard.button("e", " " .. " Lazy Extras", " LazyExtras "), + dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), + dashboard.button("q", " " .. " Quit", " qa "), } for _, button in ipairs(dashboard.section.buttons.val) do button.opts.hl = "AlphaButtons" diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 04a578be2b..6ec0e572f1 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -29,13 +29,14 @@ return { evaluate_single = true, header = logo, items = { - new_section("Find file", "Telescope find_files", "Telescope"), - new_section("Recent files", "Telescope oldfiles", "Telescope"), - new_section("Grep text", "Telescope live_grep", "Telescope"), - new_section("init.lua", "e $MYVIMRC", "Config"), - new_section("Lazy", "Lazy", "Config"), - new_section("New file", "ene | startinsert", "Built-in"), - new_section("Quit", "qa", "Built-in"), + new_section("Find file", "Telescope find_files", "Telescope"), + new_section("Recent files", "Telescope oldfiles", "Telescope"), + new_section("Grep text", "Telescope live_grep", "Telescope"), + new_section("init.lua", "e $MYVIMRC", "Config"), + new_section("Extras", "LazyExtras", "Config"), + new_section("Lazy", "Lazy", "Config"), + new_section("New file", "ene | startinsert", "Built-in"), + new_section("Quit", "qa", "Built-in"), new_section("Session restore", [[lua require("persistence").load()]], "Session"), }, content_hooks = { diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 7f8b29c570..e821c33e85 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -126,7 +126,7 @@ return { options = { theme = "auto", globalstatus = true, - disabled_filetypes = { statusline = { "dashboard", "alpha", "starter"} }, + disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } }, }, sections = { lualine_a = { "mode" }, @@ -354,16 +354,17 @@ return { }, config = { header = vim.split(logo, "\n"), + -- stylua: ignore center = { - { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, - { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, - { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, - { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, + { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, + { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " LazyExtras", icon = " ", key = "e" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = "qa", desc = " Quit", icon = " ", key = "q" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "e" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, }, footer = function() local stats = require("lazy").stats() From 442077fca3cbca73746909c4bc7e1029d35fecad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Oct 2023 09:48:46 +0000 Subject: [PATCH 388/513] 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 a950794a12..ea9ed565c2 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 11 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 12 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 73acab16758d37982bd6b2d9b2be37c4ee83cde3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 14:38:25 +0200 Subject: [PATCH 389/513] feat: added NEWS.md and option to automatically show when changed (enabled by default) --- NEWS.md | 65 ++++++++++++++++++++++++++++ lua/lazyvim/config/init.lua | 9 ++++ lua/lazyvim/config/keymaps.lua | 2 +- lua/lazyvim/util/init.lua | 9 +--- lua/lazyvim/util/news.lua | 77 ++++++++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 NEWS.md create mode 100644 lua/lazyvim/util/news.lua diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000000..af6fca2f7c --- /dev/null +++ b/NEWS.md @@ -0,0 +1,65 @@ +# What's new? + +## 10.x + +- `nvim-ts-autotag` is now included by default + +- `nvim-treesitter-context` is now included by default + +- Added extra for `symbols-outline.nvim` + +- Added extra for `aerial.nvim` + +- `nvim-navic` has been removed. If you want to keep using `nvim-navic`, + you can enable the **editor.navic** extra + +- New `:LazyExtras` command for managing **LazyVim** extras + +- Improved **formatting**: + + - **LazyVim** can now work with multiple formatters. Types: + + - **primary**: only one primary formatter can be active at a time. + _(conform, none-ls, LSP)_ + - **secondary**: multiple secondary formatters can be active _(eslint, ...)_ + + - **LazyVim** automatically selects the primary formatter based on the + current available sources and priorities. + + - New `:LazyFormat` command for formatting the current selection or buffer + - New `:LazyFormatInfo` command for displaying the active formatters + for the current buffer + - Auto-formatting can be disabled with: + + ```lua + vim.g.autoformat = false -- globally + vim.b.autoformat = false -- buffer-local + ``` + +- `none-ls.nvim` is no longer installed by default + + - `conform.nvim` is now the default formatter + - `nvim-lint` is now the default linter + - If you want to keep using `none-ls.nvim`, + you can enable the **lsp.none-ls** extra + +- `dashboard.nvim` is the new default dashboard plugin + + - If you want to keep using `alpha.nvim`, you can enable the **ui.alpha** extra + +- Improved **root detection**: + + - New `:LazyRoot` command that shows info about the root dir detection + - Configurable with `vim.g.root_spec` + + ```lua + -- LazyVim root dir detection + -- Each entry can be: + -- * the name of a detector function like `lsp` or `cwd` + -- * a pattern or array of patterns like `.git` or `lua`. + -- * a function with signature `function(buf) -> string|string[]` + vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } + + -- To disable root detection set to just "cwd" + vim.g.root_spec = { "cwd" } + ``` diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 2f7e018472..07bb1ed693 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -19,6 +19,13 @@ local defaults = { -- lazyvim.config.options can't be configured here since that's loaded before lazyvim setup -- if you want to disable loading options, add `package.loaded["lazyvim.config.options"] = true` to the top of your init.lua }, + news = { + -- When enabled, NEWS.md will be shown when changed. + -- This only contains big new features and breaking changes. + lazyvim = true, + -- Same but for Neovim's news.txt + neovim = false, + }, -- icons used by other plugins -- stylua: ignore icons = { @@ -123,6 +130,7 @@ local defaults = { M.json = { data = { version = nil, ---@type string? + hashes = {}, ---@type table extras = {}, ---@type string[] }, } @@ -173,6 +181,7 @@ function M.setup(opts) M.load("keymaps") Util.format.setup() + Util.news.setup() vim.api.nvim_create_user_command("LazyRoot", function() Util.root.info() diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 79c0ee0614..bae7b15bbb 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -125,7 +125,7 @@ map("n", "qq", "qa", { desc = "Quit all" }) map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) -- LazyVim Changelog -map("n", "L", Util.changelog, {desc = "LazyVim Changelog"}) +map("n", "L", function() Util.news.changelog() end, { desc = "LazyVim Changelog" }) -- floating terminal local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 5cfd4e77ec..2751e8e6a2 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -11,6 +11,7 @@ local LazyUtil = require("lazy.core.util") ---@field plugin lazyvim.util.plugin ---@field extras lazyvim.util.extras ---@field inject lazyvim.util.inject +---@field news lazyvim.util.news local M = {} ---@type table @@ -137,14 +138,6 @@ function M.on_load(name, fn) end end -function M.changelog() - local lv = require("lazy.core.config").plugins.LazyVim - local float = require("lazy.util").open(lv.dir .. "/CHANGELOG.md") - vim.wo[float.win].spell = false - vim.wo[float.win].wrap = false - vim.diagnostic.disable(float.buf) -end - -- Wrapper around vim.keymap.set that will -- not create a keymap if a lazy key handler exists. -- It will also set `silent` to true by default. diff --git a/lua/lazyvim/util/news.lua b/lua/lazyvim/util/news.lua new file mode 100644 index 0000000000..4e28148b4f --- /dev/null +++ b/lua/lazyvim/util/news.lua @@ -0,0 +1,77 @@ +local Config = require("lazyvim.config") +local Util = require("lazyvim.util") + +---@class lazyvim.util.news +local M = {} + +function M.hash(file) + local stat = vim.loop.fs_stat(file) + if not stat then + return + end + return stat.size .. "" +end + +function M.setup() + vim.schedule(function() + if Config.news.lazyvim then + M.lazyvim(true) + end + if Config.news.neovim then + M.neovim(true) + end + end) +end + +function M.changelog() + M.open("CHANGELOG.md", { plugin = "LazyVim" }) +end + +function M.lazyvim(when_changed) + M.open("NEWS.md", { plugin = "LazyVim", when_changed = when_changed }) +end + +function M.neovim(when_changed) + M.open("doc/news.txt", { rtp = true, when_changed = when_changed }) +end + +---@param file string +---@param opts? {plugin?:string, rtp?:boolean, when_changed?:boolean} +function M.open(file, opts) + opts = opts or {} + if opts.plugin then + local plugin = require("lazy.core.config").plugins[opts.plugin] --[[@as LazyPlugin?]] + if not plugin then + return Util.error("plugin not found: " .. opts.plugin) + end + file = plugin.dir .. "/" .. file + elseif opts.rtp then + file = vim.api.nvim_get_runtime_file(file, false)[1] + end + + if not file then + return Util.error("File not found") + end + + if opts.when_changed then + local hash = M.hash(file) + if hash == Config.json.data.hashes[file] then + return + end + Config.json.data.hashes[file] = hash + Config.json.save() + end + + local float = require("lazy.util").float({ + file = file, + size = { width = 0.6, height = 0.6 }, + }) + vim.wo[float.win].spell = false + vim.wo[float.win].wrap = false + vim.wo[float.win].signcolumn = "yes" + vim.wo[float.win].statuscolumn = " " + vim.wo[float.win].conceallevel = 3 + vim.diagnostic.disable(float.buf) +end + +return M From 763c0fd9f296ec31119c0e7109b9b73d15553fff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:49:38 +0200 Subject: [PATCH 390/513] chore(main): release 10.0.0 (#1673) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1136f07a7..1161066d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,63 @@ # Changelog +## [10.0.0](https://github.com/LazyVim/LazyVim/compare/v9.9.1...v10.0.0) (2023-10-12) + + +### ⚠ BREAKING CHANGES + +* **starter:** `dashboard.nvim` is now the default starter. To keep using `alpha.nvim`, enable the extra. +* make `conform.nvim` and `nvim-lint` the default formatters/linters + +### Features + +* added aerial extra with integrations for edgy, telescope and lualine ([b43c57d](https://github.com/LazyVim/LazyVim/commit/b43c57d943b2a13460d45f01a288e98cb54f2c1f)) +* added NEWS.md and option to automatically show when changed (enabled by default) ([73acab1](https://github.com/LazyVim/LazyVim/commit/73acab16758d37982bd6b2d9b2be37c4ee83cde3)) +* **config:** better kind filter default for lua to deal with luals weirdness ([f64039f](https://github.com/LazyVim/LazyVim/commit/f64039f54620fe3fc9e8f464e35b184c6834ed6e)) +* **config:** load/save some data in lazyvim.json ([11d66e7](https://github.com/LazyVim/LazyVim/commit/11d66e713467410add9ad5a7a68a3bca0aa24082)) +* **config:** make kind filter configurable for telescope/aerial/... ([eb7a7d7](https://github.com/LazyVim/LazyVim/commit/eb7a7d7a8e586d30ed6839f4a621e0f019d32410)) +* **config:** use lazy's new custom events (`Event.mappings`) for a better `LazyFile` ([4ea1c68](https://github.com/LazyVim/LazyVim/commit/4ea1c6865e6d877207de8626e11a5a863950ae55)) +* **dashboard:** added LazyExtras shortcut to dashboard/alpha ([5bb7420](https://github.com/LazyVim/LazyVim/commit/5bb74205a06a89f048902ba142473dd679b228b8)) +* **extras:** added extra for `symbols-outline.nvim` ([b4ba5d8](https://github.com/LazyVim/LazyVim/commit/b4ba5d881dcb801d3c502665f9767d2f75ca1110)) +* **format:** new LazyVim formatter with integrations for lsp/none-ls/conform/eslint/... ([f1a8f24](https://github.com/LazyVim/LazyVim/commit/f1a8f24a361d0de198f6b1458168652a6835c932)) +* **inject:** util method to get upvalue ([14f3f03](https://github.com/LazyVim/LazyVim/commit/14f3f036e9223315f310ba9d35182690638e7bd7)) +* make `conform.nvim` and `nvim-lint` the default formatters/linters ([14c091b](https://github.com/LazyVim/LazyVim/commit/14c091b1fc6b0dc0b22ac49ccac69f8a02e3844c)) +* **mini.starter:** adding mini.starter to lualine disabled files ([#1667](https://github.com/LazyVim/LazyVim/issues/1667)) ([1c34af7](https://github.com/LazyVim/LazyVim/commit/1c34af7f0138323d9f465437d0bcef621a8dbe94)) +* **navic:** moved navic to extras ([305e82f](https://github.com/LazyVim/LazyVim/commit/305e82f2cacd5d0074027ea545a87a41379afc88)) +* **root:** allow custom functions as part of `vim.g.root_spec` ([c33e748](https://github.com/LazyVim/LazyVim/commit/c33e7489ecdaef7295a63079410f2f24a1cbc9b6)) +* **root:** cached pretty path function for statuslines ([8d7361c](https://github.com/LazyVim/LazyVim/commit/8d7361c4602993a7ea119cb7ce78d421b6787dfb)) +* **root:** customizable root detection and `:LazyRoot` command ([a2d6049](https://github.com/LazyVim/LazyVim/commit/a2d604928b5629d14797437a26022065f7385216)) +* **starter:** `dashboard.nvim` is now the default starter. To keep using `alpha.nvim`, enable the extra. ([4cbe42c](https://github.com/LazyVim/LazyVim/commit/4cbe42cd247c72dfc70c3fcddfa3fb6b5e6485e0)) +* **starter:** added Lazy Extras to `mini.starter` ([ce74e28](https://github.com/LazyVim/LazyVim/commit/ce74e28464daa7d694f9ab4e41fae3174e30c8b3)) +* **treesitter:** add nvim-treesitter-context by default ([7b2c317](https://github.com/LazyVim/LazyVim/commit/7b2c31740782fb0754ce715be6ea128083e48c4f)) +* **treesitter:** install nvim-ts-autotag by default ([cb7f5ac](https://github.com/LazyVim/LazyVim/commit/cb7f5aca7a04cf2d1d06397e9a80fe078d17976b)) +* **ui:** added `:LazyExtras` to manage enabled extras in LazyVim ([c4e55e4](https://github.com/LazyVim/LazyVim/commit/c4e55e4d67a7195b7aa9160cd8ece3ddc2f6cb51)) +* **ui:** show optional plugins in a different color ([eedb4a3](https://github.com/LazyVim/LazyVim/commit/eedb4a34050443448d0b752e22803d5b1278b419)) +* **util:** inject module ([e239235](https://github.com/LazyVim/LazyVim/commit/e239235cd34ac9c286eac1e620670784566ef673)) + + +### Bug Fixes + +* **aerial:** keymap ([c772027](https://github.com/LazyVim/LazyVim/commit/c7720275c3fa8b19c9ad7e05bfb6ed5c510bf2bb)) +* **dap:** copy config before overriding args ([72f3cc6](https://github.com/LazyVim/LazyVim/commit/72f3cc684bd1e8f19b2d3c56da3f359032b8c5dc)) +* **extras:** make sure we use priorities to import extras in correct order ([a4e3931](https://github.com/LazyVim/LazyVim/commit/a4e393154f61b95da5835b6461e211eb94740268)) +* **format:** always show formatter status even when no sources available ([a4abbdc](https://github.com/LazyVim/LazyVim/commit/a4abbdc89bd1d49378ac5873db1279e7e5398927)) +* **lualine:** when opening nvim with a file, show an empty statusline till lualine loads ([8373467](https://github.com/LazyVim/LazyVim/commit/83734675b0f93fbd11a350ee0662c09995836b59)) +* **neo-tree:** during init check global argslist instead of window-local ([8fbde2c](https://github.com/LazyVim/LazyVim/commit/8fbde2c3668960ed085f9225bb4650aca77cc495)) +* **nlua:** make nlua dap work with regular continue. Fixes [#1666](https://github.com/LazyVim/LazyVim/issues/1666) ([85215f3](https://github.com/LazyVim/LazyVim/commit/85215f396b6fd4de24636a202ec1149dafa5f7b5)) +* **notify:** set default zindex=100 ([7fb7948](https://github.com/LazyVim/LazyVim/commit/7fb79486ed1b251b98b95a44ef50b3742edd708d)) +* **plugin:** add nvim-treesitter-context rename warning ([db5d28b](https://github.com/LazyVim/LazyVim/commit/db5d28b039f656ccb47d3b9f787e8bb482cc6ec1)) +* **plugin:** enable lazy_file ([f59cdff](https://github.com/LazyVim/LazyVim/commit/f59cdff4d9f04ff349cefdee0b363d573954ce0d)) +* **plugin:** show warning of removed core plugin when trying to load them without having the extra ([3256abd](https://github.com/LazyVim/LazyVim/commit/3256abda65ae03358ecdbef1c7789782440fe39e)) +* **root:** only use workspace folders that contain the buffer ([592f3b0](https://github.com/LazyVim/LazyVim/commit/592f3b03bb3cd01df42ee5db4cd6ba43937f067e)) +* **ui:** dont show left signs on virtual line numbers (wrap). Fixes [#1654](https://github.com/LazyVim/LazyVim/issues/1654) ([e6d294d](https://github.com/LazyVim/LazyVim/commit/e6d294df6fbd973644d4b7f9691d5f48cc5efdde)) + + +### Performance Improvements + +* **lualine:** get rid of lualine's weird lualine_require ([13dbe4a](https://github.com/LazyVim/LazyVim/commit/13dbe4ad55a4e4b9a3dd345521b359411cdc5879)) +* **plugin:** move all lazy.nvim related code to `lazyvim.util.plugin` ([70f9195](https://github.com/LazyVim/LazyVim/commit/70f91956e7f03e740b51cbc14c87df6a6f74538f)) +* **util:** split lazyvim.util in smaller separate modules ([c8c929c](https://github.com/LazyVim/LazyVim/commit/c8c929c9fdc44cc69cb034c47bd89d2bc4e4a429)) + ## [9.9.1](https://github.com/LazyVim/LazyVim/compare/v9.9.0...v9.9.1) (2023-10-11) From 7d9a3955651ba3f59389596e869affcedccaa489 Mon Sep 17 00:00:00 2001 From: Sergey Kochetkov Date: Thu, 12 Oct 2023 15:10:26 +0200 Subject: [PATCH 391/513] style(format): Fix typo (#1675) --- lua/lazyvim/util/format.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua index af64a6f5e5..2a5ef5ac08 100644 --- a/lua/lazyvim/util/format.lua +++ b/lua/lazyvim/util/format.lua @@ -130,7 +130,7 @@ function M.health() local has_extra = vim.tbl_contains(Config.spec.modules, "lazyvim.plugins.extras.lsp.none-ls") if has_plugin and not has_extra then Util.warn({ - "`conform.nvim` and `nvim-lint` are now the default forrmatters and linters in LazyVim.", + "`conform.nvim` and `nvim-lint` are now the default formatters and linters in LazyVim.", "", "You can use those plugins together with `none-ls.nvim`,", "but you need to enable the `lazyvim.plugins.extras.lsp.none-ls` extra,", From 2a0b7a88ba4b4562361dd5abb4a071547d004e59 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 17:48:49 +0200 Subject: [PATCH 392/513] fix(config): make lazyvim.json idempotent, pretty-printed and remove full paths --- lua/lazyvim/config/init.lua | 9 +++++-- lua/lazyvim/util/init.lua | 1 + lua/lazyvim/util/json.lua | 48 +++++++++++++++++++++++++++++++++++++ lua/lazyvim/util/news.lua | 5 ++-- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 lua/lazyvim/util/json.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 07bb1ed693..4a9a0f22fa 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -130,7 +130,7 @@ local defaults = { M.json = { data = { version = nil, ---@type string? - hashes = {}, ---@type table + news = {}, ---@type table extras = {}, ---@type string[] }, } @@ -144,6 +144,11 @@ function M.json.load() local ok, json = pcall(vim.json.decode, data, { luanil = { object = true, array = true } }) if ok then M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {}) + if M.json.data.hashes then + ---@diagnostic disable-next-line: no-unknown + M.json.data.hashes = nil + M.json.save() + end end end end @@ -152,7 +157,7 @@ function M.json.save() local path = vim.fn.stdpath("config") .. "/lazyvim.json" local f = io.open(path, "w") if f then - f:write(vim.json.encode(M.json.data)) + f:write(Util.json.encode(M.json.data)) f:close() end end diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 2751e8e6a2..ac2b40553c 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -12,6 +12,7 @@ local LazyUtil = require("lazy.core.util") ---@field extras lazyvim.util.extras ---@field inject lazyvim.util.inject ---@field news lazyvim.util.news +---@field json lazyvim.util.json local M = {} ---@type table diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua new file mode 100644 index 0000000000..73c4fb1586 --- /dev/null +++ b/lua/lazyvim/util/json.lua @@ -0,0 +1,48 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.json +local M = {} + +---@param value any +---@param indent string +local function encode(value, indent) + local t = type(value) + + if t == "string" then + return string.format("%q", value) + elseif t == "number" or t == "boolean" then + return tostring(value) + elseif t == "table" then + local is_list = Util.is_list(value) + local parts = {} + local next_indent = indent .. " " + + if is_list then + ---@diagnostic disable-next-line: no-unknown + for _, v in ipairs(value) do + local e = encode(v, next_indent) + if e then + table.insert(parts, next_indent .. e) + end + end + return "[\n" .. table.concat(parts, ",\n") .. "\n" .. indent .. "]" + else + local keys = vim.tbl_keys(value) + table.sort(keys) + ---@diagnostic disable-next-line: no-unknown + for _, k in ipairs(keys) do + local e = encode(value[k], next_indent) + if e then + table.insert(parts, next_indent .. string.format("%q", k) .. ": " .. e) + end + end + return "{\n" .. table.concat(parts, ",\n") .. "\n" .. indent .. "}" + end + end +end + +function M.encode(value) + return encode(value, "") +end + +return M diff --git a/lua/lazyvim/util/news.lua b/lua/lazyvim/util/news.lua index 4e28148b4f..a4517bf520 100644 --- a/lua/lazyvim/util/news.lua +++ b/lua/lazyvim/util/news.lua @@ -38,6 +38,7 @@ end ---@param file string ---@param opts? {plugin?:string, rtp?:boolean, when_changed?:boolean} function M.open(file, opts) + local ref = file opts = opts or {} if opts.plugin then local plugin = require("lazy.core.config").plugins[opts.plugin] --[[@as LazyPlugin?]] @@ -55,10 +56,10 @@ function M.open(file, opts) if opts.when_changed then local hash = M.hash(file) - if hash == Config.json.data.hashes[file] then + if hash == Config.json.data.news[ref] then return end - Config.json.data.hashes[file] = hash + Config.json.data.news[ref] = hash Config.json.save() end From 7c7b4be8dbec5c5e888d02ebdaae944fecf99407 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 17:59:48 +0200 Subject: [PATCH 393/513] fix(toggle): dont show incorrect deprecation warning for toggle. Fixes #1679 --- 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 ac2b40553c..ddfa55f8f2 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -23,7 +23,6 @@ local deprecated = { root_patterns = { "root", "patterns" }, get_root = { "root", "get" }, float_term = { "terminal", "open" }, - toggle = { "toggle", "option" }, toggle_diagnostics = { "toggle", "diagnostics" }, toggle_number = { "toggle", "number" }, fg = "ui", From 666a69e6e0eb3db17810a426b884081d1cc4ad3d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 18:07:04 +0200 Subject: [PATCH 394/513] chore(main): release 10.0.1 (#1680) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1161066d2c..318e04e5e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [10.0.1](https://github.com/LazyVim/LazyVim/compare/v10.0.0...v10.0.1) (2023-10-12) + + +### Bug Fixes + +* **config:** make lazyvim.json idempotent, pretty-printed and remove full paths ([2a0b7a8](https://github.com/LazyVim/LazyVim/commit/2a0b7a88ba4b4562361dd5abb4a071547d004e59)) +* **toggle:** dont show incorrect deprecation warning for toggle. Fixes [#1679](https://github.com/LazyVim/LazyVim/issues/1679) ([7c7b4be](https://github.com/LazyVim/LazyVim/commit/7c7b4be8dbec5c5e888d02ebdaae944fecf99407)) + ## [10.0.0](https://github.com/LazyVim/LazyVim/compare/v9.9.1...v10.0.0) (2023-10-12) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 4a9a0f22fa..3f84e91a67 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.0.0" -- x-release-please-version +M.version = "10.0.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { From cdae38ddd44edbf5e124129fc94e9d1038592760 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 20:28:56 +0200 Subject: [PATCH 395/513] fix(nvim-lint): check on linter name instead of linter. Fixes #1685 --- lua/lazyvim/plugins/linting.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/linting.lua b/lua/lazyvim/plugins/linting.lua index 1fb7ab5dff..52ff9beefc 100644 --- a/lua/lazyvim/plugins/linting.lua +++ b/lua/lazyvim/plugins/linting.lua @@ -27,7 +27,7 @@ return { local lint = require("lint") for name, linter in pairs(opts.linters) do - if type(linter) == "table" and type(lint.linters) == "table" then + if type(linter) == "table" and type(lint.linters[name]) == "table" then lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) end end From 8e71968c2bd9e59e535cdac0a99e667f8f120322 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 20:43:11 +0200 Subject: [PATCH 396/513] fix(nvim-lint): make sure to set custom linters. Fixes #1687 --- lua/lazyvim/plugins/linting.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/linting.lua b/lua/lazyvim/plugins/linting.lua index 52ff9beefc..db9fe9c3ce 100644 --- a/lua/lazyvim/plugins/linting.lua +++ b/lua/lazyvim/plugins/linting.lua @@ -29,6 +29,8 @@ return { for name, linter in pairs(opts.linters) do if type(linter) == "table" and type(lint.linters[name]) == "table" then lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) + else + lint.linters[name] = linter end end lint.linters_by_ft = opts.linters_by_ft From c9892652d271663f52edd7b0d88d2565d8f65a52 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 21:45:32 +0200 Subject: [PATCH 397/513] feat(config): `lazyvim.json` is now versioned and migrates to a newer version when needed --- lua/lazyvim/config/init.lua | 16 +++------------- lua/lazyvim/util/json.lua | 30 ++++++++++++++++++++++++++++++ lua/lazyvim/util/news.lua | 2 +- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 3f84e91a67..69561c1d29 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -128,6 +128,7 @@ local defaults = { } M.json = { + version = 1, data = { version = nil, ---@type string? news = {}, ---@type table @@ -144,24 +145,13 @@ function M.json.load() local ok, json = pcall(vim.json.decode, data, { luanil = { object = true, array = true } }) if ok then M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {}) - if M.json.data.hashes then - ---@diagnostic disable-next-line: no-unknown - M.json.data.hashes = nil - M.json.save() + if M.json.data.version ~= M.json.version then + Util.json.migrate() end end end end -function M.json.save() - local path = vim.fn.stdpath("config") .. "/lazyvim.json" - local f = io.open(path, "w") - if f then - f:write(Util.json.encode(M.json.data)) - f:close() - end -end - ---@type LazyVimOptions local options diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua index 73c4fb1586..b8428addce 100644 --- a/lua/lazyvim/util/json.lua +++ b/lua/lazyvim/util/json.lua @@ -1,3 +1,4 @@ +local Config = require("lazyvim.config") local Util = require("lazyvim.util") ---@class lazyvim.util.json @@ -45,4 +46,33 @@ function M.encode(value) return encode(value, "") end +function M.save() + local path = vim.fn.stdpath("config") .. "/lazyvim.json" + local f = io.open(path, "w") + if f then + f:write(Util.json.encode(Config.json.data)) + f:close() + end +end + +function M.migrate() + Util.info("Migrating `lazyvim.json` to version `" .. Config.json.version .. "`") + local json = Config.json + + -- v0 + if not json.data.version then + if json.data.hashes then + ---@diagnostic disable-next-line: no-unknown + json.data.hashes = nil + end + json.data.extras = vim.tbl_map(function(extra) + return "lazyvim.plugins.extras." .. extra + end, json.data.extras or {}) + end + + json.data.version = Config.json.version + + M.save() +end + return M diff --git a/lua/lazyvim/util/news.lua b/lua/lazyvim/util/news.lua index a4517bf520..11707155d8 100644 --- a/lua/lazyvim/util/news.lua +++ b/lua/lazyvim/util/news.lua @@ -60,7 +60,7 @@ function M.open(file, opts) return end Config.json.data.news[ref] = hash - Config.json.save() + Util.json.save() end local float = require("lazy.util").float({ From 1bcf6b9a282bc839d4fde92a94b800185ad58118 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 12 Oct 2023 21:47:31 +0200 Subject: [PATCH 398/513] feat(extras): LazyExtras can now manage user extras `lua/plugins/extras`. Fixes #1681 --- NEWS.md | 3 + lua/lazyvim/plugins/xtras.lua | 10 ++-- lua/lazyvim/util/extras.lua | 106 ++++++++++++++++++++++------------ 3 files changed, 76 insertions(+), 43 deletions(-) diff --git a/NEWS.md b/NEWS.md index af6fca2f7c..50b72da377 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ ## 10.x +- User extras under `lua/plugins/extras` can now also be managed + with **LazyExtras** + - `nvim-ts-autotag` is now included by default - `nvim-treesitter-context` is now included by default diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 009bb6fa56..4eb73804b0 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -2,10 +2,10 @@ local Config = require("lazyvim.config") -- Some extras need to be loaded before others local prios = { - ["editor.aerial"] = 100, - ["editor.symbols-outline"] = 100, - ["test.core"] = 1, - ["dap.core"] = 1, + ["lazyvim.plugins.extras.editor.aerial"] = 100, + ["lazyvim.plugins.extras.editor.symbols-outline"] = 100, + ["lazyvim.plugins.extras.test.core"] = 1, + ["lazyvim.plugins.extras.dap.core"] = 1, } table.sort(Config.json.data.extras, function(a, b) @@ -19,5 +19,5 @@ end) ---@param extra string return vim.tbl_map(function(extra) - return { import = "lazyvim.plugins.extras." .. extra } + return { import = extra } end, Config.json.data.extras) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index c71e328c96..0417b81e77 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -5,8 +5,16 @@ local Plugin = require("lazy.core.plugin") local Text = require("lazy.view.text") local Util = require("lazyvim.util") +---@class LazyExtraSource +---@field name string +---@field desc? string +---@field module string + ---@class LazyExtra ---@field name string +---@field source LazyExtraSource +---@field module string +---@field desc? string ---@field enabled boolean ---@field managed boolean ---@field row? number @@ -16,6 +24,12 @@ local Util = require("lazyvim.util") ---@class lazyvim.util.extras local M = {} +---@type LazyExtraSource[] +M.sources = { + { name = "LazyVim", desc = "LazyVim extras", module = "lazyvim.plugins.extras" }, + { name = "User", desc = "User extras", module = "plugins.extras" }, +} + M.ns = vim.api.nvim_create_namespace("lazyvim.extras") ---@type string[] M.state = nil @@ -23,42 +37,52 @@ M.state = nil ---@return LazyExtra[] function M.get() M.state = M.state or LazyConfig.spec.modules - local root = LazyConfig.plugins.LazyVim.dir .. "/lua/lazyvim/plugins/extras" - local extras = {} ---@type string[] - - Util.walk(root, function(path, name, type) - if type == "file" and name:match("%.lua$") then - local extra = path:sub(#root + 2, -5):gsub("/", ".") - extras[#extras + 1] = extra + local extras = {} ---@type LazyExtra[] + for _, source in ipairs(M.sources) do + local root = Util.find_root(source.module) + if root then + Util.walk(root, function(path, name, type) + if type == "file" and name:match("%.lua$") then + name = path:sub(#root + 2, -5):gsub("/", ".") + extras[#extras + 1] = M.get_extra(source, source.module .. "." .. name) + end + end) end + end + table.sort(extras, function(a, b) + return a.name < b.name end) - table.sort(extras) - - ---@param extra string - return vim.tbl_map(function(extra) - local modname = "lazyvim.plugins.extras." .. extra - local enabled = vim.tbl_contains(M.state, modname) - local spec = Plugin.Spec.new({ import = "lazyvim.plugins.extras." .. extra }, { optional = true }) - local plugins = {} ---@type string[] - local optional = {} ---@type string[] - for _, p in pairs(spec.plugins) do - if p.optional then - optional[#optional + 1] = p.name - else - plugins[#plugins + 1] = p.name - end + return extras +end + +---@param modname string +---@param source LazyExtraSource +function M.get_extra(source, modname) + local enabled = vim.tbl_contains(M.state, modname) + local spec = Plugin.Spec.new({ import = modname }, { optional = true }) + local plugins = {} ---@type string[] + local optional = {} ---@type string[] + for _, p in pairs(spec.plugins) do + if p.optional then + optional[#optional + 1] = p.name + else + plugins[#plugins + 1] = p.name end - table.sort(plugins) - table.sort(optional) - - return { - name = extra, - enabled = enabled, - managed = vim.tbl_contains(Config.json.data.extras, extra) or not enabled, - plugins = plugins, - optional = optional, - } - end, extras) + end + table.sort(plugins) + table.sort(optional) + + ---@type LazyExtra + return { + source = source, + name = modname:sub(#source.module + 2), + module = modname, + enabled = enabled, + desc = require(modname).desc, + managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled, + plugins = plugins, + optional = optional, + } end ---@class LazyExtraView @@ -100,17 +124,17 @@ function X:toggle() end extra.enabled = not extra.enabled Config.json.data.extras = vim.tbl_filter(function(name) - return name ~= extra.name + return name ~= extra.module end, Config.json.data.extras) M.state = vim.tbl_filter(function(name) - return name ~= "lazyvim.plugins.extras." .. extra.name + return name ~= extra.module end, M.state) if extra.enabled then - table.insert(Config.json.data.extras, extra.name) - M.state[#M.state + 1] = "lazyvim.plugins.extras." .. extra.name + table.insert(Config.json.data.extras, extra.module) + M.state[#M.state + 1] = extra.module end table.sort(Config.json.data.extras) - Config.json.save() + Util.json.save() Util.info( "`" .. extra.name @@ -180,12 +204,18 @@ function X:extra(extra) self.text:append(" " .. LazyConfig.options.ui.icons.not_loaded .. " ", hl) end self.text:append(extra.name) + if extra.source.name ~= "LazyVim" then + self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent") + end for _, plugin in ipairs(extra.plugins) do self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin") end for _, plugin in ipairs(extra.optional) do self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonRequire") end + if extra.desc then + self.text:nl():append(" " .. extra.desc, "LazyComment") + end self.text:nl() end From b31d71da9d6ca6c290a8ee7e7cc7ad5ccb3cc0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Thu, 12 Oct 2023 21:52:19 +0200 Subject: [PATCH 399/513] feat(neot-ree): add keymaps to toggle git & buffer (#1339) --- lua/lazyvim/plugins/editor.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 6e1d63b64e..63a8e1b1a4 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -24,6 +24,20 @@ return { }, { "e", "fe", desc = "Explorer NeoTree (root dir)", remap = true }, { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, + { + "ge", + function() + require("neo-tree.command").execute({ source = "git_status", toggle = true }) + end, + desc = "Git explorer", + }, + { + "be", + function() + require("neo-tree.command").execute({ source = "buffers", toggle = true }) + end, + desc = "Buffer explorer", + }, }, deactivate = function() vim.cmd([[Neotree close]]) From 1e7924878693be1570c91811fd5c55bb53c8c4d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 21:56:56 +0200 Subject: [PATCH 400/513] chore(main): release 10.1.0 (#1686) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318e04e5e2..1639dea38d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [10.1.0](https://github.com/LazyVim/LazyVim/compare/v10.0.1...v10.1.0) (2023-10-12) + + +### Features + +* **config:** `lazyvim.json` is now versioned and migrates to a newer version when needed ([c989265](https://github.com/LazyVim/LazyVim/commit/c9892652d271663f52edd7b0d88d2565d8f65a52)) +* **extras:** LazyExtras can now manage user extras `lua/plugins/extras`. Fixes [#1681](https://github.com/LazyVim/LazyVim/issues/1681) ([1bcf6b9](https://github.com/LazyVim/LazyVim/commit/1bcf6b9a282bc839d4fde92a94b800185ad58118)) +* **neot-ree:** add keymaps to toggle git & buffer ([#1339](https://github.com/LazyVim/LazyVim/issues/1339)) ([b31d71d](https://github.com/LazyVim/LazyVim/commit/b31d71da9d6ca6c290a8ee7e7cc7ad5ccb3cc0bd)) + + +### Bug Fixes + +* **nvim-lint:** check on linter name instead of linter. Fixes [#1685](https://github.com/LazyVim/LazyVim/issues/1685) ([cdae38d](https://github.com/LazyVim/LazyVim/commit/cdae38ddd44edbf5e124129fc94e9d1038592760)) +* **nvim-lint:** make sure to set custom linters. Fixes [#1687](https://github.com/LazyVim/LazyVim/issues/1687) ([8e71968](https://github.com/LazyVim/LazyVim/commit/8e71968c2bd9e59e535cdac0a99e667f8f120322)) + ## [10.0.1](https://github.com/LazyVim/LazyVim/compare/v10.0.0...v10.0.1) (2023-10-12) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 69561c1d29..774cb7ca49 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.0.1" -- x-release-please-version +M.version = "10.1.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From bd1928ba597d777ca79f9f2f4b14217de4c291bc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 07:28:02 +0200 Subject: [PATCH 401/513] fix(aerial): use new sep_icon option for aerial lualine component --- lua/lazyvim/plugins/extras/editor/aerial.lua | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua index d46149b1ab..440c9fdae9 100644 --- a/lua/lazyvim/plugins/extras/editor/aerial.lua +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -2,22 +2,11 @@ local Config = require("lazyvim.config") local Util = require("lazyvim.util") return { + desc = "Aerial Symbol Browser", { "stevearc/aerial.nvim", event = "LazyFile", opts = function() - ---@diagnostic disable-next-line: no-unknown - local lualine = require("lualine.components.aerial") - - -- Strip trailing spaces from symbols in statusline - ---@param _ any - ---@param symbols {icon?:string}[] - lualine.format_status = Util.inject.args(lualine.format_status, function(_, symbols) - for _, s in ipairs(symbols) do - s.icon = s.icon and s.icon:gsub("%s*$", "") or nil - end - end) - local icons = vim.deepcopy(Config.icons.kinds) -- HACK: fix lua's weird choice for `Package` for control @@ -110,8 +99,8 @@ return { opts = function(_, opts) table.insert(opts.sections.lualine_c, { "aerial", - -- The separator to be used to separate symbols in status line. - sep = " ", + sep = " ", -- separator between symbols + sep_icon = "", -- separator between icon and symbol -- The number of symbols to render top-down. In order to render only 'N' last -- symbols, negative numbers may be supplied. For instance, 'depth = -1' can From 01dbd070738a9448ffbdc63602ed9eb5421158da Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 07:35:24 +0200 Subject: [PATCH 402/513] fix(json): always write version to prevent spurious migrations. Fixes #1692 --- lua/lazyvim/config/init.lua | 2 +- lua/lazyvim/util/json.lua | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 774cb7ca49..af31f16353 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -128,7 +128,7 @@ local defaults = { } M.json = { - version = 1, + version = 2, data = { version = nil, ---@type string? news = {}, ---@type table diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua index b8428addce..d98d038262 100644 --- a/lua/lazyvim/util/json.lua +++ b/lua/lazyvim/util/json.lua @@ -47,6 +47,7 @@ function M.encode(value) end function M.save() + Config.json.data.version = Config.json.version local path = vim.fn.stdpath("config") .. "/lazyvim.json" local f = io.open(path, "w") if f then @@ -68,10 +69,13 @@ function M.migrate() json.data.extras = vim.tbl_map(function(extra) return "lazyvim.plugins.extras." .. extra end, json.data.extras or {}) + elseif json.data.version == 1 then + json.data.extras = vim.tbl_map(function(extra) + -- replace double extras module name + return extra:gsub("^lazyvim%.plugins%.extras%.lazyvim%.plugins%.extras%.", "lazyvim.plugins.extras.") + end, json.data.extras or {}) end - json.data.version = Config.json.version - M.save() end From 66f0d55beb6604abc07110edbfc483f69660625b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 13 Oct 2023 05:36:45 +0000 Subject: [PATCH 403/513] 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 ea9ed565c2..49d339b638 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 12 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 13 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 1b1d9a16ee96b73090ca1906204c41550f6528e6 Mon Sep 17 00:00:00 2001 From: Susheel Thapa <83917129+SusheelThapa@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:22:07 +0545 Subject: [PATCH 404/513] docs: typos fixed in CHANGELOG.md (#1693) --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1639dea38d..4573b18d3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -259,7 +259,7 @@ ### Bug Fixes -* **dasboard:** disable alpha only once ([d6b56c0](https://github.com/LazyVim/LazyVim/commit/d6b56c075e88ce12e9e16fb2eeeea38fb7853600)) +* **dashboard:** disable alpha only once ([d6b56c0](https://github.com/LazyVim/LazyVim/commit/d6b56c075e88ce12e9e16fb2eeeea38fb7853600)) * **options:** set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering ([1eb0192](https://github.com/LazyVim/LazyVim/commit/1eb019274b5564e66ac6c7e119c140bae262e10c)) * **tailwind:** allow overriding filetypes. Fixes [#1590](https://github.com/LazyVim/LazyVim/issues/1590) ([d3e7f77](https://github.com/LazyVim/LazyVim/commit/d3e7f7717e960bb883b35e9a75badfd5b938cace)) @@ -300,7 +300,7 @@ ### Bug Fixes -* **autocmds:** retore last location for correct buffer ([afc8e7f](https://github.com/LazyVim/LazyVim/commit/afc8e7f8cac06335efd12ec5f71cabb1f38a09b0)) +* **autocmds:** restore last location for correct buffer ([afc8e7f](https://github.com/LazyVim/LazyVim/commit/afc8e7f8cac06335efd12ec5f71cabb1f38a09b0)) * **conform:** dont try merging function formatters. Fixes [#1582](https://github.com/LazyVim/LazyVim/issues/1582) ([f475085](https://github.com/LazyVim/LazyVim/commit/f4750859f2c2c9a41b3974ac05962ce9648d6c16)) * **conform:** dont try to merge formatter functions ([9f034ab](https://github.com/LazyVim/LazyVim/commit/9f034ab10650e306e178d5189ee9214a52f2e8e5)) * **nvim-lint:** dont try merging function linters ([79010ae](https://github.com/LazyVim/LazyVim/commit/79010ae671035d8ed0040ce51df4fb59ec3962f8)) @@ -1023,7 +1023,7 @@ * **hipatterns:** default options ([3082436](https://github.com/LazyVim/LazyVim/commit/30824369c2c58647df170566766ea1dbda2730cc)) * **neotest:** added some additional filetypes to close with q ([1288f0d](https://github.com/LazyVim/LazyVim/commit/1288f0d5a5cc5f5279678cc3c3d99abe20a1e052)) -* **neotest:** support neotest adapaters that use `setup()` for custom setup ([2a3bac7](https://github.com/LazyVim/LazyVim/commit/2a3bac769045abac76395fcabb36b17b68bc42fc)) +* **neotest:** support neotest adapters that use `setup()` for custom setup ([2a3bac7](https://github.com/LazyVim/LazyVim/commit/2a3bac769045abac76395fcabb36b17b68bc42fc)) ## [4.2.0](https://github.com/LazyVim/LazyVim/compare/v4.1.1...v4.2.0) (2023-05-26) @@ -1630,7 +1630,7 @@ ### Bug Fixes -* **illuminate:** always set refernce keymaps on the buffer as well to properly overwrite ftplugin mappings. Fixes [#292](https://github.com/LazyVim/LazyVim/issues/292) ([a0cf00c](https://github.com/LazyVim/LazyVim/commit/a0cf00c81b3a4a352cdc26c94112d9a5827881e1)) +* **illuminate:** always set reference keymaps on the buffer as well to properly overwrite ftplugin mappings. Fixes [#292](https://github.com/LazyVim/LazyVim/issues/292) ([a0cf00c](https://github.com/LazyVim/LazyVim/commit/a0cf00c81b3a4a352cdc26c94112d9a5827881e1)) * **mini.surround:** don't create empty keymaps. Fixes [#296](https://github.com/LazyVim/LazyVim/issues/296) ([8e84dcf](https://github.com/LazyVim/LazyVim/commit/8e84dcf85c8a73ebcf6ade6b7b77544f468f1dfa)) * **treesitter:** disable indent only for python right now ([de6a28b](https://github.com/LazyVim/LazyVim/commit/de6a28b781e8a06e4f70c913539c97260392131a)) * **treesitter:** disable treesitter indent by default, since it has too many issues. See [#297](https://github.com/LazyVim/LazyVim/issues/297) ([329a2da](https://github.com/LazyVim/LazyVim/commit/329a2daff493abd2bd5c8fedbf0dfa13039d3931)) @@ -1774,7 +1774,7 @@ ### Bug Fixes -* **mini.ai:** load ai on VeryLazy. Keymaps interfer with which-key. [#155](https://github.com/LazyVim/LazyVim/issues/155) ([3b5f363](https://github.com/LazyVim/LazyVim/commit/3b5f36307438ad05beae6796ca005f6b56d6a360)) +* **mini.ai:** load ai on VeryLazy. Keymaps interfere with which-key. [#155](https://github.com/LazyVim/LazyVim/issues/155) ([3b5f363](https://github.com/LazyVim/LazyVim/commit/3b5f36307438ad05beae6796ca005f6b56d6a360)) * **noice:** scroll doc window in normal, insert and select mode ([c5b22c0](https://github.com/LazyVim/LazyVim/commit/c5b22c0832603198f571ff68b6fb9d0c17f73d33)) * **nvim-navic:** use kinds icons for navic. Fixes [#164](https://github.com/LazyVim/LazyVim/issues/164) ([b81ecf9](https://github.com/LazyVim/LazyVim/commit/b81ecf9f7ac78e3f87a4d9b305fa0d3cfd6decf2)) @@ -1949,7 +1949,7 @@ * **lsp:** allow overriding options for vim.lsp.buf.format. Fixes [#51](https://github.com/LazyVim/LazyVim/issues/51) ([40d363c](https://github.com/LazyVim/LazyVim/commit/40d363cf3f468a1cc4ea482eaabbd5c7e224f397)) * **lsp:** make diagnostics configurable with `{"neovim/nvim-lspconfig", opts = {diagnostics = {}}}`. Fixes [#55](https://github.com/LazyVim/LazyVim/issues/55) ([1efc925](https://github.com/LazyVim/LazyVim/commit/1efc925d16b57659cbb9af5a1579cb1b9ee9643f)) * **neo-tree:** added `<leader>e` and `E` to toggle neo-tree ([542920f](https://github.com/LazyVim/LazyVim/commit/542920fb8249d45d1e9ddbf6517a8f8539769eda)) -* **neo-tree:** load neo-tree when specifying a direcory on the cmdline ([81d798f](https://github.com/LazyVim/LazyVim/commit/81d798fdaa5bf49737969e0f15af4a90621a0a61)) +* **neo-tree:** load neo-tree when specifying a directory on the cmdline ([81d798f](https://github.com/LazyVim/LazyVim/commit/81d798fdaa5bf49737969e0f15af4a90621a0a61)) * **notify:** delay notifs till replaced or at most 500ms to prevent more prompts ([701337f](https://github.com/LazyVim/LazyVim/commit/701337fac8cb1de0f3e31400cef30b053762320f)) * **notify:** lazy-load nvim-notify to show proper notifs before Noice loads ([7406313](https://github.com/LazyVim/LazyVim/commit/74063135d838b0ed9fe1a8d0e777c8cfe83ae28f)) * **util:** use lazy's notify instead of `vim.notify` ([48d1e8d](https://github.com/LazyVim/LazyVim/commit/48d1e8df12795cf559f704223b63e76259998582)) From ea4174d46016dd191de48c03bdf23462483f9f6a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 07:39:24 +0200 Subject: [PATCH 405/513] chore(main): release 10.1.1 (#1694) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4573b18d3c..80f25f8ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [10.1.1](https://github.com/LazyVim/LazyVim/compare/v10.1.0...v10.1.1) (2023-10-13) + + +### Bug Fixes + +* **aerial:** use new sep_icon option for aerial lualine component ([bd1928b](https://github.com/LazyVim/LazyVim/commit/bd1928ba597d777ca79f9f2f4b14217de4c291bc)) +* **json:** always write version to prevent spurious migrations. Fixes [#1692](https://github.com/LazyVim/LazyVim/issues/1692) ([01dbd07](https://github.com/LazyVim/LazyVim/commit/01dbd070738a9448ffbdc63602ed9eb5421158da)) + ## [10.1.0](https://github.com/LazyVim/LazyVim/compare/v10.0.1...v10.1.0) (2023-10-12) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index af31f16353..4a5abf178b 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.1.0" -- x-release-please-version +M.version = "10.1.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 4584410e76bf8a6ba426270bef8eca5a100d4cce Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 09:45:35 +0200 Subject: [PATCH 406/513] feat(format): use conform as lsp formatter since it has better format diffs --- lua/lazyvim/util/lsp.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index d5903cd859..7060c7a502 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -104,9 +104,17 @@ end ---@param opts? {filter?: lsp.Client.filter, bufnr?: number} function M.format(opts) - vim.lsp.buf.format( - vim.tbl_deep_extend("force", opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {}) - ) + opts = vim.tbl_deep_extend("force", {}, opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {}) + local ok, conform = pcall(require, "conform") + -- use conform for formatting with LSP when available, + -- since it has better format diffing + if ok then + opts.formatters = {} + opts.lsp_fallback = true + conform.format(opts) + else + vim.lsp.buf.format(opts) + end end return M From 3f1bf70b144f098f427b47d44d42d87945778328 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 12:20:55 +0200 Subject: [PATCH 407/513] refactor(util.lsp): easier lsp client filters --- lua/lazyvim/util/lsp.lua | 59 ++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index 7060c7a502..b34a2afeb9 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -1,10 +1,26 @@ +local Util = require("lazyvim.util") + ---@class lazyvim.util.lsp local M = {} -function M.get_clients(...) - ---@diagnostic disable-next-line: deprecated - local fn = vim.lsp.get_clients or vim.lsp.get_active_clients - return fn(...) +---@alias lsp.Client.filter {id?: number, bufnr?: number, name?: string, method?: string, filter?:fun(client: lsp.Client):boolean} + +---@param opts? lsp.Client.filter +function M.get_clients(opts) + local ret = {} ---@type lsp.Client[] + if vim.lsp.get_clients then + ret = vim.lsp.get_clients(opts) + else + ---@diagnostic disable-next-line: deprecated + ret = vim.lsp.get_active_clients(opts) + if opts and opts.method then + ---@param client lsp.Client + ret = vim.tbl_filter(function(client) + return client.supports_method(opts.method, { bufnr = opts.bufnr }) + end, ret) + end + end + return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret end ---@param on_attach fun(client, buffer) @@ -59,39 +75,26 @@ function M.disable(server, cond) end) end ----@alias lsp.Client.filter fun(client: lsp.Client): boolean - ----@param name string ----@return lsp.Client.filter -function M.filter(name) - return function(client) - return client.name == name - end -end - ----@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter), bufnr?: number} +---@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter)} function M.formatter(opts) opts = opts or {} - local filter = opts.filter - filter = type(filter) == "string" and M.filter(filter) or filter - ---@cast filter lsp.Client.filter? + local filter = opts.filter or {} + filter = type(filter) == "string" and { name = filter } or filter + ---@cast filter lsp.Client.filter ---@type LazyFormatter local ret = { name = "LSP", primary = true, priority = 1, format = function(buf) - M.format({ bufnr = buf, filter = filter }) + M.format(Util.merge(filter, { bufnr = buf })) end, sources = function(buf) - local clients = M.get_clients({ bufnr = buf }) + local clients = M.get_clients(Util.merge(filter, { bufnr = buf })) ---@param client lsp.Client local ret = vim.tbl_filter(function(client) - return (not filter or filter(client)) - and ( - client.supports_method("textDocument/formatting") - or client.supports_method("textDocument/rangeFormatting") - ) + return client.supports_method("textDocument/formatting") + or client.supports_method("textDocument/rangeFormatting") end, clients) ---@param client lsp.Client return vim.tbl_map(function(client) @@ -99,10 +102,12 @@ function M.formatter(opts) end, ret) end, } - return vim.tbl_deep_extend("force", ret, opts) --[[@as LazyFormatter]] + return Util.merge(ret, opts) --[[@as LazyFormatter]] end ----@param opts? {filter?: lsp.Client.filter, bufnr?: number} +---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter + +---@param opts? lsp.Client.format function M.format(opts) opts = vim.tbl_deep_extend("force", {}, opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {}) local ok, conform = pcall(require, "conform") From 6fd66f486e210e35b4c375691fbfd61a611b6027 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 12:21:38 +0200 Subject: [PATCH 408/513] feat(conform): use conform.nvim `opts.format` options for formatting with conform --- lua/lazyvim/plugins/formatting.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 855e356e25..b40245ea51 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -1,3 +1,8 @@ +local Util = require("lazyvim.util") + +---@type ConformOpts +local format_opts = {} + return { { "stevearc/conform.nvim", @@ -23,7 +28,7 @@ return { priority = 100, primary = true, format = function(buf) - require("conform").format({ bufnr = buf }) + require("conform").format(Util.merge(format_opts, { bufnr = buf })) end, sources = function(buf) local ret = require("conform").list_formatters(buf) @@ -34,7 +39,12 @@ return { }) end) end, + ---@class ConformOpts opts = { + -- LazyVim will use these options when formatting with the conform.nvim formatter + format = { + timeout_ms = 1000, + }, formatters_by_ft = { lua = { "stylua" }, fish = { "fish_indent" }, @@ -53,6 +63,7 @@ return { -- }, }, }, + ---@param opts ConformOpts config = function(_, opts) opts.formatters = opts.formatters or {} for name, formatter in pairs(opts.formatters) do @@ -63,6 +74,17 @@ return { end end end + for _, key in ipairs({ "format_on_save", "format_after_save" }) do + if opts[key] then + Util.warn( + ("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format( + key + ) + ) + opts[key] = nil + end + end + format_opts = opts.format require("conform").setup(opts) end, }, From c7244d9d47d617e68fe603a1e45b8701b08cf0ca Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 12:31:32 +0200 Subject: [PATCH 409/513] style(dot): make enabled a function for doc gen --- lua/lazyvim/plugins/extras/util/dot.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index 6dda53d349..2424589dd9 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -11,7 +11,9 @@ return { -- Add Hyprland Parser { "luckasRanarison/tree-sitter-hypr", - enabled = have("hypr"), + enabled = function() + return have("hypr") + end, event = "BufRead */hypr/*.conf", build = ":TSUpdate hypr", config = function() From 385c99dbb7ccdcf53276086892cceee65b85fa21 Mon Sep 17 00:00:00 2001 From: Juan Cruz De La Torre Date: Fri, 13 Oct 2023 07:43:51 -0300 Subject: [PATCH 410/513] feat(go): add gofumpt formatter with conform/none-ls (#1683) * feat(go): only install required packages * fix: add gofumpt formatter using conform/none-ls * fix: add mason.nvim as dependency of none-ls --- lua/lazyvim/plugins/extras/lang/go.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 7e87678b79..aaad0128b2 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -82,15 +82,32 @@ return { }, }, -- Ensure Go tools are installed + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt" }) + end, + }, { "nvimtools/none-ls.nvim", optional = true, + dependencies = { + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl" }) + end, + }, + }, opts = function(_, opts) local nls = require("null-ls") opts.sources = vim.list_extend(opts.sources or {}, { nls.builtins.code_actions.gomodifytags, nls.builtins.code_actions.impl, nls.builtins.formatting.goimports, + nls.builtins.formatting.gofumpt, }) end, }, @@ -99,7 +116,7 @@ return { optional = true, opts = { formatters_by_ft = { - go = { "goimports" }, + go = { "goimports", "gofumpt" }, }, }, }, @@ -108,10 +125,10 @@ return { optional = true, dependencies = { { - "mason.nvim", + "williamboman/mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" }) + vim.list_extend(opts.ensure_installed, { "delve" }) end, }, { From 873ff892843898033be0b59cee8130c6b1b29d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Fri, 13 Oct 2023 16:53:55 +0200 Subject: [PATCH 411/513] fix(keymaps): no diagnostic keymaps w/o lsp attached (#1698) --- lua/lazyvim/config/keymaps.lua | 16 ++++++++++++++++ lua/lazyvim/plugins/lsp/keymaps.lua | 15 --------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index bae7b15bbb..85517a657d 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -98,6 +98,22 @@ map({ "n", "v" }, "cf", function() Util.format({ force = true }) end, { desc = "Format" }) +-- diagnostic +local diagnostic_goto = function(next, severity) + local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev + severity = severity and vim.diagnostic.severity[severity] or nil + return function() + go({ severity = severity }) + end +end +map("n", "cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" }) +map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" }) +map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) + -- stylua: ignore start -- toggle options diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 7b9c218987..10e5d86f85 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -13,7 +13,6 @@ function M.get() end -- stylua: ignore M._keys = { - { "cd", vim.diagnostic.open_float, desc = "Line Diagnostics" }, { "cl", "LspInfo", desc = "Lsp Info" }, { "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, { "gr", "Telescope lsp_references", desc = "References" }, @@ -23,12 +22,6 @@ function M.get() { "K", vim.lsp.buf.hover, desc = "Hover" }, { "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, - { "]d", M.diagnostic_goto(true), desc = "Next Diagnostic" }, - { "[d", M.diagnostic_goto(false), desc = "Prev Diagnostic" }, - { "]e", M.diagnostic_goto(true, "ERROR"), desc = "Next Error" }, - { "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" }, - { "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" }, - { "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" }, { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cA", @@ -106,12 +99,4 @@ function M.on_attach(_, buffer) end end -function M.diagnostic_goto(next, severity) - local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev - severity = severity and vim.diagnostic.severity[severity] or nil - return function() - go({ severity = severity }) - end -end - return M From 3eb91c64b5960ccd84bd8e6a3318a1ee79cb85c5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 18:03:40 +0200 Subject: [PATCH 412/513] feat(conform): make it easier to add `extra_args` --- lua/lazyvim/plugins/formatting.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index b40245ea51..2053d1a553 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -61,10 +61,14 @@ return { -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] -- end, -- }, + shfmt = { + extra_args = { "-i", "2", "-ci" }, + }, }, }, ---@param opts ConformOpts config = function(_, opts) + local util = require("conform.util") opts.formatters = opts.formatters or {} for name, formatter in pairs(opts.formatters) do if type(formatter) == "table" then @@ -72,8 +76,13 @@ return { if ok and type(defaults) == "table" then opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter) end + if opts.formatters[name].extra_args then + opts.formatters[name].args = + util.extend_args(opts.formatters[name].args or {}, opts.formatters[name].extra_args) + end end end + for _, key in ipairs({ "format_on_save", "format_after_save" }) do if opts[key] then Util.warn( From b6e68fa2bf829753be86ba8cc56baafd47b7da67 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 13 Oct 2023 18:20:41 +0200 Subject: [PATCH 413/513] feat(conform): show error when user overwrites conform config function --- lua/lazyvim/plugins/formatting.lua | 126 ++++++++++++++++------------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 2053d1a553..5042f07659 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -1,8 +1,41 @@ local Util = require("lazyvim.util") +local M = {} + ---@type ConformOpts local format_opts = {} +---@param opts ConformOpts +function M.setup(plugin, opts) + local util = require("conform.util") + opts.formatters = opts.formatters or {} + for name, formatter in pairs(opts.formatters) do + if type(formatter) == "table" then + local ok, defaults = pcall(require, "conform.formatters." .. name) + if ok and type(defaults) == "table" then + opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter) + end + if opts.formatters[name].extra_args then + opts.formatters[name].args = + util.extend_args(opts.formatters[name].args or {}, opts.formatters[name].extra_args) + end + end + end + + for _, key in ipairs({ "format_on_save", "format_after_save" }) do + if opts[key] then + Util.warn( + ("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format( + key + ) + ) + opts[key] = nil + end + end + format_opts = opts.format + require("conform").setup(opts) +end + return { { "stevearc/conform.nvim", @@ -39,62 +72,45 @@ return { }) end) end, - ---@class ConformOpts - opts = { - -- LazyVim will use these options when formatting with the conform.nvim formatter - format = { - timeout_ms = 1000, - }, - formatters_by_ft = { - lua = { "stylua" }, - fish = { "fish_indent" }, - sh = { "shfmt" }, - }, - -- LazyVim will merge the options you set here with builtin formatters. - -- You can also define any custom formatters here. - ---@type table - formatters = { - injected = { options = { ignore_errors = true } }, - -- -- Example of using dprint only when a dprint.json file is present - -- dprint = { - -- condition = function(ctx) - -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] - -- end, - -- }, - shfmt = { - extra_args = { "-i", "2", "-ci" }, - }, - }, - }, - ---@param opts ConformOpts - config = function(_, opts) - local util = require("conform.util") - opts.formatters = opts.formatters or {} - for name, formatter in pairs(opts.formatters) do - if type(formatter) == "table" then - local ok, defaults = pcall(require, "conform.formatters." .. name) - if ok and type(defaults) == "table" then - opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter) - end - if opts.formatters[name].extra_args then - opts.formatters[name].args = - util.extend_args(opts.formatters[name].args or {}, opts.formatters[name].extra_args) - end - end - end - - for _, key in ipairs({ "format_on_save", "format_after_save" }) do - if opts[key] then - Util.warn( - ("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format( - key - ) - ) - opts[key] = nil - end + opts = function() + local plugin = require("lazy.core.config").plugins["conform.nvim"] + if plugin.config ~= M.setup then + Util.error({ + "Don't set `plugin.config` for `conform.nvim`.\n", + "This will break **LazyVim** formatting.\n", + "Please refer to the docs at https://www.lazyvim.org/plugins/formatting", + }, { title = "LazyVim" }) end - format_opts = opts.format - require("conform").setup(opts) + ---@class ConformOpts + return { + -- LazyVim will use these options when formatting with the conform.nvim formatter + format = { + timeout_ms = 1000, + }, + formatters_by_ft = { + lua = { "stylua" }, + fish = { "fish_indent" }, + sh = { "shfmt" }, + }, + -- LazyVim will merge the options you set here with builtin formatters. + -- You can also define any custom formatters here. + ---@type table + formatters = { + injected = { options = { ignore_errors = true } }, + -- # Example of using dprint only when a dprint.json file is present + -- dprint = { + -- condition = function(ctx) + -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + -- + -- # Example of using shfmt with extra args + -- shfmt = { + -- extra_args = { "-i", "2", "-ci" }, + -- }, + }, + } end, + config = M.setup, }, } From 7fe68d9f055fd34d95f19a8711e281ab40629482 Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Fri, 13 Oct 2023 11:17:50 -0600 Subject: [PATCH 414/513] fix(spectre): add title to Spectre panel in edgy (#1703) --- lua/lazyvim/plugins/extras/ui/edgy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 64e6237ae5..6cabd24d4b 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -49,7 +49,7 @@ return { return vim.bo[buf].buftype == "help" end, }, - { ft = "spectre_panel", size = { height = 0.4 } }, + { title = "Spectre", ft = "spectre_panel", size = { height = 0.4 } }, { title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } }, }, left = { From ff9bf005b6957bb46a5541188925f32a1d86365d Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sat, 14 Oct 2023 13:21:30 +0200 Subject: [PATCH 415/513] fix(dashboard-nvim): repository has moved to nvimdev/dashboard-nvim (#1715) * fix(dashboard-nvim) repository has moved to nvimdev/dashboard-nvim * fix(dashboard): automatically rename dashboard.nvim --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/ui/alpha.lua | 2 +- lua/lazyvim/plugins/extras/ui/mini-starter.lua | 2 +- lua/lazyvim/plugins/extras/util/project.lua | 2 +- lua/lazyvim/plugins/ui.lua | 2 +- lua/lazyvim/util/plugin.lua | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index d05c941cc2..875c11c85f 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -1,6 +1,6 @@ return { - { "glepnir/dashboard-nvim", enabled = false }, + { "nvimdev/dashboard-nvim", enabled = false }, { "echasnovski/mini.starter", enabled = false }, -- Dashboard. This runs when neovim starts, and is what displays -- the "LAZYVIM" banner. diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 6ec0e572f1..887db7efa9 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -2,7 +2,7 @@ return { -- disable alpha { "goolord/alpha-nvim", enabled = false }, - { "glepnir/dashboard-nvim", enabled = false }, + { "nvimdev/dashboard-nvim", enabled = false }, -- enable mini.starter { diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 0800e5d5fa..8164d19f6d 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -45,7 +45,7 @@ return { end, }, { - "glepnir/dashboard-nvim", + "nvimdev/dashboard-nvim", optional = true, opts = function(_, opts) local projects = { diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index e821c33e85..abba7d44b1 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -331,7 +331,7 @@ return { end, }, { - "glepnir/dashboard-nvim", + "nvimdev/dashboard-nvim", event = "VimEnter", opts = function() local logo = [[ diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index f23bec3bcb..9ff2c9865a 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -26,6 +26,7 @@ M.renames = { ["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim", ["null-ls.nvim"] = "none-ls.nvim", ["romgrk/nvim-treesitter-context"] = "nvim-treesitter/nvim-treesitter-context", + ["glepnir/dashboard-nvim"] = "nvimdev/dashboard-nvim", } function M.setup() From f724eae2e3d1065f406baa22fc4dae30a49be86b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Oct 2023 11:22:06 +0000 Subject: [PATCH 416/513] 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 49d339b638..0347bf2f1f 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 13 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 14 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 5e1a86d3b257db37c8b443deea6ca1fefcb0b1aa Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Sat, 14 Oct 2023 06:40:25 -0600 Subject: [PATCH 417/513] feat(toggle): add keymap to toggle treesitter context (#1711) * feat: add keymap to toggle treesitter context * fix: get correct enabled state --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/formatting.lua | 2 +- lua/lazyvim/plugins/treesitter.lua | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 5042f07659..c98a725285 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -6,7 +6,7 @@ local M = {} local format_opts = {} ---@param opts ConformOpts -function M.setup(plugin, opts) +function M.setup(_, opts) local util = require("conform.util") opts.formatters = opts.formatters or {} for name, formatter in pairs(opts.formatters) do diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index c833a707a1..1b4debcf43 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -110,6 +110,22 @@ return { event = "LazyFile", enabled = true, opts = { mode = "cursor" }, + keys = { + { + "ut", + function() + local Util = require("lazyvim.util") + local tsc = require("treesitter-context") + tsc.toggle() + if Util.inject.get_upvalue(tsc.toggle, "enabled") then + Util.info("Enabled Treesitter Context", { title = "Option" }) + else + Util.warn("Disabled Treesitter Context", { title = "Option" }) + end + end, + desc = "Toggle Treesitter Context", + }, + }, }, -- Automatically add closing tags for HTML and JSX From 5b89bc8cbf990edec201d07c146a3fe28db3302f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 14 Oct 2023 16:56:18 +0200 Subject: [PATCH 418/513] fix(lsp): trigger FileType commands after installing LSP servers --- lua/lazyvim/plugins/lsp/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 165367bfcc..f0823e467b 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -218,6 +218,15 @@ return { config = function(_, opts) require("mason").setup(opts) local mr = require("mason-registry") + mr:on("package:install:success", function() + vim.defer_fn(function() + -- trigger FileType event to possibly load this newly installed LSP server + require("lazy.core.handler.event").trigger({ + event = "FileType", + buf = vim.api.nvim_get_current_buf(), + }) + end, 100) + end) local function ensure_installed() for _, tool in ipairs(opts.ensure_installed) do local p = mr.get_package(tool) From 6b9ee963e2684e7b37120b86bab5049918e14899 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 14 Oct 2023 16:56:48 +0200 Subject: [PATCH 419/513] fix(news): dont show news when it has never been viewed (new install) --- lua/lazyvim/util/news.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/util/news.lua b/lua/lazyvim/util/news.lua index 11707155d8..4c212470cc 100644 --- a/lua/lazyvim/util/news.lua +++ b/lua/lazyvim/util/news.lua @@ -15,6 +15,9 @@ end function M.setup() vim.schedule(function() if Config.news.lazyvim then + if not Config.json.data.news["NEWS.md"] then + M.welcome() + end M.lazyvim(true) end if Config.news.neovim then @@ -23,6 +26,10 @@ function M.setup() end) end +function M.welcome() + Util.info("Welcome to LazyVim!") +end + function M.changelog() M.open("CHANGELOG.md", { plugin = "LazyVim" }) end @@ -55,23 +62,28 @@ function M.open(file, opts) end if opts.when_changed then + local is_new = not Config.json.data.news[ref] local hash = M.hash(file) if hash == Config.json.data.news[ref] then return end Config.json.data.news[ref] = hash Util.json.save() + -- don't open if file has never been opened + if is_new then + return + end end local float = require("lazy.util").float({ file = file, size = { width = 0.6, height = 0.6 }, }) - vim.wo[float.win].spell = false - vim.wo[float.win].wrap = false - vim.wo[float.win].signcolumn = "yes" - vim.wo[float.win].statuscolumn = " " - vim.wo[float.win].conceallevel = 3 + vim.opt_local.spell = false + vim.opt_local.wrap = false + vim.opt_local.signcolumn = "yes" + vim.opt_local.statuscolumn = " " + vim.opt_local.conceallevel = 3 vim.diagnostic.disable(float.buf) end From 3a93757bb1ee28c3e1b59c6c47ea5c4e74d8f1b2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 14 Oct 2023 17:32:06 +0200 Subject: [PATCH 420/513] fix: dont lazy-load on ft. Load on cmd or keys only --- lua/lazyvim/plugins/extras/lang/markdown.lua | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/markdown.lua diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua new file mode 100644 index 0000000000..123f92bf00 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -0,0 +1,64 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline" }) + end + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "markdownlint" }) + end, + }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.diagnostics.markdownlint, + }) + end, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + markdown = { "markdownlint" }, + }, + }, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + marksman = {}, + }, + }, + }, + + -- Markdown preview + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + keys = { + { + "cp", + ft = "markdown", + "MarkdownPreviewToggle", + desc = "Peek (Markdown Preview)", + }, + }, + config = function() + vim.cmd([[do FileType]]) + end, + }, +} From 121df706047c7c075066ea93b0be389a30644533 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 14 Oct 2023 17:35:13 +0200 Subject: [PATCH 421/513] Revert "fix: dont lazy-load on ft. Load on cmd or keys only" This reverts commit 3a93757bb1ee28c3e1b59c6c47ea5c4e74d8f1b2. --- lua/lazyvim/plugins/extras/lang/markdown.lua | 64 -------------------- 1 file changed, 64 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/lang/markdown.lua diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua deleted file mode 100644 index 123f92bf00..0000000000 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ /dev/null @@ -1,64 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline" }) - end - end, - }, - { - "williamboman/mason.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "markdownlint" }) - end, - }, - { - "nvimtools/none-ls.nvim", - optional = true, - opts = function(_, opts) - local nls = require("null-ls") - opts.sources = vim.list_extend(opts.sources or {}, { - nls.builtins.diagnostics.markdownlint, - }) - end, - }, - { - "mfussenegger/nvim-lint", - optional = true, - opts = { - linters_by_ft = { - markdown = { "markdownlint" }, - }, - }, - }, - { - "neovim/nvim-lspconfig", - opts = { - servers = { - marksman = {}, - }, - }, - }, - - -- Markdown preview - { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - build = function() - vim.fn["mkdp#util#install"]() - end, - keys = { - { - "cp", - ft = "markdown", - "MarkdownPreviewToggle", - desc = "Peek (Markdown Preview)", - }, - }, - config = function() - vim.cmd([[do FileType]]) - end, - }, -} From b3d46bc0141c23bfd4302718ff42dfa172c6952b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owicz?= Date: Sat, 14 Oct 2023 17:42:02 +0200 Subject: [PATCH 422/513] feat(lang): add markdown support (#1718) * feat(lang): add markdown support * feat: use peek.nvim instead of markdown-preview. Disable and show warning when deno is not installed * feat: add markdown-preview back --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/markdown.lua | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/markdown.lua diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua new file mode 100644 index 0000000000..123f92bf00 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -0,0 +1,64 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline" }) + end + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "markdownlint" }) + end, + }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.diagnostics.markdownlint, + }) + end, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + markdown = { "markdownlint" }, + }, + }, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + marksman = {}, + }, + }, + }, + + -- Markdown preview + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + keys = { + { + "cp", + ft = "markdown", + "MarkdownPreviewToggle", + desc = "Peek (Markdown Preview)", + }, + }, + config = function() + vim.cmd([[do FileType]]) + end, + }, +} From 8f42733ce526b6c866b26824d78a1822730c2852 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Sat, 14 Oct 2023 23:49:23 +0800 Subject: [PATCH 423/513] feat(python): add key binding for organize imports (#1670) --- lua/lazyvim/plugins/extras/lang/python.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 835c9da8fb..a478397370 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -12,7 +12,23 @@ return { opts = { servers = { pyright = {}, - ruff_lsp = {}, + ruff_lsp = { + keys = { + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, + }, + }, }, setup = { ruff_lsp = function() From 1a4342abaeb468f22009ce0f2e25e746ca18f585 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 14 Oct 2023 18:02:47 +0200 Subject: [PATCH 424/513] refactor: move cmp status lualine component to util --- lua/lazyvim/plugins/extras/coding/codeium.lua | 38 +-------------- lua/lazyvim/util/init.lua | 1 + lua/lazyvim/util/lualine.lua | 46 +++++++++++++++++++ 3 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 lua/lazyvim/util/lualine.lua diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index 457535cd2c..a9f40624b4 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -27,43 +27,7 @@ return { optional = true, event = "VeryLazy", opts = function(_, opts) - local started = false - local function status() - if not package.loaded["cmp"] then - return - end - for _, s in ipairs(require("cmp").core.sources) do - if s.name == "codeium" then - if s.source:is_available() then - started = true - else - return started and "error" or nil - end - if s.status == s.SourceStatus.FETCHING then - return "pending" - end - return "ok" - end - end - end - - local Util = require("lazyvim.util") - local colors = { - ok = Util.ui.fg("Special"), - error = Util.ui.fg("DiagnosticError"), - pending = Util.ui.fg("DiagnosticWarn"), - } - table.insert(opts.sections.lualine_x, 2, { - function() - return require("lazyvim.config").icons.kinds.Codeium - end, - cond = function() - return status() ~= nil - end, - color = function() - return colors[status()] or colors.ok - end, - }) + table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("codeium")) end, }, } diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index ddfa55f8f2..4a98aee422 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -13,6 +13,7 @@ local LazyUtil = require("lazy.core.util") ---@field inject lazyvim.util.inject ---@field news lazyvim.util.news ---@field json lazyvim.util.json +---@field lualine lazyvim.util.lualine local M = {} ---@type table diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua new file mode 100644 index 0000000000..8efcf71441 --- /dev/null +++ b/lua/lazyvim/util/lualine.lua @@ -0,0 +1,46 @@ +local Util = require("lazyvim.util") + +---@class lazyvim.util.lualine +local M = {} + +function M.cmp_source(name, icon) + local started = false + local function status() + if not package.loaded["cmp"] then + return + end + for _, s in ipairs(require("cmp").core.sources) do + if s.name == name then + if s.source:is_available() then + started = true + else + return started and "error" or nil + end + if s.status == s.SourceStatus.FETCHING then + return "pending" + end + return "ok" + end + end + end + + local colors = { + ok = Util.ui.fg("Special"), + error = Util.ui.fg("DiagnosticError"), + pending = Util.ui.fg("DiagnosticWarn"), + } + + return { + function() + return icon or require("lazyvim.config").icons.kinds[name:sub(1, 1):upper() .. name:sub(2)] + end, + cond = function() + return status() ~= nil + end, + color = function() + return colors[status()] or colors.ok + end, + } +end + +return M From 95ff5aaa6245244d45609916b0a623c5e8c79d16 Mon Sep 17 00:00:00 2001 From: "Dung Duc Huynh (Kaka)" <870029+jellydn@users.noreply.github.com> Date: Sun, 15 Oct 2023 00:25:06 +0800 Subject: [PATCH 425/513] feat(extras): added TabNine (#1651) * feat: add Tabnine Add TabNine plugin for hrsh7th/nvim-cmp * fix: limit to top 3 sources for TabNine * feat: show Tabnine icon on suggestion list * fix: migrate to LazyVim v10 * refactor: tabnine * refactor --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/config/init.lua | 1 + lua/lazyvim/plugins/extras/coding/tabnine.lua | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/coding/tabnine.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 4a5abf178b..170f78bcf5 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -84,6 +84,7 @@ local defaults = { Snippet = " ", String = " ", Struct = "󰆼 ", + TabNine = "󰏚 ", Text = " ", TypeParameter = " ", Unit = " ", diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/coding/tabnine.lua new file mode 100644 index 0000000000..57748f5fae --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/tabnine.lua @@ -0,0 +1,50 @@ +local Util = require("lazyvim.util") + +return { + -- Tabnine cmp source + { + "nvim-cmp", + dependencies = { + -- Add TabNine support, make sure you run :CmpTabnineHub after installation. + { + "tzachar/cmp-tabnine", + build = "./install.sh", + dependencies = "hrsh7th/nvim-cmp", + opts = { + max_lines = 1000, + max_num_results = 3, + sort = true, + }, + config = function(_, opts) + local tabnine = require("cmp_tabnine.config") + tabnine:setup(opts) + end, + }, + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "cmp_tabnine", + group_index = 1, + priority = 100, + }) + + opts.formatting.format = Util.inject.args(opts.formatting.format, function(entry, item) + -- Hide percentage in the menu + if entry.source.name == "cmp_tabnine" then + item.menu = "" + end + end) + end, + }, + -- Show TabNine status in lualine + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + local icon = require("lazyvim.config").icons.kinds.TabNine + table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("cmp_tabnine", icon)) + end, + }, +} From f29543f2c9323ae84d0979f36598c0fb78ed767a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:30:55 +0200 Subject: [PATCH 426/513] chore(main): release 10.2.0 (#1696) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 25 +++++++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80f25f8ec0..7754b28fad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [10.2.0](https://github.com/LazyVim/LazyVim/compare/v10.1.1...v10.2.0) (2023-10-14) + + +### Features + +* **conform:** make it easier to add `extra_args` ([3eb91c6](https://github.com/LazyVim/LazyVim/commit/3eb91c64b5960ccd84bd8e6a3318a1ee79cb85c5)) +* **conform:** show error when user overwrites conform config function ([b6e68fa](https://github.com/LazyVim/LazyVim/commit/b6e68fa2bf829753be86ba8cc56baafd47b7da67)) +* **conform:** use conform.nvim `opts.format` options for formatting with conform ([6fd66f4](https://github.com/LazyVim/LazyVim/commit/6fd66f486e210e35b4c375691fbfd61a611b6027)) +* **extras:** added TabNine ([#1651](https://github.com/LazyVim/LazyVim/issues/1651)) ([95ff5aa](https://github.com/LazyVim/LazyVim/commit/95ff5aaa6245244d45609916b0a623c5e8c79d16)) +* **format:** use conform as lsp formatter since it has better format diffs ([4584410](https://github.com/LazyVim/LazyVim/commit/4584410e76bf8a6ba426270bef8eca5a100d4cce)) +* **go:** add gofumpt formatter with conform/none-ls ([#1683](https://github.com/LazyVim/LazyVim/issues/1683)) ([385c99d](https://github.com/LazyVim/LazyVim/commit/385c99dbb7ccdcf53276086892cceee65b85fa21)) +* **lang:** add markdown support ([#1718](https://github.com/LazyVim/LazyVim/issues/1718)) ([b3d46bc](https://github.com/LazyVim/LazyVim/commit/b3d46bc0141c23bfd4302718ff42dfa172c6952b)) +* **python:** add key binding for organize imports ([#1670](https://github.com/LazyVim/LazyVim/issues/1670)) ([8f42733](https://github.com/LazyVim/LazyVim/commit/8f42733ce526b6c866b26824d78a1822730c2852)) +* **toggle:** add keymap to toggle treesitter context ([#1711](https://github.com/LazyVim/LazyVim/issues/1711)) ([5e1a86d](https://github.com/LazyVim/LazyVim/commit/5e1a86d3b257db37c8b443deea6ca1fefcb0b1aa)) + + +### Bug Fixes + +* **dashboard-nvim:** repository has moved to nvimdev/dashboard-nvim ([#1715](https://github.com/LazyVim/LazyVim/issues/1715)) ([ff9bf00](https://github.com/LazyVim/LazyVim/commit/ff9bf005b6957bb46a5541188925f32a1d86365d)) +* dont lazy-load on ft. Load on cmd or keys only ([3a93757](https://github.com/LazyVim/LazyVim/commit/3a93757bb1ee28c3e1b59c6c47ea5c4e74d8f1b2)) +* **keymaps:** no diagnostic keymaps w/o lsp attached ([#1698](https://github.com/LazyVim/LazyVim/issues/1698)) ([873ff89](https://github.com/LazyVim/LazyVim/commit/873ff892843898033be0b59cee8130c6b1b29d85)) +* **lsp:** trigger FileType commands after installing LSP servers ([5b89bc8](https://github.com/LazyVim/LazyVim/commit/5b89bc8cbf990edec201d07c146a3fe28db3302f)) +* **news:** dont show news when it has never been viewed (new install) ([6b9ee96](https://github.com/LazyVim/LazyVim/commit/6b9ee963e2684e7b37120b86bab5049918e14899)) +* **spectre:** add title to Spectre panel in edgy ([#1703](https://github.com/LazyVim/LazyVim/issues/1703)) ([7fe68d9](https://github.com/LazyVim/LazyVim/commit/7fe68d9f055fd34d95f19a8711e281ab40629482)) + ## [10.1.1](https://github.com/LazyVim/LazyVim/compare/v10.1.0...v10.1.1) (2023-10-13) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 170f78bcf5..84163165c9 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.1.1" -- x-release-please-version +M.version = "10.2.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 6e0e352fea4cd930ea7fc42a0252c2c70b279bee Mon Sep 17 00:00:00 2001 From: Michael Olson <48652773+m0lson84@users.noreply.github.com> Date: Sun, 15 Oct 2023 01:18:00 -0400 Subject: [PATCH 427/513] feat(linting): ability to configure global and fallback linters (#1727) * feat(linting): ability to configure global and fallback linters * fix: use nvim-lint's logic to get linters --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/linting.lua | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/linting.lua b/lua/lazyvim/plugins/linting.lua index db9fe9c3ce..2d2527c1a4 100644 --- a/lua/lazyvim/plugins/linting.lua +++ b/lua/lazyvim/plugins/linting.lua @@ -7,6 +7,10 @@ return { events = { "BufWritePost", "BufReadPost", "InsertLeave" }, linters_by_ft = { fish = { "fish" }, + -- Use the "*" filetype to run linters on all filetypes. + -- ['*'] = { 'global linter' }, + -- Use the "_" filetype to run linters on filetypes that don't have other linters configured. + -- ['_'] = { 'fallback linter' }, }, -- LazyVim extension to easily override linter options -- or add custom linters. @@ -23,6 +27,8 @@ return { }, }, config = function(_, opts) + local Util = require("lazyvim.util") + local M = {} local lint = require("lint") @@ -47,14 +53,32 @@ return { end function M.lint() - local names = lint.linters_by_ft[vim.bo.filetype] or {} + -- Use nvim-lint's logic first: + -- * checks if linters exist for the full filetype first + -- * otherwise will split filetype by "." and add all those linters + -- * this differs from conform.nvim which only uses the first filetype that has a formatter + local names = lint._resolve_linter_by_ft(vim.bo.filetype) + + -- Add fallback linters. + if #names == 0 then + vim.list_extend(names, lint.linters_by_ft["_"] or {}) + end + + -- Add global linters. + vim.list_extend(names, lint.linters_by_ft["*"] or {}) + + -- Filter out linters that don't exist or don't match the condition. local ctx = { filename = vim.api.nvim_buf_get_name(0) } ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") names = vim.tbl_filter(function(name) local linter = lint.linters[name] + if not linter then + Util.warn("Linter not found: " .. name, { title = "nvim-lint" }) + end return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) end, names) + -- Run linters. if #names > 0 then lint.try_lint(names) end From 5ea0dd716af0a4b5e732457525cfd8a55fe30e65 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Oct 2023 05:18:51 +0000 Subject: [PATCH 428/513] 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 0347bf2f1f..ecbf2c58c3 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 14 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 15 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 7c60431c58a050cf4badced0609f3179bd284137 Mon Sep 17 00:00:00 2001 From: jyuan0 Date: Sun, 15 Oct 2023 01:21:17 -0400 Subject: [PATCH 429/513] fix(python): add `ft` to Python keymaps, and fix "Markdown Preview" toggle description (#1729) * feat(python): add `ft` to keymaps * fix(markdown): fix toggle keymap description --- lua/lazyvim/plugins/extras/lang/markdown.lua | 2 +- lua/lazyvim/plugins/extras/lang/python.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index 123f92bf00..f57954f1a1 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -54,7 +54,7 @@ return { "cp", ft = "markdown", "MarkdownPreviewToggle", - desc = "Peek (Markdown Preview)", + desc = "Markdown Preview", }, }, config = function() diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index a478397370..cc9bc52ea7 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -65,8 +65,8 @@ return { "mfussenegger/nvim-dap-python", -- stylua: ignore keys = { - { "dPt", function() require('dap-python').test_method() end, desc = "Debug Method" }, - { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class" }, + { "dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" }, + { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() local path = require("mason-registry").get_package("debugpy"):get_install_path() From 53e1637a864cb7e8f21af107b8073bc8b24acd11 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 09:16:52 +0200 Subject: [PATCH 430/513] feat(dashboard): `c` on dahboard now opens telescope for config dir instead of useless `init.lua` --- lua/lazyvim/plugins/editor.lua | 1 + lua/lazyvim/plugins/extras/ui/alpha.lua | 4 ++-- lua/lazyvim/plugins/extras/ui/mini-starter.lua | 18 +++++++++--------- lua/lazyvim/plugins/ui.lua | 8 ++++---- lua/lazyvim/util/telescope.lua | 4 ++++ 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 63a8e1b1a4..9ee3eb0354 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -133,6 +133,7 @@ return { { "", Util.telescope("files"), desc = "Find Files (root dir)" }, -- find { "fb", "Telescope buffers", desc = "Buffers" }, + { "fc", Util.telescope.config_files(), desc = "Find Config File" }, { "ff", Util.telescope("files"), desc = "Find Files (root dir)" }, { "fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, { "fr", "Telescope oldfiles", desc = "Recent" }, diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index 875c11c85f..8feee18802 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -27,9 +27,9 @@ return { dashboard.button("n", " " .. " New file", " ene startinsert "), dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), dashboard.button("g", " " .. " Find text", " Telescope live_grep "), - dashboard.button("c", " " .. " Config", " e $MYVIMRC "), + dashboard.button("c", " " .. " Config", " lua require('lazyvim.util').telescope.config_files()() "), dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), - dashboard.button("e", " " .. " Lazy Extras", " LazyExtras "), + dashboard.button("x", " " .. " Lazy Extras", " LazyExtras "), dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), dashboard.button("q", " " .. " Quit", " qa "), } diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 887db7efa9..5f5ec9c541 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -29,15 +29,15 @@ return { evaluate_single = true, header = logo, items = { - new_section("Find file", "Telescope find_files", "Telescope"), - new_section("Recent files", "Telescope oldfiles", "Telescope"), - new_section("Grep text", "Telescope live_grep", "Telescope"), - new_section("init.lua", "e $MYVIMRC", "Config"), - new_section("Extras", "LazyExtras", "Config"), - new_section("Lazy", "Lazy", "Config"), - new_section("New file", "ene | startinsert", "Built-in"), - new_section("Quit", "qa", "Built-in"), - new_section("Session restore", [[lua require("persistence").load()]], "Session"), + new_section("Find file", "Telescope find_files", "Telescope"), + new_section("Recent files", "Telescope oldfiles", "Telescope"), + new_section("Grep text", "Telescope live_grep", "Telescope"), + new_section("Config", "lua require('lazyvim.util').telescope.config_files()()", "Config"), + new_section("Extras", "LazyExtras", "Config"), + new_section("Lazy", "Lazy", "Config"), + new_section("New file", "ene | startinsert", "Built-in"), + new_section("Quit", "qa", "Built-in"), + new_section("Session restore", [[lua require("persistence").load()]], "Session"), }, content_hooks = { starter.gen_hook.adding_bullet(pad .. "░ ", false), diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index abba7d44b1..0707fb5b35 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -1,3 +1,5 @@ +local Util = require("lazyvim.util") + return { -- Better `vim.notify()` { @@ -25,7 +27,6 @@ return { }, init = function() -- when noice is not enabled, install notify on VeryLazy - local Util = require("lazyvim.util") if not Util.has("noice.nvim") then Util.on_very_lazy(function() vim.notify = require("notify") @@ -118,7 +119,6 @@ return { lualine_require.require = require local icons = require("lazyvim.config").icons - local Util = require("lazyvim.util") vim.o.laststatus = vim.g.lualine_laststatus @@ -360,9 +360,9 @@ return { { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, - { action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" }, + { action = Util.telescope.config_files(), desc = " Config", icon = " ", key = "c" }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "e" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, { action = "qa", desc = " Quit", icon = " ", key = "q" }, }, diff --git a/lua/lazyvim/util/telescope.lua b/lua/lazyvim/util/telescope.lua index 6891634115..1d816b80b9 100644 --- a/lua/lazyvim/util/telescope.lua +++ b/lua/lazyvim/util/telescope.lua @@ -50,4 +50,8 @@ function M.telescope(builtin, opts) end end +function M.config_files() + return Util.telescope("find_files", { cwd = vim.fn.stdpath("config") }) +end + return M From 57b504b9e8ae95c294c17e97e7f017f6f802ebbc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:28:56 +0200 Subject: [PATCH 431/513] fix(prettier): use prettier instead of prettierd. Too many people get truncated files. Fixes #712. See #1735 --- .../plugins/extras/formatting/prettier.lua | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 6f1f3b58ef..a93f6ecfb0 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -2,7 +2,7 @@ return { { "williamboman/mason.nvim", opts = function(_, opts) - table.insert(opts.ensure_installed, "prettierd") + table.insert(opts.ensure_installed, "prettier") end, }, { @@ -11,7 +11,7 @@ return { opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} - table.insert(opts.sources, nls.builtins.formatting.prettierd) + table.insert(opts.sources, nls.builtins.formatting.prettier) end, }, { @@ -19,22 +19,22 @@ return { optional = true, opts = { formatters_by_ft = { - ["javascript"] = { { "prettierd", "prettier" } }, - ["javascriptreact"] = { { "prettierd", "prettier" } }, - ["typescript"] = { { "prettierd", "prettier" } }, - ["typescriptreact"] = { { "prettierd", "prettier" } }, - ["vue"] = { { "prettierd", "prettier" } }, - ["css"] = { { "prettierd", "prettier" } }, - ["scss"] = { { "prettierd", "prettier" } }, - ["less"] = { { "prettierd", "prettier" } }, - ["html"] = { { "prettierd", "prettier" } }, - ["json"] = { { "prettierd", "prettier" } }, - ["jsonc"] = { { "prettierd", "prettier" } }, - ["yaml"] = { { "prettierd", "prettier" } }, - ["markdown"] = { { "prettierd", "prettier" } }, - ["markdown.mdx"] = { { "prettierd", "prettier" } }, - ["graphql"] = { { "prettierd", "prettier" } }, - ["handlebars"] = { { "prettierd", "prettier" } }, + ["javascript"] = { "prettier" }, + ["javascriptreact"] = { "prettier" }, + ["typescript"] = { "prettier" }, + ["typescriptreact"] = { "prettier" }, + ["vue"] = { "prettier" }, + ["css"] = { "prettier" }, + ["scss"] = { "prettier" }, + ["less"] = { "prettier" }, + ["html"] = { "prettier" }, + ["json"] = { "prettier" }, + ["jsonc"] = { "prettier" }, + ["yaml"] = { "prettier" }, + ["markdown"] = { "prettier" }, + ["markdown.mdx"] = { "prettier" }, + ["graphql"] = { "prettier" }, + ["handlebars"] = { "prettier" }, }, }, }, From 782fe0bef0789c8f090284df80c00799471bc16f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:34:42 +0200 Subject: [PATCH 432/513] feat: disable kind_filter for markdown and help --- lua/lazyvim/config/init.lua | 10 ++++++++-- .../plugins/extras/editor/symbols-outline.lua | 20 ++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 84163165c9..19686b57d1 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -92,7 +92,7 @@ local defaults = { Variable = "󰀫 ", }, }, - ---@type table? + ---@type table? kind_filter = { default = { "Class", @@ -109,6 +109,8 @@ local defaults = { "Struct", "Trait", }, + markdown = false, + help = false, -- you can specify a different filter for each filetype lua = { "Class", @@ -214,7 +216,11 @@ function M.get_kind_filter(buf) if M.kind_filter == false then return end - return M.kind_filter[ft] or M.kind_filter.default + if M.kind_filter[ft] == false then + return + end + ---@diagnostic disable-next-line: return-type-mismatch + return type(M.kind_filter) == "table" and type(M.kind_filter.default) == "table" and M.kind_filter.default or nil end ---@param name "autocmds" | "options" | "keymaps" diff --git a/lua/lazyvim/plugins/extras/editor/symbols-outline.lua b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua index f0b0ba922b..32cdd17f94 100644 --- a/lua/lazyvim/plugins/extras/editor/symbols-outline.lua +++ b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua @@ -12,14 +12,20 @@ return { symbols = {}, symbol_blacklist = {}, } + local filter = Config.kind_filter - for kind, symbol in pairs(defaults.symbols) do - opts.symbols[kind] = { - icon = Config.icons.kinds[kind] or symbol.icon, - hl = symbol.hl, - } - if not vim.tbl_contains(Config.kind_filter.default, kind) then - table.insert(opts.symbol_blacklist, kind) + if type(filter) == "table" then + filter = filter.default + if type(filter) == "table" then + for kind, symbol in pairs(defaults.symbols) do + opts.symbols[kind] = { + icon = Config.icons.kinds[kind] or symbol.icon, + hl = symbol.hl, + } + if not vim.tbl_contains(filter, kind) then + table.insert(opts.symbol_blacklist, kind) + end + end end end return opts From 8af7309c7e31f55125eaade5fe86d04d63133999 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:37:49 +0200 Subject: [PATCH 433/513] feat(lualine): pretty_path now highlights file basename when modified --- lua/lazyvim/plugins/ui.lua | 8 ++---- lua/lazyvim/util/init.lua | 4 +++ lua/lazyvim/util/lualine.lua | 55 ++++++++++++++++++++++++++++++++++++ lua/lazyvim/util/root.lua | 39 +++++-------------------- 4 files changed, 69 insertions(+), 37 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 0707fb5b35..73a52cdfaf 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -131,7 +131,9 @@ return { sections = { lualine_a = { "mode" }, lualine_b = { "branch" }, + lualine_c = { + Util.lualine.root_dir(), { "diagnostics", symbols = { @@ -142,11 +144,7 @@ return { }, }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, - { - function() - return Util.root.pretty_path() - end, - }, + { Util.lualine.pretty_path() }, }, lualine_x = { -- stylua: ignore diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 4a98aee422..24fd0a1b9f 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -49,6 +49,10 @@ setmetatable(M, { end, }) +function M.is_win() + return vim.loop.os_uname().sysname:find("Windows") ~= nil +end + ---@param plugin string function M.has(plugin) return require("lazy.core.config").spec.plugins[plugin] ~= nil diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 8efcf71441..7eb353bf0b 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -43,4 +43,59 @@ function M.cmp_source(name, icon) } end +---@param component any +---@param text string +---@param hl_group? string +---@return string +function M.format(component, text, hl_group) + if not hl_group then + return text + end + ---@type table + component.hl_cache = component.hl_cache or {} + local lualine_hl_group = component.hl_cache[hl_group] + if not lualine_hl_group then + local utils = require("lualine.utils.utils") + lualine_hl_group = component:create_hl({ fg = utils.extract_highlight_colors(hl_group, "fg") }, "LV_" .. hl_group) + component.hl_cache[hl_group] = lualine_hl_group + end + return component:format_hl(lualine_hl_group) .. text .. component:get_default_hl() +end + +---@param opts? {relative: "cwd"|"root", modified_hl: string?} +function M.pretty_path(opts) + opts = vim.tbl_extend("force", { + relative = "cwd", + modified_hl = "Constant", + }, opts or {}) + + return function(self) + local path = vim.fn.expand("%:p") --[[@as string]] + + if path == "" then + return "" + end + local root = Util.root.get() + local cwd = Util.root.cwd() + + if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then + path = path:sub(#cwd + 2) + else + path = path:sub(#root + 2) + end + + local sep = package.config:sub(1, 1) + local parts = vim.split(path, "[\\/]") + if #parts > 3 then + parts = { parts[1], "…", parts[#parts - 1], parts[#parts] } + end + + if opts.modified_hl and vim.bo.modified then + parts[#parts] = M.format(self, parts[#parts], opts.modified_hl) + end + + return table.concat(parts, sep) + end +end + return M diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index d799fe441c..80aece2237 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -58,6 +58,10 @@ function M.bufpath(buf) return M.realpath(vim.api.nvim_buf_get_name(assert(buf))) end +function M.cwd() + return M.realpath(vim.loop.cwd()) or "" +end + function M.realpath(path) if path == "" or path == nil then return nil @@ -144,38 +148,9 @@ function M.get() return roots[1] and roots[1].paths[1] or vim.loop.cwd() end -M.pretty_cache = {} ---@type table -function M.pretty_path() - local path = vim.fn.expand("%:p") --[[@as string]] - if path == "" then - return "" - end - - path = Util.norm(path) - if M.pretty_cache[path] then - return M.pretty_cache[path] - end - local cache_key = path - local cwd = M.realpath(vim.loop.cwd()) or "" - - if path:find(cwd, 1, true) == 1 then - path = path:sub(#cwd + 2) - else - local roots = M.detect({ spec = { ".git" } }) - local root = roots[1] and roots[1].paths[1] or nil - if root then - path = path:sub(#vim.fs.dirname(root) + 2) - end - end - - local sep = package.config:sub(1, 1) - local parts = vim.split(path, "[\\/]") - if #parts > 3 then - parts = { parts[1], "…", parts[#parts - 1], parts[#parts] } - end - local ret = table.concat(parts, sep) - M.pretty_cache[cache_key] = ret - return ret +---@param opts? {hl_last?: string} +function M.pretty_path(opts) + return "" end return M From 6f88b8b36f8d4fd0e958e59b4e37e1a9ed2acb78 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:38:15 +0200 Subject: [PATCH 434/513] fix(root): dont use single-file lsps for root detection. use workspaces only --- lua/lazyvim/util/root.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 80aece2237..519546e142 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -32,13 +32,12 @@ function M.detectors.lsp(buf) end local roots = {} ---@type string[] for _, client in pairs(Util.lsp.get_clients({ bufnr = buf })) do + -- only check workspace folders, since we're not interested in clients + -- running in single file mode local workspace = client.config.workspace_folders for _, ws in pairs(workspace or {}) do roots[#roots + 1] = vim.uri_to_fname(ws.uri) end - if client.config.root_dir then - roots[#roots + 1] = client.config.root_dir - end end return vim.tbl_filter(function(path) path = Util.norm(path) From dfdfcad1aab0ee39ac3876e47cbeb727eb4f1e95 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:38:44 +0200 Subject: [PATCH 435/513] feat(lualine): new root dir component that only shows when cwd != root_dir --- lua/lazyvim/util/lualine.lua | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 7eb353bf0b..1ec2cd1963 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -98,4 +98,46 @@ function M.pretty_path(opts) end end +---@param opts? {cwd:false, subdirectory: true, parent: true, other: true, icon?:string} +function M.root_dir(opts) + opts = vim.tbl_extend("force", { + cwd = false, + subdirectory = true, + parent = true, + other = true, + icon = "󱉭 ", + color = Util.ui.fg("Special"), + }, opts or {}) + + local function get() + local cwd = Util.root.cwd() + local root = Util.root.get() + local name = vim.fs.basename(root) + + if root == cwd then + -- root is cwd + return opts.cwd and name + elseif root:find(cwd, 1, true) == 1 then + -- root is subdirectory of cwd + return opts.subdirectory and name + elseif cwd:find(root, 1, true) == 1 then + -- root is parent directory of cwd + return opts.parent and name + else + -- root and cwd are not related + return opts.other and name + end + end + + return { + function() + return (opts.icon and opts.icon .. " ") .. get() + end, + cond = function() + return type(get()) == "string" + end, + color = opts.color, + } +end + return M From c8e5501ee5ecd1a7b27ff3aa5f41e54c2e98ff0b Mon Sep 17 00:00:00 2001 From: Edouard Shamis <47914518+edshamis@users.noreply.github.com> Date: Sun, 15 Oct 2023 23:42:38 +0300 Subject: [PATCH 436/513] feat(tabnine): add build cmd for Windows (#1737) * feat(tabnine): add build cmd for Windows * fix(prettier): use prettier instead of prettierd. Too many people get truncated files. Fixes #712. See #1735 * feat: disable kind_filter for markdown and help * feat(lualine): pretty_path now highlights file basename when modified * fix(root): dont use single-file lsps for root detection. use workspaces only * feat(lualine): new root dir component that only shows when cwd != root_dir * refactor --------- Co-authored-by: edshamis Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/coding/tabnine.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/coding/tabnine.lua index 57748f5fae..696103cef3 100644 --- a/lua/lazyvim/plugins/extras/coding/tabnine.lua +++ b/lua/lazyvim/plugins/extras/coding/tabnine.lua @@ -8,7 +8,7 @@ return { -- Add TabNine support, make sure you run :CmpTabnineHub after installation. { "tzachar/cmp-tabnine", - build = "./install.sh", + build = Util.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", dependencies = "hrsh7th/nvim-cmp", opts = { max_lines = 1000, @@ -16,8 +16,7 @@ return { sort = true, }, config = function(_, opts) - local tabnine = require("cmp_tabnine.config") - tabnine:setup(opts) + require("cmp_tabnine.config"):setup(opts) end, }, }, From e26a127185e9dc86d1d655d17fa0a5e765a8a040 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:51:01 +0200 Subject: [PATCH 437/513] chore(main): release 10.3.0 (#1733) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 19 +++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7754b28fad..d4c3bd7865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [10.3.0](https://github.com/LazyVim/LazyVim/compare/v10.2.0...v10.3.0) (2023-10-15) + + +### Features + +* **dashboard:** `c` on dahboard now opens telescope for config dir instead of useless `init.lua` ([53e1637](https://github.com/LazyVim/LazyVim/commit/53e1637a864cb7e8f21af107b8073bc8b24acd11)) +* disable kind_filter for markdown and help ([782fe0b](https://github.com/LazyVim/LazyVim/commit/782fe0bef0789c8f090284df80c00799471bc16f)) +* **linting:** ability to configure global and fallback linters ([#1727](https://github.com/LazyVim/LazyVim/issues/1727)) ([6e0e352](https://github.com/LazyVim/LazyVim/commit/6e0e352fea4cd930ea7fc42a0252c2c70b279bee)) +* **lualine:** new root dir component that only shows when cwd != root_dir ([dfdfcad](https://github.com/LazyVim/LazyVim/commit/dfdfcad1aab0ee39ac3876e47cbeb727eb4f1e95)) +* **lualine:** pretty_path now highlights file basename when modified ([8af7309](https://github.com/LazyVim/LazyVim/commit/8af7309c7e31f55125eaade5fe86d04d63133999)) +* **tabnine:** add build cmd for Windows ([#1737](https://github.com/LazyVim/LazyVim/issues/1737)) ([c8e5501](https://github.com/LazyVim/LazyVim/commit/c8e5501ee5ecd1a7b27ff3aa5f41e54c2e98ff0b)) + + +### Bug Fixes + +* **prettier:** use prettier instead of prettierd. Too many people get truncated files. Fixes [#712](https://github.com/LazyVim/LazyVim/issues/712). See [#1735](https://github.com/LazyVim/LazyVim/issues/1735) ([57b504b](https://github.com/LazyVim/LazyVim/commit/57b504b9e8ae95c294c17e97e7f017f6f802ebbc)) +* **python:** add `ft` to Python keymaps, and fix "Markdown Preview" toggle description ([#1729](https://github.com/LazyVim/LazyVim/issues/1729)) ([7c60431](https://github.com/LazyVim/LazyVim/commit/7c60431c58a050cf4badced0609f3179bd284137)) +* **root:** dont use single-file lsps for root detection. use workspaces only ([6f88b8b](https://github.com/LazyVim/LazyVim/commit/6f88b8b36f8d4fd0e958e59b4e37e1a9ed2acb78)) + ## [10.2.0](https://github.com/LazyVim/LazyVim/compare/v10.1.1...v10.2.0) (2023-10-14) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 19686b57d1..3b8092c77e 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.2.0" -- x-release-please-version +M.version = "10.3.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From be5eea476c98d46aefbbaee04b7f2bc82bb51c27 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 07:29:02 +0200 Subject: [PATCH 438/513] feat(keymaps): added toggle for treesitter highlights --- 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 85517a657d..173705abc2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -129,6 +129,7 @@ map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceal if vim.lsp.inlay_hint then map("n", "uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" }) end +map("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) -- lazygit map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) From 66482927cb279b8a5d9cfb4fc5c982d6e98c3aa3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Oct 2023 05:30:47 +0000 Subject: [PATCH 439/513] 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 ecbf2c58c3..82cf4b6a5a 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 15 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 16 ============================================================================== Table of Contents *LazyVim-table-of-contents* From c3daced11ce33875059ad5dd74832bf4a232f195 Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Sun, 15 Oct 2023 23:35:57 -0600 Subject: [PATCH 440/513] feat(ui): add keymap to close other buffers (#1743) * feat(ui): add keymap to close other buffers * refactor --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/config/keymaps.lua | 15 ++++----------- lua/lazyvim/plugins/ui.lua | 7 +++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 173705abc2..bdfdec8805 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -30,17 +30,10 @@ map("v", "", ":m '>+1gv=gv", { desc = "Move down" }) map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) -- buffers -if Util.has("bufferline.nvim") then - map("n", "", "BufferLineCyclePrev", { desc = "Prev buffer" }) - map("n", "", "BufferLineCycleNext", { desc = "Next buffer" }) - map("n", "[b", "BufferLineCyclePrev", { desc = "Prev buffer" }) - map("n", "]b", "BufferLineCycleNext", { desc = "Next buffer" }) -else - map("n", "", "bprevious", { desc = "Prev buffer" }) - map("n", "", "bnext", { desc = "Next buffer" }) - map("n", "[b", "bprevious", { desc = "Prev buffer" }) - map("n", "]b", "bnext", { desc = "Next buffer" }) -end +map("n", "", "bprevious", { desc = "Prev buffer" }) +map("n", "", "bnext", { desc = "Next buffer" }) +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" }) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 73a52cdfaf..3ccda60bd6 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -61,6 +61,13 @@ return { keys = { { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, + { "bo", "BufferlineCloseOthers", desc = "Delete other buffers" }, + { "br", "BufferlineCloseRight", desc = "Delete buffers to the right" }, + { "bl", "BufferlineCloseLeft", desc = "Delete buffers to the left" }, + { "", "BufferLineCyclePrev", desc = "Prev buffer" }, + { "", "BufferLineCycleNext", desc = "Next buffer" }, + { "[b", "BufferLineCyclePrev", desc = "Prev buffer" }, + { "]b", "BufferLineCycleNext", desc = "Next buffer" }, }, opts = { options = { From 8c726cd16638f51308f479f26143d94a6c3013ea Mon Sep 17 00:00:00 2001 From: Edouard Shamis <47914518+edshamis@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:44:10 +0300 Subject: [PATCH 441/513] feat(lualine): use gitsigns for diff source (#1744) Co-authored-by: edshamis --- lua/lazyvim/plugins/ui.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 3ccda60bd6..69b46309d8 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -184,6 +184,16 @@ return { modified = icons.git.modified, removed = icons.git.removed, }, + source = function() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed, + } + end + end, }, }, lualine_y = { From 5c4f8811587d42965beea8eee3a9895cc7911c6a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 07:39:24 +0200 Subject: [PATCH 442/513] style(keymaps): no need to check for trouble to set [q, ]q --- lua/lazyvim/config/keymaps.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index bdfdec8805..4b36d0abec 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -81,10 +81,8 @@ map("n", "fn", "enew", { desc = "New File" }) map("n", "xl", "lopen", { desc = "Location List" }) map("n", "xq", "copen", { desc = "Quickfix List" }) -if not Util.has("trouble.nvim") then - map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) - map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) -end +map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) +map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) -- formatting map({ "n", "v" }, "cf", function() From 982c8e301bb432f44a85d915a8268442c7db05fa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 08:11:15 +0200 Subject: [PATCH 443/513] fix(conform): remove LazyVim's conform config changes since that's now merged in conform --- lua/lazyvim/plugins/formatting.lua | 38 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index c98a725285..28c794fccb 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -3,21 +3,17 @@ local Util = require("lazyvim.util") local M = {} ---@type ConformOpts -local format_opts = {} +local conform_opts = {} ---@param opts ConformOpts function M.setup(_, opts) - local util = require("conform.util") - opts.formatters = opts.formatters or {} - for name, formatter in pairs(opts.formatters) do + for name, formatter in pairs(opts.formatters or {}) do if type(formatter) == "table" then - local ok, defaults = pcall(require, "conform.formatters." .. name) - if ok and type(defaults) == "table" then - opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter) - end - if opts.formatters[name].extra_args then - opts.formatters[name].args = - util.extend_args(opts.formatters[name].args or {}, opts.formatters[name].extra_args) + ---@diagnostic disable-next-line: undefined-field + if formatter.extra_args then + ---@diagnostic disable-next-line: undefined-field + formatter.prepend_args = formatter.extra_args + Util.deprecate(("opts.formatters.%s.extra_args"):format(name), ("opts.formatters.%s.prepend_args"):format(name)) end end end @@ -29,10 +25,11 @@ function M.setup(_, opts) key ) ) + ---@diagnostic disable-next-line: no-unknown opts[key] = nil end end - format_opts = opts.format + conform_opts = opts require("conform").setup(opts) end @@ -61,10 +58,15 @@ return { priority = 100, primary = true, format = function(buf) - require("conform").format(Util.merge(format_opts, { bufnr = buf })) + require("conform").format(Util.merge({ + timeout_ms = conform_opts.format.timeout_ms, + async = conform_opts.format.async, + quiet = conform_opts.format.quiet, + }, { bufnr = buf })) end, sources = function(buf) local ret = require("conform").list_formatters(buf) + ---@param v conform.FormatterInfo return vim.tbl_map(function(v) return v.name end, ret) @@ -82,11 +84,14 @@ return { }, { title = "LazyVim" }) end ---@class ConformOpts - return { + local opts = { -- LazyVim will use these options when formatting with the conform.nvim formatter format = { - timeout_ms = 1000, + timeout_ms = 3000, + async = false, -- not recommended to change + quiet = false, -- not recommended to change }, + ---@type table formatters_by_ft = { lua = { "stylua" }, fish = { "fish_indent" }, @@ -94,7 +99,7 @@ return { }, -- LazyVim will merge the options you set here with builtin formatters. -- You can also define any custom formatters here. - ---@type table + ---@type table formatters = { injected = { options = { ignore_errors = true } }, -- # Example of using dprint only when a dprint.json file is present @@ -110,6 +115,7 @@ return { -- }, }, } + return opts end, config = M.setup, }, From 152e1c6692566a2e2a3968fbfc6eca69d33ba02c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 08:36:27 +0200 Subject: [PATCH 444/513] feat(markdown): added headlines.nvim to markdown extra --- lua/lazyvim/plugins/extras/lang/markdown.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index f57954f1a1..3fc9c0f1b6 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -61,4 +61,19 @@ return { vim.cmd([[do FileType]]) end, }, + + { + "lukas-reineke/headlines.nvim", + opts = function() + local opts = {} + for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do + opts[ft] = { headline_highlights = {} } + for i = 1, 6 do + table.insert(opts[ft].headline_highlights, "Headline" .. i) + end + end + return opts + end, + ft = { "markdown", "norg", "rmd", "org" }, + }, } From 9517e64009a1a547f5e5b96a8fc78bf5ea0bbb6e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 08:35:35 +0200 Subject: [PATCH 445/513] fix(root): root dir for windows. Fixes #1749 --- lua/lazyvim/util/lualine.lua | 4 ++-- lua/lazyvim/util/root.lua | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 1ec2cd1963..3e3cdb9a58 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -75,7 +75,7 @@ function M.pretty_path(opts) if path == "" then return "" end - local root = Util.root.get() + local root = Util.root.get({ normalize = true }) local cwd = Util.root.cwd() if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then @@ -111,7 +111,7 @@ function M.root_dir(opts) local function get() local cwd = Util.root.cwd() - local root = Util.root.get() + local root = Util.root.get({ normalize = true }) local name = vim.fs.basename(root) if root == cwd then diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 519546e142..a6deb240b3 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -141,10 +141,16 @@ end -- * lsp root_dir -- * root pattern of filename of the current buffer -- * root pattern of cwd +---@param opts {normalize?:boolean} ---@return string -function M.get() +function M.get(opts) + opts = opts or {} local roots = M.detect({ all = false }) - return roots[1] and roots[1].paths[1] or vim.loop.cwd() + local ret = roots[1] and roots[1].paths[1] or vim.loop.cwd() + if opts.normalize then + return ret + end + return Util.is_win() and ret:gsub("/", "\\") or ret end ---@param opts? {hl_last?: string} From f513e1cedef94d7e464a1c45cc0a6bf8e452dc43 Mon Sep 17 00:00:00 2001 From: ueaner Date: Mon, 16 Oct 2023 16:41:54 +0800 Subject: [PATCH 446/513] ci: LazyVim now requires Neovim >= 0.9.0 (#1751) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ffff686fe..51c475534e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: uses: kdheepak/panvimdoc@main with: vimdoc: LazyVim - version: "Neovim >= 0.8.0" + version: "Neovim >= 0.9.0" demojify: true treesitter: true - name: Push changes From db175ef3f6886675691b53e6a30aecee9ca73d22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Oct 2023 08:42:32 +0000 Subject: [PATCH 447/513] 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 82cf4b6a5a..19a7948ee3 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 16 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 16 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 98db7ec0d287adcd8eaf6a93c4a392f588b5615a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 12:42:54 +0200 Subject: [PATCH 448/513] perf(root): cache root detection. Fixes #1753 --- lua/lazyvim/config/init.lua | 5 +---- lua/lazyvim/util/root.lua | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 3b8092c77e..fd9ffcd2ab 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -180,10 +180,7 @@ function M.setup(opts) Util.format.setup() Util.news.setup() - - vim.api.nvim_create_user_command("LazyRoot", function() - Util.root.info() - end, { desc = "LazyVim roots for the current buffer" }) + Util.root.setup() vim.api.nvim_create_user_command("LazyExtras", function() Util.extras.show() diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index a6deb240b3..2958197570 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -136,18 +136,38 @@ function M.info() return roots[1] and roots[1].paths[1] or vim.loop.cwd() end +---@type table +M.cache = {} + +function M.setup() + vim.api.nvim_create_user_command("LazyRoot", function() + Util.root.info() + end, { desc = "LazyVim roots for the current buffer" }) + + vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost" }, { + group = vim.api.nvim_create_augroup("lazyvim_root_cache", { clear = true }), + callback = function(event) + M.cache[event.buf] = nil + end, + }) +end + -- returns the root directory based on: -- * lsp workspace folders -- * lsp root_dir -- * root pattern of filename of the current buffer -- * root pattern of cwd ----@param opts {normalize?:boolean} +---@param opts? {normalize?:boolean} ---@return string function M.get(opts) - opts = opts or {} - local roots = M.detect({ all = false }) - local ret = roots[1] and roots[1].paths[1] or vim.loop.cwd() - if opts.normalize then + local buf = vim.api.nvim_get_current_buf() + local ret = M.cache[buf] + if not ret then + local roots = M.detect({ all = false }) + ret = roots[1] and roots[1].paths[1] or vim.loop.cwd() + M.cache[buf] = ret + end + if opts and opts.normalize then return ret end return Util.is_win() and ret:gsub("/", "\\") or ret From 3dbeda9d96a2225875c4991116cb834f20588ddb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 12:44:41 +0200 Subject: [PATCH 449/513] fix(markdown): add marksman to mason install --- lua/lazyvim/plugins/extras/lang/markdown.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index 3fc9c0f1b6..ecb9b0a68d 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -11,7 +11,7 @@ return { "williamboman/mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "markdownlint" }) + vim.list_extend(opts.ensure_installed, { "markdownlint", "marksman" }) end, }, { From 5926cda069e266534ad13da74053d7588cdbf8db Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:37:38 +0200 Subject: [PATCH 450/513] chore(main): release 10.4.0 (#1747) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 22 ++++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c3bd7865..1ac7838416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [10.4.0](https://github.com/LazyVim/LazyVim/compare/v10.3.0...v10.4.0) (2023-10-16) + + +### Features + +* **keymaps:** added toggle for treesitter highlights ([be5eea4](https://github.com/LazyVim/LazyVim/commit/be5eea476c98d46aefbbaee04b7f2bc82bb51c27)) +* **lualine:** use gitsigns for diff source ([#1744](https://github.com/LazyVim/LazyVim/issues/1744)) ([8c726cd](https://github.com/LazyVim/LazyVim/commit/8c726cd16638f51308f479f26143d94a6c3013ea)) +* **markdown:** added headlines.nvim to markdown extra ([152e1c6](https://github.com/LazyVim/LazyVim/commit/152e1c6692566a2e2a3968fbfc6eca69d33ba02c)) +* **ui:** add keymap to close other buffers ([#1743](https://github.com/LazyVim/LazyVim/issues/1743)) ([c3daced](https://github.com/LazyVim/LazyVim/commit/c3daced11ce33875059ad5dd74832bf4a232f195)) + + +### Bug Fixes + +* **conform:** remove LazyVim's conform config changes since that's now merged in conform ([982c8e3](https://github.com/LazyVim/LazyVim/commit/982c8e301bb432f44a85d915a8268442c7db05fa)) +* **markdown:** add marksman to mason install ([3dbeda9](https://github.com/LazyVim/LazyVim/commit/3dbeda9d96a2225875c4991116cb834f20588ddb)) +* **root:** root dir for windows. Fixes [#1749](https://github.com/LazyVim/LazyVim/issues/1749) ([9517e64](https://github.com/LazyVim/LazyVim/commit/9517e64009a1a547f5e5b96a8fc78bf5ea0bbb6e)) + + +### Performance Improvements + +* **root:** cache root detection. Fixes [#1753](https://github.com/LazyVim/LazyVim/issues/1753) ([98db7ec](https://github.com/LazyVim/LazyVim/commit/98db7ec0d287adcd8eaf6a93c4a392f588b5615a)) + ## [10.3.0](https://github.com/LazyVim/LazyVim/compare/v10.2.0...v10.3.0) (2023-10-15) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index fd9ffcd2ab..7f491c9168 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.3.0" -- x-release-please-version +M.version = "10.4.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From fef0b3f7564e64f92df129cd86bc904afc19b976 Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Mon, 16 Oct 2023 09:19:52 -0600 Subject: [PATCH 451/513] fix(ui): fix BufferLineClose commands (#1756) BufferLine has capital letter l --- lua/lazyvim/plugins/ui.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 69b46309d8..5eaeb4a0db 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -61,9 +61,9 @@ return { keys = { { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, - { "bo", "BufferlineCloseOthers", desc = "Delete other buffers" }, - { "br", "BufferlineCloseRight", desc = "Delete buffers to the right" }, - { "bl", "BufferlineCloseLeft", desc = "Delete buffers to the left" }, + { "bo", "BufferLineCloseOthers", desc = "Delete other buffers" }, + { "br", "BufferLineCloseRight", desc = "Delete buffers to the right" }, + { "bl", "BufferLineCloseLeft", desc = "Delete buffers to the left" }, { "", "BufferLineCyclePrev", desc = "Prev buffer" }, { "", "BufferLineCycleNext", desc = "Next buffer" }, { "[b", "BufferLineCyclePrev", desc = "Prev buffer" }, From ff64cc53992b966a2558e95afc449e1da29dd44d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 16 Oct 2023 23:01:18 +0200 Subject: [PATCH 452/513] fix(format): set formatexpr in options so users can override it. Fixes #1759 --- lua/lazyvim/config/options.lua | 2 ++ lua/lazyvim/plugins/formatting.lua | 1 - lua/lazyvim/util/format.lua | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 5a071a15c9..d1605f93ed 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -87,5 +87,7 @@ else vim.opt.foldmethod = "indent" end +vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" + -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 28c794fccb..66edd1bb17 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -50,7 +50,6 @@ return { }, }, init = function() - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" -- Install the conform formatter on VeryLazy require("lazyvim.util").on_very_lazy(function() require("lazyvim.util").format.register({ diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua index 2a5ef5ac08..fa9722966c 100644 --- a/lua/lazyvim/util/format.lua +++ b/lua/lazyvim/util/format.lua @@ -25,6 +25,13 @@ function M.register(formatter) end) end +function M.formatexpr() + if Util.has("conform.nvim") then + return require("conform").formatexpr() + end + return vim.lsp.formatexpr({ timeout_ms = 3000 }) +end + ---@param buf? number ---@return (LazyFormatter|{active:boolean,resolved:string[]})[] function M.resolve(buf) @@ -67,7 +74,7 @@ function M.info(buf) end end if not have then - lines[#lines+1] = "\n***No formatters available for this buffer.***" + lines[#lines + 1] = "\n***No formatters available for this buffer.***" end Util[enabled and "info" or "warn"]( table.concat(lines, "\n"), From 42ba1af40fd799f3cd04d4703c6f1a5cc0e349c7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 23:09:17 +0200 Subject: [PATCH 453/513] chore(main): release 10.4.1 (#1757) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac7838416..486131ac48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [10.4.1](https://github.com/LazyVim/LazyVim/compare/v10.4.0...v10.4.1) (2023-10-16) + + +### Bug Fixes + +* **format:** set formatexpr in options so users can override it. Fixes [#1759](https://github.com/LazyVim/LazyVim/issues/1759) ([ff64cc5](https://github.com/LazyVim/LazyVim/commit/ff64cc53992b966a2558e95afc449e1da29dd44d)) +* **ui:** fix BufferLineClose commands ([#1756](https://github.com/LazyVim/LazyVim/issues/1756)) ([fef0b3f](https://github.com/LazyVim/LazyVim/commit/fef0b3f7564e64f92df129cd86bc904afc19b976)) + ## [10.4.0](https://github.com/LazyVim/LazyVim/compare/v10.3.0...v10.4.0) (2023-10-16) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 7f491c9168..0e611fd957 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.4.0" -- x-release-please-version +M.version = "10.4.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 315df373f2d0c354b08acd607f6227b07436ce03 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 17 Oct 2023 08:28:12 +0200 Subject: [PATCH 454/513] fix(statuscolumn): correct line numbers & respect more options --- lua/lazyvim/util/ui.lua | 66 +++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 6c5a3c1f1f..c17a1e7b95 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -86,42 +86,50 @@ end function M.statuscolumn() local win = vim.g.statusline_winid - if vim.wo[win].signcolumn == "no" then - return "" - end local buf = vim.api.nvim_win_get_buf(win) - - ---@type Sign?,Sign?,Sign? - local left, right, fold - for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do - if s.name and s.name:find("GitSign") then - right = s - else - left = s + local is_file = vim.bo[buf].buftype == "" + local show_signs = vim.wo[win].signcolumn ~= "no" + + local components = { "", "", "" } -- left, middle, right + + if show_signs then + ---@type Sign?,Sign?,Sign? + local left, right, fold + for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do + if s.name and s.name:find("GitSign") then + right = s + else + left = s + end end + if vim.v.virtnum ~= 0 then + left = nil + end + vim.api.nvim_win_call(win, function() + if vim.fn.foldclosed(vim.v.lnum) >= 0 then + fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } + end + end) + -- Left: mark or non-git sign + components[1] = M.icon(M.get_mark(buf, vim.v.lnum) or left) + -- Right: fold icon or git sign (only if file) + components[3] = is_file and M.icon(fold or right) or "" end - if vim.v.virtnum ~= 0 then - left = nil - end - - vim.api.nvim_win_call(win, function() - if vim.fn.foldclosed(vim.v.lnum) >= 0 then - fold = { text = vim.opt.fillchars:get().foldclose or "", texthl = "Folded" } + -- Numbers in Neovim are weird + -- They show when either number or relativenumber is true + local is_num = vim.wo[win].number + local is_relnum = vim.wo[win].relativenumber + if (is_num or is_relnum) and vim.v.virtnum == 0 then + if vim.v.relnum == 0 then + components[2] = is_num and "%l" or "%r" -- the current line + else + components[2] = is_relnum and "%r" or "%l" -- other lines end - end) - - local nu = "" - if vim.wo[win].number and vim.v.virtnum == 0 then - nu = vim.wo[win].relativenumber and vim.v.relnum ~= 0 and vim.v.relnum or vim.v.lnum + components[2] = "%=" .. components[2] .. " " -- right align end - return table.concat({ - M.icon(M.get_mark(buf, vim.v.lnum) or left), - [[%=]], - nu .. " ", - M.icon(fold or right), - }, "") + return table.concat(components, "") end function M.fg(name) From 4da4583b4a0b72569c45208cb0f09f072b6435e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Oct 2023 06:29:04 +0000 Subject: [PATCH 455/513] 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 19a7948ee3..5d0601e1c2 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 16 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 17 ============================================================================== Table of Contents *LazyVim-table-of-contents* From af3ca06472ea60091fb8baba0ffd37b54566501d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 17 Oct 2023 08:42:17 +0200 Subject: [PATCH 456/513] docs: fixed conform examples --- lua/lazyvim/plugins/formatting.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 66edd1bb17..6d8c9bc722 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -96,7 +96,7 @@ return { fish = { "fish_indent" }, sh = { "shfmt" }, }, - -- LazyVim will merge the options you set here with builtin formatters. + -- The options you set here will be merged with the builtin formatters. -- You can also define any custom formatters here. ---@type table formatters = { @@ -110,7 +110,7 @@ return { -- -- # Example of using shfmt with extra args -- shfmt = { - -- extra_args = { "-i", "2", "-ci" }, + -- prepend_args = { "-i", "2", "-ci" }, -- }, }, } From c711309a673a755652a90a080fd23dbab5dd61d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:04:24 +0200 Subject: [PATCH 457/513] chore(main): release 10.4.2 (#1765) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 486131ac48..f70e72c714 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [10.4.2](https://github.com/LazyVim/LazyVim/compare/v10.4.1...v10.4.2) (2023-10-17) + + +### Bug Fixes + +* **statuscolumn:** correct line numbers & respect more options ([315df37](https://github.com/LazyVim/LazyVim/commit/315df373f2d0c354b08acd607f6227b07436ce03)) + ## [10.4.1](https://github.com/LazyVim/LazyVim/compare/v10.4.0...v10.4.1) (2023-10-16) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 0e611fd957..056ab274e4 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.4.1" -- x-release-please-version +M.version = "10.4.2" -- x-release-please-version ---@class LazyVimOptions local defaults = { From b0ded5c015a68f07a32fab64a2cd0f27f4d69870 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 17 Oct 2023 16:33:55 +0200 Subject: [PATCH 458/513] fix(dot): treesitter langs in dot extra were not added --- lua/lazyvim/plugins/extras/util/dot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index 2424589dd9..c25e0f6c30 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -37,7 +37,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) local function add(lang) - if type(opts.ensure_installed) ~= "table" then + if type(opts.ensure_installed) == "table" then table.insert(opts.ensure_installed, lang) end end From 1d4fbd3b2e48eaae448073af020ca2617ab7bd5c Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 18 Oct 2023 00:03:34 +0800 Subject: [PATCH 459/513] fix(keymaps): let keymap n and N opens folds (#1298) It's strange that mappings to n and N do not open folds like its original behavior, so I append `zv` to manually open folds. --- lua/lazyvim/config/keymaps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 4b36d0abec..d7a480cbf2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -50,10 +50,10 @@ map( ) -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n -map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) From 5c1656729aeb39fbb8dc29d4f3d6d86d0836f8b4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 17 Oct 2023 18:28:06 +0200 Subject: [PATCH 460/513] fix(dashboard): config shortcut when opening dashboard again. Fixes #1768 --- lua/lazyvim/plugins/ui.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 5eaeb4a0db..d0d24533b4 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -371,15 +371,15 @@ return { header = vim.split(logo, "\n"), -- stylua: ignore center = { - { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, - { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, - { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, - { action = Util.telescope.config_files(), desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = "qa", desc = " Quit", icon = " ", key = "q" }, + { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" }, + { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, }, footer = function() local stats = require("lazy").stats() From 2e308d5440c830bb37531d03a0313af3a5c94bb5 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 18 Oct 2023 00:04:28 +0200 Subject: [PATCH 461/513] fix(neotest): better integration with trouble: no longer steals focus and hides when all ok --- lua/lazyvim/plugins/extras/test/core.lua | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index d22e52059f..321955abd1 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -27,7 +27,7 @@ return { quickfix = { open = function() if require("lazyvim.util").has("trouble.nvim") then - vim.cmd("Trouble quickfix") + require("trouble").open({ mode = "quickfix", focus = false }) else vim.cmd("copen") end @@ -46,6 +46,37 @@ return { }, }, neotest_ns) + if require("lazyvim.util").has("trouble.nvim") then + opts.consumers = opts.consumers or {} + -- Refresh and auto close trouble after running tests + ---@type neotest.Consumer + opts.consumers.trouble = function(client) + client.listeners.results = function(adapter_id, results, partial) + if partial then + return + end + local tree = assert(client:get_position(nil, { adapter = adapter_id })) + + local failed = 0 + for pos_id, result in pairs(results) do + if result.status == "failed" and tree:get_key(pos_id) then + failed = failed + 1 + end + end + vim.schedule(function() + local trouble = require("trouble") + if trouble.is_open() then + trouble.refresh() + if failed == 0 then + trouble.close() + end + end + end) + return {} + end + end + end + if opts.adapters then local adapters = {} for name, config in pairs(opts.adapters or {}) do From 0e12b007433d910adc1081f267f3894f887942e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 00:06:46 +0200 Subject: [PATCH 462/513] chore(main): release 10.4.3 (#1771) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 10 ++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f70e72c714..ba2d6af445 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [10.4.3](https://github.com/LazyVim/LazyVim/compare/v10.4.2...v10.4.3) (2023-10-17) + + +### Bug Fixes + +* **dashboard:** config shortcut when opening dashboard again. Fixes [#1768](https://github.com/LazyVim/LazyVim/issues/1768) ([5c16567](https://github.com/LazyVim/LazyVim/commit/5c1656729aeb39fbb8dc29d4f3d6d86d0836f8b4)) +* **dot:** treesitter langs in dot extra were not added ([b0ded5c](https://github.com/LazyVim/LazyVim/commit/b0ded5c015a68f07a32fab64a2cd0f27f4d69870)) +* **keymaps:** let keymap n and N opens folds ([#1298](https://github.com/LazyVim/LazyVim/issues/1298)) ([1d4fbd3](https://github.com/LazyVim/LazyVim/commit/1d4fbd3b2e48eaae448073af020ca2617ab7bd5c)) +* **neotest:** better integration with trouble: no longer steals focus and hides when all ok ([2e308d5](https://github.com/LazyVim/LazyVim/commit/2e308d5440c830bb37531d03a0313af3a5c94bb5)) + ## [10.4.2](https://github.com/LazyVim/LazyVim/compare/v10.4.1...v10.4.2) (2023-10-17) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 056ab274e4..2b4ff20e61 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.4.2" -- x-release-please-version +M.version = "10.4.3" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 7d8b3e8ef96f91f96c8e3a0ba62dfab270debf9f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 18 Oct 2023 11:38:54 +0200 Subject: [PATCH 463/513] fix(project): don't let `project.nvim` change the cwd. Leads to too much confusion --- lua/lazyvim/plugins/extras/util/project.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 8164d19f6d..e05f75fbbd 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -5,7 +5,9 @@ return { -- project management { "ahmedkhalf/project.nvim", - opts = {}, + opts = { + manual_mode = true, + }, event = "VeryLazy", config = function(_, opts) require("project_nvim").setup(opts) From 5c8cefaf40ea21fe5e954fd241ca1821733111b3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Oct 2023 09:39:39 +0000 Subject: [PATCH 464/513] 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 5d0601e1c2..ea17820b6a 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 17 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 18 ============================================================================== Table of Contents *LazyVim-table-of-contents* From ae77bfda89067c36291365c0e2b4d4db7bbc3aac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:11:54 +0200 Subject: [PATCH 465/513] chore(main): release 10.4.4 (#1786) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba2d6af445..4b16dd17e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [10.4.4](https://github.com/LazyVim/LazyVim/compare/v10.4.3...v10.4.4) (2023-10-18) + + +### Bug Fixes + +* **project:** don't let `project.nvim` change the cwd. Leads to too much confusion ([7d8b3e8](https://github.com/LazyVim/LazyVim/commit/7d8b3e8ef96f91f96c8e3a0ba62dfab270debf9f)) + ## [10.4.3](https://github.com/LazyVim/LazyVim/compare/v10.4.2...v10.4.3) (2023-10-17) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 2b4ff20e61..b99f473cb7 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.4.3" -- x-release-please-version +M.version = "10.4.4" -- x-release-please-version ---@class LazyVimOptions local defaults = { From d73aee4a934b0aa12e07039da9e2df0215ba2cba Mon Sep 17 00:00:00 2001 From: Jorge Villalobos Date: Thu, 19 Oct 2023 01:45:03 -0400 Subject: [PATCH 466/513] feat(dashboard): remove unnecessary brackets from keys (#1791) --- 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 d0d24533b4..2f97c37495 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -391,6 +391,7 @@ return { for _, button in ipairs(opts.config.center) do button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" end -- close Lazy and re-open when the dashboard is ready From b8c7e70c80ee9689a45b19c3c58020e69c9fef8a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Oct 2023 05:45:44 +0000 Subject: [PATCH 467/513] 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 ea17820b6a..b1e64e7373 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 18 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 19 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 0ac8f6fb3b1705c2b675a0e3cbee4968370f047a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Oct 2023 07:45:46 +0200 Subject: [PATCH 468/513] fix(treesitter-context): set default max_lines=3 --- lua/lazyvim/plugins/treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 1b4debcf43..c8ba7f4834 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -109,7 +109,7 @@ return { "nvim-treesitter/nvim-treesitter-context", event = "LazyFile", enabled = true, - opts = { mode = "cursor" }, + opts = { mode = "cursor", max_lines = 3 }, keys = { { "ut", From 98b51a608cf89fca43e9d026d21b75d251e17167 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Oct 2023 07:47:37 +0200 Subject: [PATCH 469/513] style(dashboard): make layout exactly the same as before --- 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 2f97c37495..8857739564 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -391,7 +391,7 @@ return { for _, button in ipairs(opts.config.center) do button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - button.key_format = " %s" + button.key_format = " %s" end -- close Lazy and re-open when the dashboard is ready From ea3155aef6d47e744cb2b4a7a3b567288d780f8d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Oct 2023 07:52:45 +0200 Subject: [PATCH 470/513] fix(conform): allow overriding all conform format options. Fixes #1790 --- lua/lazyvim/plugins/formatting.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 6d8c9bc722..eb2dd1a83f 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -2,9 +2,6 @@ local Util = require("lazyvim.util") local M = {} ----@type ConformOpts -local conform_opts = {} - ---@param opts ConformOpts function M.setup(_, opts) for name, formatter in pairs(opts.formatters or {}) do @@ -29,7 +26,6 @@ function M.setup(_, opts) opts[key] = nil end end - conform_opts = opts require("conform").setup(opts) end @@ -57,11 +53,10 @@ return { priority = 100, primary = true, format = function(buf) - require("conform").format(Util.merge({ - timeout_ms = conform_opts.format.timeout_ms, - async = conform_opts.format.async, - quiet = conform_opts.format.quiet, - }, { bufnr = buf })) + local plugin = require("lazy.core.config").plugins["conform.nvim"] + local Plugin = require("lazy.core.plugin") + local opts = Plugin.values(plugin, "opts", false) + require("conform").format(Util.merge(opts.format, { bufnr = buf })) end, sources = function(buf) local ret = require("conform").list_formatters(buf) From fad37772967f06c65d6f0b52c2ea6f190b3218ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Freitas?= Date: Thu, 19 Oct 2023 06:54:19 +0100 Subject: [PATCH 471/513] fix(tabnine): run `:CmpTabnineHub` automatically on build (#1788) --- lua/lazyvim/plugins/extras/coding/tabnine.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/coding/tabnine.lua index 696103cef3..aac8519e09 100644 --- a/lua/lazyvim/plugins/extras/coding/tabnine.lua +++ b/lua/lazyvim/plugins/extras/coding/tabnine.lua @@ -5,10 +5,12 @@ return { { "nvim-cmp", dependencies = { - -- Add TabNine support, make sure you run :CmpTabnineHub after installation. { "tzachar/cmp-tabnine", - build = Util.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", + build = { + Util.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", + ":CmpTabnineHub", + }, dependencies = "hrsh7th/nvim-cmp", opts = { max_lines = 1000, From 82da2440e4c9d7e604cf998aee0655f78ddfdd5c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 19 Oct 2023 19:54:34 +0200 Subject: [PATCH 472/513] fix(nvim-ts-autotag): make it actually work :) --- lua/lazyvim/plugins/treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index c8ba7f4834..3277ef838d 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -131,7 +131,7 @@ return { -- Automatically add closing tags for HTML and JSX { "windwp/nvim-ts-autotag", - event = "InsertEnter", + event = "LazyFile", opts = {}, }, } From 8df44b3bb54483e42a27dc30a8b343acc5d5d242 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Thu, 19 Oct 2023 14:12:48 -0400 Subject: [PATCH 473/513] feat(typescript): added remove unused imports (#1794) --- lua/lazyvim/plugins/extras/lang/typescript.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 4af1deec73..4f53ae8c80 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -32,6 +32,19 @@ return { end, desc = "Organize Imports", }, + { + "cR", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.removeUnused.ts" }, + diagnostics = {}, + }, + }) + end, + desc = "Remove Unused Imports", + }, }, settings = { typescript = { From e996eed750aabdfaa976357450f9ccbcd333a785 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:14:17 +0200 Subject: [PATCH 474/513] chore(main): release 10.5.0 (#1800) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b16dd17e2..85e623c7ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [10.5.0](https://github.com/LazyVim/LazyVim/compare/v10.4.4...v10.5.0) (2023-10-19) + + +### Features + +* **dashboard:** remove unnecessary brackets from keys ([#1791](https://github.com/LazyVim/LazyVim/issues/1791)) ([d73aee4](https://github.com/LazyVim/LazyVim/commit/d73aee4a934b0aa12e07039da9e2df0215ba2cba)) + + +### Bug Fixes + +* **conform:** allow overriding all conform format options. Fixes [#1790](https://github.com/LazyVim/LazyVim/issues/1790) ([ea3155a](https://github.com/LazyVim/LazyVim/commit/ea3155aef6d47e744cb2b4a7a3b567288d780f8d)) +* **nvim-ts-autotag:** make it actually work :) ([82da244](https://github.com/LazyVim/LazyVim/commit/82da2440e4c9d7e604cf998aee0655f78ddfdd5c)) +* **tabnine:** run `:CmpTabnineHub` automatically on build ([#1788](https://github.com/LazyVim/LazyVim/issues/1788)) ([fad3777](https://github.com/LazyVim/LazyVim/commit/fad37772967f06c65d6f0b52c2ea6f190b3218ee)) +* **treesitter-context:** set default max_lines=3 ([0ac8f6f](https://github.com/LazyVim/LazyVim/commit/0ac8f6fb3b1705c2b675a0e3cbee4968370f047a)) + ## [10.4.4](https://github.com/LazyVim/LazyVim/compare/v10.4.3...v10.4.4) (2023-10-18) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index b99f473cb7..09e6c6e0ab 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.4.4" -- x-release-please-version +M.version = "10.5.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 0bb628053beec25efbc5bd1e8600ef039fa75a20 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:16:16 +0200 Subject: [PATCH 475/513] chore(main): release 10.5.0 (#1808) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e623c7ca..4dd289f34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ ## [10.5.0](https://github.com/LazyVim/LazyVim/compare/v10.4.4...v10.5.0) (2023-10-19) +### Features + +* **dashboard:** remove unnecessary brackets from keys ([#1791](https://github.com/LazyVim/LazyVim/issues/1791)) ([d73aee4](https://github.com/LazyVim/LazyVim/commit/d73aee4a934b0aa12e07039da9e2df0215ba2cba)) +* **typescript:** added remove unused imports ([#1794](https://github.com/LazyVim/LazyVim/issues/1794)) ([8df44b3](https://github.com/LazyVim/LazyVim/commit/8df44b3bb54483e42a27dc30a8b343acc5d5d242)) + + +### Bug Fixes + +* **conform:** allow overriding all conform format options. Fixes [#1790](https://github.com/LazyVim/LazyVim/issues/1790) ([ea3155a](https://github.com/LazyVim/LazyVim/commit/ea3155aef6d47e744cb2b4a7a3b567288d780f8d)) +* **nvim-ts-autotag:** make it actually work :) ([82da244](https://github.com/LazyVim/LazyVim/commit/82da2440e4c9d7e604cf998aee0655f78ddfdd5c)) +* **tabnine:** run `:CmpTabnineHub` automatically on build ([#1788](https://github.com/LazyVim/LazyVim/issues/1788)) ([fad3777](https://github.com/LazyVim/LazyVim/commit/fad37772967f06c65d6f0b52c2ea6f190b3218ee)) +* **treesitter-context:** set default max_lines=3 ([0ac8f6f](https://github.com/LazyVim/LazyVim/commit/0ac8f6fb3b1705c2b675a0e3cbee4968370f047a)) + +## [10.5.0](https://github.com/LazyVim/LazyVim/compare/v10.4.4...v10.5.0) (2023-10-19) + + ### Features * **dashboard:** remove unnecessary brackets from keys ([#1791](https://github.com/LazyVim/LazyVim/issues/1791)) ([d73aee4](https://github.com/LazyVim/LazyVim/commit/d73aee4a934b0aa12e07039da9e2df0215ba2cba)) From 786a061eaa2b994fcd13e5dd31ea0e73a9d76069 Mon Sep 17 00:00:00 2001 From: abeldekat <58370433+abeldekat@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:27:10 +0000 Subject: [PATCH 476/513] style(dashboard): remove unnecessary brackets from keys, including extras (#1809) * style(dashboard): remove unnecessary brackets from keys, including the p key from the project extras * review Folke --------- Co-authored-by: abeldekat --- lua/lazyvim/plugins/extras/util/project.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index e05f75fbbd..3936c96a2f 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -56,6 +56,10 @@ return { icon = " ", key = "p", } + + projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) + projects.key_format = " %s" + table.insert(opts.config.center, 3, projects) end, }, From fa3170d422f3c661d0411472c96f92e5324dc281 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 20 Oct 2023 11:27:50 +0000 Subject: [PATCH 477/513] 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 b1e64e7373..eb17873350 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 19 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 20 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e55ab411b42c75919b33b87e19714b5c595316d4 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sun, 22 Oct 2023 15:44:08 +0300 Subject: [PATCH 478/513] fix(mini.hipatterns): use `extmark_opts` instead of soft deprecated `priority` (#1841) --- lua/lazyvim/plugins/extras/util/mini-hipatterns.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua index 43b8c49dfa..2add9c2f2c 100644 --- a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua +++ b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua @@ -67,7 +67,7 @@ M.plugin = { return hl end end, - priority = 2000, + extmark_opts = { priority = 2000 }, } end require("mini.hipatterns").setup(opts) From e7130c8250c403140ce504bde9e973d5a301ab4c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Oct 2023 12:44:41 +0000 Subject: [PATCH 479/513] 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 eb17873350..d3e0227b0b 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 20 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 22 ============================================================================== Table of Contents *LazyVim-table-of-contents* From ef5ec9a3bf6b03d9e81cc5252ec685bbbb0cdbed Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 22 Oct 2023 21:44:43 +0200 Subject: [PATCH 480/513] style: added trouble ft for the next gen trouble --- lua/lazyvim/plugins/colorscheme.lua | 1 + lua/lazyvim/plugins/editor.lua | 2 +- lua/lazyvim/plugins/extras/ui/edgy.lua | 8 +++++++- lua/lazyvim/plugins/ui.lua | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 8ed12bbd9a..2c28f1c406 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -21,6 +21,7 @@ return { illuminate = true, indent_blankline = { enabled = true }, lsp_trouble = true, + trouble = true, mason = true, mini = true, native_lsp = { diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 9ee3eb0354..67c45e5128 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -52,7 +52,7 @@ return { end, opts = { sources = { "filesystem", "buffers", "git_status", "document_symbols" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, filesystem = { bind_to_cwd = false, follow_current_file = { enabled = true }, diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 6cabd24d4b..e25138284b 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -40,6 +40,12 @@ return { end, }, "Trouble", + { + ft = "trouble", + filter = function(buf, win) + return vim.api.nvim_win_get_config(win).relative == "" + end, + }, { ft = "qf", title = "QuickFix" }, { ft = "help", @@ -129,7 +135,7 @@ return { optional = true, opts = function(_, opts) opts.open_files_do_not_replace_types = opts.open_files_do_not_replace_types - or { "terminal", "Trouble", "qf", "Outline" } + or { "terminal", "Trouble", "qf", "Outline", "trouble" } table.insert(opts.open_files_do_not_replace_types, "edgy") end, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 8857739564..5f8ece2093 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -228,6 +228,7 @@ return { "dashboard", "neo-tree", "Trouble", + "trouble", "lazy", "mason", "notify", @@ -259,11 +260,13 @@ return { "dashboard", "neo-tree", "Trouble", + "trouble", "lazy", "mason", "notify", "toggleterm", "lazyterm", + "trouble", }, callback = function() vim.b.miniindentscope_disable = true From 99598ef7c7c15c980b6d5c36f8e9cefd745fcf34 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 12:35:22 +0200 Subject: [PATCH 481/513] feat(telescope): sort buffers with lastused and mru --- lua/lazyvim/plugins/editor.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 67c45e5128..8c34f3579c 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -127,12 +127,16 @@ return { }, }, keys = { - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { + ",", + "Telescope buffers sort_mru=true sort_lastused=true", + desc = "Switch Buffer", + }, { "/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { ":", "Telescope command_history", desc = "Command History" }, { "", Util.telescope("files"), desc = "Find Files (root dir)" }, -- find - { "fb", "Telescope buffers", desc = "Buffers" }, + { "fb", "Telescope buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, { "fc", Util.telescope.config_files(), desc = "Find Config File" }, { "ff", Util.telescope("files"), desc = "Find Files (root dir)" }, { "fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, From a5c9708736f6ecd3e3413ad0ca34b7b1fa3d4862 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 14:05:29 +0200 Subject: [PATCH 482/513] perf(ui): wrap treesitter.foldexpr and cache get_parser during a event loop tick. Fixes #1846 --- lua/lazyvim/config/options.lua | 2 +- lua/lazyvim/util/ui.lua | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index d1605f93ed..69e8e8d3f0 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -82,7 +82,7 @@ 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.vim.treesitter.foldexpr()" + vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" else vim.opt.foldmethod = "indent" end diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index c17a1e7b95..68999eda55 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -141,4 +141,42 @@ function M.fg(name) return fg and { fg = string.format("#%06x", fg) } or nil end +M.skip_foldexpr = {} ---@type table +local skip_check = assert(vim.loop.new_check()) + +function M.foldexpr() + local buf = vim.api.nvim_get_current_buf() + + -- still in the same tick and no parser + if M.skip_foldexpr[buf] then + return "0" + end + + -- don't use treesitter folds for non-file buffers + if vim.bo[buf].buftype ~= "" then + return "0" + end + + -- as long as we don't have a filetype, don't bother + -- checking if treesitter is available (it won't) + if vim.bo[buf].filetype == "" then + return "0" + end + + local ok = pcall(vim.treesitter.get_parser, buf) + + if ok then + return vim.treesitter.foldexpr() + end + + -- no parser available, so mark it as skip + -- in the next tick, all skip marks will be reset + M.skip_foldexpr[buf] = true + skip_check:start(function() + M.skip_foldexpr = {} + skip_check:stop() + end) + return "0" +end + return M From c400cf0014d293d08414e1f98582b9baa9449b49 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Oct 2023 12:06:15 +0000 Subject: [PATCH 483/513] 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 d3e0227b0b..6982b959bd 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 22 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 25 ============================================================================== Table of Contents *LazyVim-table-of-contents* From eab464d52d28d4e24e5d189ee627c96e720e057c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 14:23:36 +0200 Subject: [PATCH 484/513] fix(markdown): create default numbered Headline groups for colorschemes that dont support them. Fixes #1822 --- lua/lazyvim/plugins/extras/lang/markdown.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index ecb9b0a68d..24e3b89143 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -67,9 +67,13 @@ return { opts = function() local opts = {} for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do - opts[ft] = { headline_highlights = {} } + opts[ft] = { + headline_highlights = {}, + } for i = 1, 6 do - table.insert(opts[ft].headline_highlights, "Headline" .. i) + local hl = "Headline" .. i + vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true }) + table.insert(opts[ft].headline_highlights, hl) end end return opts From 1e1b68d633d4bd4faa912ba5f49ab6b8601dc0c9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 15:40:25 +0200 Subject: [PATCH 485/513] fix(treesitter): make treesitter queries available at startup. See #1816 Fixes #1858 --- lua/lazyvim/plugins/treesitter.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 3277ef838d..e66725c061 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -7,6 +7,15 @@ return { version = false, -- last release is way too old and doesn't work on Windows build = ":TSUpdate", event = { "LazyFile", "VeryLazy" }, + 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 + -- no longer trigger the **nvim-treeitter** module to be loaded in time. + -- Luckily, the only thins that those plugins need are the custom queries, which we make available + -- during startup. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", From b651560ad0ee750c96bca6866cfdc008e75d397c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 15:40:57 +0200 Subject: [PATCH 486/513] perf(markdown): prevent headlines.nvim slowing down initial rendering with `nvim README.md` --- lua/lazyvim/plugins/extras/lang/markdown.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index 24e3b89143..5aa9dc331a 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -79,5 +79,12 @@ return { return opts end, ft = { "markdown", "norg", "rmd", "org" }, + config = function(_, opts) + -- PERF: schedule to prevent headlines slowing down opening a file + vim.schedule(function() + require("headlines").setup(opts) + require("headlines").refresh() + end) + end, }, } From 6dfeeb83228e7a7aa54972bd76f7cda099ccb35c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:44:48 +0200 Subject: [PATCH 487/513] chore(main): release 10.6.0 (#1842) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 20 ++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd289f34d..773890dbf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [10.6.0](https://github.com/LazyVim/LazyVim/compare/v10.5.0...v10.6.0) (2023-10-25) + + +### Features + +* **telescope:** sort buffers with lastused and mru ([99598ef](https://github.com/LazyVim/LazyVim/commit/99598ef7c7c15c980b6d5c36f8e9cefd745fcf34)) + + +### Bug Fixes + +* **markdown:** create default numbered Headline groups for colorschemes that dont support them. Fixes [#1822](https://github.com/LazyVim/LazyVim/issues/1822) ([eab464d](https://github.com/LazyVim/LazyVim/commit/eab464d52d28d4e24e5d189ee627c96e720e057c)) +* **mini.hipatterns:** use `extmark_opts` instead of soft deprecated `priority` ([#1841](https://github.com/LazyVim/LazyVim/issues/1841)) ([e55ab41](https://github.com/LazyVim/LazyVim/commit/e55ab411b42c75919b33b87e19714b5c595316d4)) +* **treesitter:** make treesitter queries available at startup. See [#1816](https://github.com/LazyVim/LazyVim/issues/1816) Fixes [#1858](https://github.com/LazyVim/LazyVim/issues/1858) ([1e1b68d](https://github.com/LazyVim/LazyVim/commit/1e1b68d633d4bd4faa912ba5f49ab6b8601dc0c9)) + + +### Performance Improvements + +* **markdown:** prevent headlines.nvim slowing down initial rendering with `nvim README.md` ([b651560](https://github.com/LazyVim/LazyVim/commit/b651560ad0ee750c96bca6866cfdc008e75d397c)) +* **ui:** wrap treesitter.foldexpr and cache get_parser during a event loop tick. Fixes [#1846](https://github.com/LazyVim/LazyVim/issues/1846) ([a5c9708](https://github.com/LazyVim/LazyVim/commit/a5c9708736f6ecd3e3413ad0ca34b7b1fa3d4862)) + ## [10.5.0](https://github.com/LazyVim/LazyVim/compare/v10.4.4...v10.5.0) (2023-10-19) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 09e6c6e0ab..4191a940f1 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.5.0" -- x-release-please-version +M.version = "10.6.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 61fae7d23f5689a9112b265f4bfb8468a131ae66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E9=9B=84=E9=95=95?= Date: Wed, 25 Oct 2023 21:46:39 +0800 Subject: [PATCH 488/513] fix: fix jdtls not spwaning in windows (#1864) --- lua/lazyvim/plugins/extras/lang/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 64808bee7c..f7e7ca5f7d 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -85,7 +85,7 @@ return { -- How to run jdtls. This can be overridden to a full java command-line -- if the Python wrapper script doesn't suffice. - cmd = { "jdtls" }, + cmd = { vim.fn.exepath("jdtls") }, full_cmd = function(opts) local fname = vim.api.nvim_buf_get_name(0) local root_dir = opts.root_dir(fname) From 37953585bb06b3ffbdb37b40bb586590fde2b2a9 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Wed, 25 Oct 2023 09:47:07 -0400 Subject: [PATCH 489/513] fix(extras.python-semshi): improve highlights (#1845) --- lua/lazyvim/plugins/extras/lang/python-semshi.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python-semshi.lua b/lua/lazyvim/plugins/extras/lang/python-semshi.lua index a9a4870ef6..e4e32c10e7 100644 --- a/lua/lazyvim/plugins/extras/lang/python-semshi.lua +++ b/lua/lazyvim/plugins/extras/lang/python-semshi.lua @@ -17,13 +17,14 @@ return { -- Only add style, inherit or link to the LSP's colors vim.cmd([[ highlight! semshiGlobal gui=italic - highlight! semshiImported gui=bold + highlight! link semshiImported @none highlight! link semshiParameter @lsp.type.parameter highlight! link semshiParameterUnused DiagnosticUnnecessary highlight! link semshiBuiltin @function.builtin - highlight! link semshiAttribute @attribute + highlight! link semshiAttribute @field highlight! link semshiSelf @lsp.type.selfKeyword highlight! link semshiUnresolved @lsp.type.unresolvedReference + highlight! link semshiFree @none ]]) end, }) From 9e1f83522396d141455de8f2d5e0b3e8beca8d0a Mon Sep 17 00:00:00 2001 From: Jorge Villalobos Date: Wed, 25 Oct 2023 09:48:45 -0400 Subject: [PATCH 490/513] feat(nvim): extend j/k enhancements to up/down arrows (#1833) --- lua/lazyvim/config/keymaps.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index d7a480cbf2..c5f70016f4 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -7,7 +7,9 @@ local map = Util.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 }) -- Move to window using the hjkl keys map("n", "", "h", { desc = "Go to left window", remap = true }) From 58ddf405e09da967eca29169571114b01172fff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E?= <42881610+konosubakonoakua@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:50:02 +0800 Subject: [PATCH 491/513] fix(lang): add cmakelint to ensure installed list (#1826) 1. mason/cmakelang install bin/cmake-lint 2. nvim-lint only recognize bin/cmakelint 3. mason/cmakelint install bin/cmakelint so we need mason/cmakelint installed to using nvim-lint to perform formatting --- lua/lazyvim/plugins/extras/lang/cmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 404a072a3a..e95dbfddfe 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -30,7 +30,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "cmakelang" }) + vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" }) end, }, { From 028f69c03c6014f06525eff0a44410bb3f479174 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:51:56 +0200 Subject: [PATCH 492/513] chore(main): release 10.7.0 (#1869) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 773890dbf4..c3dc6034d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [10.7.0](https://github.com/LazyVim/LazyVim/compare/v10.6.0...v10.7.0) (2023-10-25) + + +### Features + +* **nvim:** extend j/k enhancements to up/down arrows ([#1833](https://github.com/LazyVim/LazyVim/issues/1833)) ([9e1f835](https://github.com/LazyVim/LazyVim/commit/9e1f83522396d141455de8f2d5e0b3e8beca8d0a)) + + +### Bug Fixes + +* **extras.python-semshi:** improve highlights ([#1845](https://github.com/LazyVim/LazyVim/issues/1845)) ([3795358](https://github.com/LazyVim/LazyVim/commit/37953585bb06b3ffbdb37b40bb586590fde2b2a9)) +* fix jdtls not spwaning in windows ([#1864](https://github.com/LazyVim/LazyVim/issues/1864)) ([61fae7d](https://github.com/LazyVim/LazyVim/commit/61fae7d23f5689a9112b265f4bfb8468a131ae66)) +* **lang:** add cmakelint to ensure installed list ([#1826](https://github.com/LazyVim/LazyVim/issues/1826)) ([58ddf40](https://github.com/LazyVim/LazyVim/commit/58ddf405e09da967eca29169571114b01172fff3)) + ## [10.6.0](https://github.com/LazyVim/LazyVim/compare/v10.5.0...v10.6.0) (2023-10-25) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 4191a940f1..fc5487c5ff 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.6.0" -- x-release-please-version +M.version = "10.7.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 60e57070131f4c544e17541610415d4d51769d62 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 15:54:35 +0200 Subject: [PATCH 493/513] fix(util): pcall deletion of lazy_file augroup. See #1863 --- 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 9ff2c9865a..fdd76f1a74 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -80,7 +80,7 @@ function M.lazy_file() if #events == 0 then return end - vim.api.nvim_del_augroup_by_name("lazy_file") + pcall(vim.api.nvim_del_augroup_by_name, "lazy_file") ---@type table local skips = {} From f589154268dfcb3e8f91075791a0a618c97fe59d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 17:23:37 +0200 Subject: [PATCH 494/513] fix(catppuccin): trouble integration. Fixes #1872 --- lua/lazyvim/plugins/colorscheme.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 2c28f1c406..8ed12bbd9a 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -21,7 +21,6 @@ return { illuminate = true, indent_blankline = { enabled = true }, lsp_trouble = true, - trouble = true, mason = true, mini = true, native_lsp = { From 9a6b0f8928ad2e802cae36c6b05b94cd9a73451f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 17:52:35 +0200 Subject: [PATCH 495/513] chore(main): release 10.7.1 (#1870) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3dc6034d5..a6de0da521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [10.7.1](https://github.com/LazyVim/LazyVim/compare/v10.7.0...v10.7.1) (2023-10-25) + + +### Bug Fixes + +* **catppuccin:** trouble integration. Fixes [#1872](https://github.com/LazyVim/LazyVim/issues/1872) ([f589154](https://github.com/LazyVim/LazyVim/commit/f589154268dfcb3e8f91075791a0a618c97fe59d)) +* **util:** pcall deletion of lazy_file augroup. See [#1863](https://github.com/LazyVim/LazyVim/issues/1863) ([60e5707](https://github.com/LazyVim/LazyVim/commit/60e57070131f4c544e17541610415d4d51769d62)) + ## [10.7.0](https://github.com/LazyVim/LazyVim/compare/v10.6.0...v10.7.0) (2023-10-25) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index fc5487c5ff..12d49ed686 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.7.0" -- x-release-please-version +M.version = "10.7.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 09eafc60eff2ba7d7b78c1717d07ce26b762a8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Freitas?= Date: Wed, 25 Oct 2023 19:00:01 +0100 Subject: [PATCH 496/513] fix(mini.indentscope): remove duplicated filetype (#1871) --- lua/lazyvim/plugins/ui.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 5f8ece2093..50efb153f1 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -266,7 +266,6 @@ return { "notify", "toggleterm", "lazyterm", - "trouble", }, callback = function() vim.b.miniindentscope_disable = true From 4558407574d0cdbe55720ab349df201bd4d5f5de Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 26 Oct 2023 07:38:53 +0200 Subject: [PATCH 497/513] fix(plugin): LazyFile now properly deals with deleted buffers. Fixes #1877 --- lua/lazyvim/util/plugin.lua | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index fdd76f1a74..7ab691349a 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -76,11 +76,13 @@ function M.lazy_file() local events = {} ---@type {event: string, buf: number, data?: any}[] + local done = false local function load() - if #events == 0 then + if #events == 0 or done then return end - pcall(vim.api.nvim_del_augroup_by_name, "lazy_file") + done = true + vim.api.nvim_del_augroup_by_name("lazy_file") ---@type table local skips = {} @@ -90,17 +92,19 @@ function M.lazy_file() vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) for _, event in ipairs(events) do - Event.trigger({ - event = event.event, - exclude = skips[event.event], - data = event.data, - buf = event.buf, - }) - if vim.bo[event.buf].filetype then + if vim.api.nvim_buf_is_valid(event.buf) then Event.trigger({ - event = "FileType", + 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 }) From 7831fc94ca5989baf766c0bb6ad36a70838c3d5a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Oct 2023 05:39:38 +0000 Subject: [PATCH 498/513] 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 6982b959bd..181205b665 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 25 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 26 ============================================================================== Table of Contents *LazyVim-table-of-contents* From e01ad513aa4f50bdb385a7454c9e1ec3a0d5dc94 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 27 Oct 2023 18:34:33 +0200 Subject: [PATCH 499/513] fix(sessions): added folds to sessions --- lua/lazyvim/config/options.lua | 2 +- lua/lazyvim/plugins/util.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 69e8e8d3f0..3c9686b130 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -34,7 +34,7 @@ opt.pumblend = 10 -- Popup blend opt.pumheight = 10 -- Maximum number of entries in a popup opt.relativenumber = true -- Relative line numbers opt.scrolloff = 4 -- Lines of context -opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" } +opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } opt.shiftround = true -- Round indent opt.shiftwidth = 2 -- Size of an indent opt.shortmess:append({ W = true, I = true, c = true, C = true }) diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 7baa387e71..c387088902 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -15,7 +15,7 @@ return { { "folke/persistence.nvim", event = "BufReadPre", - opts = { options = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" } }, + opts = { options = vim.opt.sessionoptions:get() }, -- stylua: ignore keys = { { "qs", function() require("persistence").load() end, desc = "Restore Session" }, From 4b758c40c0846d7f699819352581e452d055243e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Oct 2023 16:35:14 +0000 Subject: [PATCH 500/513] 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 181205b665..03a1f372c4 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 26 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 27 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b32b4fd581018cf14bf30ae4cd8d94cd43552813 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 28 Oct 2023 16:38:43 +0200 Subject: [PATCH 501/513] fix(extras): dont show extras that give errors (user's extras). Fixes #1895 --- lua/lazyvim/util/extras.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 0417b81e77..4e2f0bc155 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -44,7 +44,10 @@ function M.get() Util.walk(root, function(path, name, type) if type == "file" and name:match("%.lua$") then name = path:sub(#root + 2, -5):gsub("/", ".") - extras[#extras + 1] = M.get_extra(source, source.module .. "." .. name) + local ok, extra = pcall(M.get_extra, source, source.module .. "." .. name) + if ok then + extras[#extras + 1] = extra + end end end) end From e5babf289c5ccd91bcd068bfc623335eb76cbc1f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Oct 2023 14:39:26 +0000 Subject: [PATCH 502/513] 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 03a1f372c4..bb2c94cd03 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 27 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 28 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 39861698235c03d30096b3fb315ce38eeaef95e2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 4 Nov 2023 10:14:31 +0100 Subject: [PATCH 503/513] fix(spectre): don't build nvim-spectre --- lua/lazyvim/plugins/editor.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 8c34f3579c..b5f529e599 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -98,6 +98,7 @@ return { -- search/replace in multiple files { "nvim-pack/nvim-spectre", + build = false, cmd = "Spectre", opts = { open_cmd = "noswapfile vnew" }, -- stylua: ignore From db31b4073bd18d7e2d8e09b2752d51da01fc7722 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Nov 2023 09:15:11 +0000 Subject: [PATCH 504/513] 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 bb2c94cd03..44ba75b1a3 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 28 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 04 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 4312e5e28348560e018da4535de27dfcc675c32b Mon Sep 17 00:00:00 2001 From: Jorge Villalobos Date: Sat, 4 Nov 2023 06:09:01 -0400 Subject: [PATCH 505/513] feat(catppuccin): enable more integrations (#1922) --- lua/lazyvim/plugins/colorscheme.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 8ed12bbd9a..bb63326e5a 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -14,14 +14,19 @@ return { name = "catppuccin", opts = { integrations = { + aerial = true, alpha = true, cmp = true, + dashboard = true, flash = true, gitsigns = true, + headlines = true, illuminate = true, indent_blankline = { enabled = true }, + leap = true, lsp_trouble = true, mason = true, + markdown = true, mini = true, native_lsp = { enabled = true, @@ -34,12 +39,13 @@ return { }, navic = { enabled = true, custom_bg = "lualine" }, neotest = true, + neotree = true, noice = true, notify = true, - neotree = true, semantic_tokens = true, telescope = true, treesitter = true, + treesitter_context = true, which_key = true, }, }, From 68ff818a5bb7549f90b05e412b76fe448f605ffb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:12:37 +0100 Subject: [PATCH 506/513] chore(main): release 10.8.0 (#1874) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 16 ++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6de0da521..ce168232d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [10.8.0](https://github.com/LazyVim/LazyVim/compare/v10.7.1...v10.8.0) (2023-11-04) + + +### Features + +* **catppuccin:** enable more integrations ([#1922](https://github.com/LazyVim/LazyVim/issues/1922)) ([4312e5e](https://github.com/LazyVim/LazyVim/commit/4312e5e28348560e018da4535de27dfcc675c32b)) + + +### Bug Fixes + +* **extras:** dont show extras that give errors (user's extras). Fixes [#1895](https://github.com/LazyVim/LazyVim/issues/1895) ([b32b4fd](https://github.com/LazyVim/LazyVim/commit/b32b4fd581018cf14bf30ae4cd8d94cd43552813)) +* **mini.indentscope:** remove duplicated filetype ([#1871](https://github.com/LazyVim/LazyVim/issues/1871)) ([09eafc6](https://github.com/LazyVim/LazyVim/commit/09eafc60eff2ba7d7b78c1717d07ce26b762a8a8)) +* **plugin:** LazyFile now properly deals with deleted buffers. Fixes [#1877](https://github.com/LazyVim/LazyVim/issues/1877) ([4558407](https://github.com/LazyVim/LazyVim/commit/4558407574d0cdbe55720ab349df201bd4d5f5de)) +* **sessions:** added folds to sessions ([e01ad51](https://github.com/LazyVim/LazyVim/commit/e01ad513aa4f50bdb385a7454c9e1ec3a0d5dc94)) +* **spectre:** don't build nvim-spectre ([3986169](https://github.com/LazyVim/LazyVim/commit/39861698235c03d30096b3fb315ce38eeaef95e2)) + ## [10.7.1](https://github.com/LazyVim/LazyVim/compare/v10.7.0...v10.7.1) (2023-10-25) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 12d49ed686..d84e26cd3d 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.7.1" -- x-release-please-version +M.version = "10.8.0" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 6853b785d9916be6ffe4965aefd8554ed276f802 Mon Sep 17 00:00:00 2001 From: Gary Murray Date: Thu, 30 Nov 2023 11:53:40 -0700 Subject: [PATCH 507/513] fix(lsp): detect if using nvim-0.10 and use new inlay_hint.enable method (#2007) * Detect if using nvim 0.10 and use new inlay_hint.enable method * Add lsp util for inlay-hints and update keymap * Remove the need to check vim version * Support older nightly builds * Move inlay_hint toggle in Util.toggle --------- Co-authored-by: Gary Murray --- lua/lazyvim/config/keymaps.lua | 4 ++-- lua/lazyvim/plugins/lsp/init.lua | 2 +- lua/lazyvim/util/toggle.lua | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c5f70016f4..f7fe57d6f9 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -119,8 +119,8 @@ map("n", "ul", function() Util.toggle.number() end, { desc = "Toggle Lin map("n", "ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" }) local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) -if vim.lsp.inlay_hint then - map("n", "uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" }) +if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then + map( "n", "uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) end map("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index f0823e467b..f454ac1cb0 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -115,7 +115,7 @@ return { vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end - local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint + local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint.enable if opts.inlay_hints.enabled and inlay_hint then Util.lsp.on_attach(function(client, buffer) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index b520070b74..51e8174444 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -53,6 +53,17 @@ function M.diagnostics() end end +---@param bufnr? number +function M.inlay_hints(bufnr) + bufnr = bufnr or 0 + local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint + if inlay_hint.enable then + vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled()) + else + vim.lsp.inlay_hint(bufnr, nil) + end +end + setmetatable(M, { __call = function(m, ...) return m.option(...) From 4ebda08d49edc2ce0f6a4841356fe6ed89427cc2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Nov 2023 18:54:19 +0000 Subject: [PATCH 508/513] 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 44ba75b1a3..2d805f3bc3 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 04 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 30 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 11a8a6bea7a26ca5257fa4cbef90e0abdb22c349 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 30 Nov 2023 20:10:41 +0100 Subject: [PATCH 509/513] fix(ui): signcolumn signs on nightly. Fixes #2039 --- lua/lazyvim/util/ui.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 68999eda55..ce8b4780d3 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -10,12 +10,19 @@ local M = {} function M.get_signs(buf, lnum) -- Get regular signs ---@type Sign[] - local signs = vim.tbl_map(function(sign) - ---@type Sign - local ret = vim.fn.sign_getdefined(sign.name)[1] - ret.priority = sign.priority - return ret - end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs) + local signs = {} + + if vim.fn.has("nvim-0.10") == 0 then + -- Only needed for Neovim <0.10 + -- Newer versions include legacy signs in nvim_buf_get_extmarks + for _, sign in ipairs(vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs) do + local ret = vim.fn.sign_getdefined(sign.name)[1] --[[@as Sign]] + if ret then + ret.priority = sign.priority + signs[#signs + 1] = ret + end + end + end -- Get extmark signs local extmarks = vim.api.nvim_buf_get_extmarks( From e229988a98a81b000fda3aadbb4fc404aeaa599e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 30 Nov 2023 20:16:33 +0100 Subject: [PATCH 510/513] fix(lsp): inlay hints on stable. See #2007 --- lua/lazyvim/plugins/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index f454ac1cb0..048de5b898 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -115,7 +115,7 @@ return { vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end - local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint.enable + local inlay_hint = vim.lsp.buf.inlay_hint or (vim.lsp.inlay_hint and vim.lsp.inlay_hint.enable) if opts.inlay_hints.enabled and inlay_hint then Util.lsp.on_attach(function(client, buffer) From 6ac331b588ab62f39c40a18c359d60e4dfba47ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 20:20:39 +0100 Subject: [PATCH 511/513] chore(main): release 10.8.1 (#2095) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 9 +++++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce168232d4..a3c33fe0d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [10.8.1](https://github.com/LazyVim/LazyVim/compare/v10.8.0...v10.8.1) (2023-11-30) + + +### Bug Fixes + +* **lsp:** detect if using nvim-0.10 and use new inlay_hint.enable method ([#2007](https://github.com/LazyVim/LazyVim/issues/2007)) ([6853b78](https://github.com/LazyVim/LazyVim/commit/6853b785d9916be6ffe4965aefd8554ed276f802)) +* **lsp:** inlay hints on stable. See [#2007](https://github.com/LazyVim/LazyVim/issues/2007) ([e229988](https://github.com/LazyVim/LazyVim/commit/e229988a98a81b000fda3aadbb4fc404aeaa599e)) +* **ui:** signcolumn signs on nightly. Fixes [#2039](https://github.com/LazyVim/LazyVim/issues/2039) ([11a8a6b](https://github.com/LazyVim/LazyVim/commit/11a8a6bea7a26ca5257fa4cbef90e0abdb22c349)) + ## [10.8.0](https://github.com/LazyVim/LazyVim/compare/v10.7.1...v10.8.0) (2023-11-04) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index d84e26cd3d..09b80d86fb 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.8.0" -- x-release-please-version +M.version = "10.8.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { From 8baf9b5459a903c783a1d34ad438e64036a8e15e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 30 Nov 2023 21:24:03 +0100 Subject: [PATCH 512/513] fix(lsp): fix inlay hints for older nightlies. See #2007 --- lua/lazyvim/plugins/lsp/init.lua | 6 ++---- lua/lazyvim/util/toggle.lua | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 048de5b898..3b60d14b63 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -115,12 +115,10 @@ return { vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end - local inlay_hint = vim.lsp.buf.inlay_hint or (vim.lsp.inlay_hint and vim.lsp.inlay_hint.enable) - - if opts.inlay_hints.enabled and inlay_hint then + if opts.inlay_hints.enabled then Util.lsp.on_attach(function(client, buffer) if client.supports_method("textDocument/inlayHint") then - inlay_hint(buffer, true) + Util.toggle.inlay_hints(buffer, true) end end) end diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index 51e8174444..db41c82515 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -53,14 +53,17 @@ function M.diagnostics() end end ----@param bufnr? number -function M.inlay_hints(bufnr) - bufnr = bufnr or 0 - local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint - if inlay_hint.enable then - vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled()) - else - vim.lsp.inlay_hint(bufnr, nil) +---@param buf? number +---@param value? boolean +function M.inlay_hints(buf, value) + local ih = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint + if type(ih) == "function" then + ih(buf, value) + elseif type(ih) == "table" and ih.enable then + if value == nil then + value = not ih.is_enabled(buf) + end + ih.enable(buf, value) end end From 879e29504d43e9f178d967ecc34d482f902e5a91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:27:02 +0100 Subject: [PATCH 513/513] chore(main): release 10.8.2 (#2097) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ lua/lazyvim/config/init.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c33fe0d3..318c543d42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [10.8.2](https://github.com/LazyVim/LazyVim/compare/v10.8.1...v10.8.2) (2023-11-30) + + +### Bug Fixes + +* **lsp:** fix inlay hints for older nightlies. See [#2007](https://github.com/LazyVim/LazyVim/issues/2007) ([8baf9b5](https://github.com/LazyVim/LazyVim/commit/8baf9b5459a903c783a1d34ad438e64036a8e15e)) + ## [10.8.1](https://github.com/LazyVim/LazyVim/compare/v10.8.0...v10.8.1) (2023-11-30) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 09b80d86fb..a296ef56ff 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.8.1" -- x-release-please-version +M.version = "10.8.2" -- x-release-please-version ---@class LazyVimOptions local defaults = {