From cccfe70ea4390c1915f67ab7d2893971fba3f3fa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 07:01:08 +0200 Subject: [PATCH 01/13] feat!: bump Neovim requirement to 0.11.2 --- NEWS.md | 6 +++--- README.md | 2 +- lua/lazyvim/health.lua | 6 +++--- lua/lazyvim/plugins/init.lua | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index 37221e79..1e5d991b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,13 +2,13 @@ ## 15.x -**Neovim** `>= 0.11.0` includes a lot of changes to the underlying LSP implementation. +**Neovim** `>= 0.11.2` includes a lot of changes to the underlying LSP implementation. -Going forward, **LazyVim** requires **Neovim** `>= 0.11.0`, and drops support for older versions. +Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support for older versions. ### Changes -- removed compatibility code for Neovim `< 0.11` +- removed compatibility code for Neovim `< 0.11.2` - updated all LSP code to use the new LSP implementation - migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` - added new `treesitter-main` extra to test the new `main` branch of `nvim-treesitter` diff --git a/README.md b/README.md index fd6a3fe0..1e7bb70d 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.11.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.11.2** (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) diff --git a/lua/lazyvim/health.lua b/lua/lazyvim/health.lua index 716c60a8..d1632e75 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.11.0") == 1 then - ok("Using Neovim >= 0.11.0") + if vim.fn.has("nvim-0.11.2") == 1 then + ok("Using Neovim >= 0.11.2") else - error("Neovim >= 0.11.0 is required") + error("Neovim >= 0.11.2 is required") end for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit", "fzf", "curl" }) do diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index a0faebcd..7797b047 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -1,6 +1,6 @@ -if vim.fn.has("nvim-0.11.0") == 0 then +if vim.fn.has("nvim-0.11.2") == 0 then vim.api.nvim_echo({ - { "LazyVim requires Neovim >= 0.11.0\n", "ErrorMsg" }, + { "LazyVim requires Neovim >= 0.11.2\n", "ErrorMsg" }, { "For more info, see: https://github.com/LazyVim/LazyVim/issues/6421\n", "Comment" }, { "Press any key to exit", "MoreMsg" }, }, true, {}) From f88f33c4c62272486c481589850019e8e4f4bd31 Mon Sep 17 00:00:00 2001 From: folke <292349+folke@users.noreply.github.com> Date: Wed, 17 Sep 2025 05:01:57 +0000 Subject: [PATCH 02/13] chore(build): auto-generate docs --- doc/LazyVim.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index a2b1b64c..9f4b59fd 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2025 September 16 +*LazyVim.txt* For Neovim Last change: 2025 September 17 ============================================================================== Table of Contents *LazyVim-table-of-contents* @@ -53,7 +53,7 @@ FEATURES *LazyVim-features* REQUIREMENTS *LazyVim-requirements* -- Neovim >= **0.11.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.11.2** (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 732b063c30ff1167c470063a64a538e109914cad Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 07:06:27 +0200 Subject: [PATCH 03/13] docs: more news --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 1e5d991b..8f59998f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,10 +9,11 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo ### Changes - removed compatibility code for Neovim `< 0.11.2` -- updated all LSP code to use the new LSP implementation +- cconfigure **LSP** with the native `vim.lsp.config` - migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` - added new `treesitter-main` extra to test the new `main` branch of `nvim-treesitter` - after enabling, you will get errors. Update with `:Lazy` and restart Neovim +- enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions ## 14.x From 919c9e5d091f11b2892c56825249fc4a495d3e8f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 07:14:22 +0200 Subject: [PATCH 04/13] fix(eslint): remove old 0.10 code --- lua/lazyvim/plugins/extras/linting/eslint.lua | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 92c670d4..fd860f9b 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -10,7 +10,7 @@ return { "neovim/nvim-lspconfig", -- other settings removed for brevity opts = { - ---@type lspconfig.options + ---@type table servers = { eslint = { settings = { @@ -26,10 +26,6 @@ return { return end - local function get_client(buf) - return vim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] - end - local formatter = LazyVim.lsp.formatter({ name = "eslint: lsp", primary = false, @@ -37,24 +33,6 @@ return { filter = "eslint", }) - -- 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(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) - if #diag > 0 then - vim.cmd("EslintFixAll") - end - end - end - end - -- register the formatter with LazyVim LazyVim.format.register(formatter) end, From 64ee23f38f9a29400673821a4adbbf058c428a5e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 07:14:37 +0200 Subject: [PATCH 05/13] style: remove references to Neovim 0.10 --- lua/lazyvim/config/options.lua | 2 +- lua/lazyvim/plugins/lsp/init.lua | 5 ++--- lua/lazyvim/util/ui.lua | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index b5d444d0..fbbb208c 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -53,7 +53,7 @@ local opt = vim.opt opt.autowrite = true -- Enable auto write -- only set clipboard if not in ssh, to make sure the OSC 52 --- integration works automatically. Requires Neovim >= 0.10.0 +-- integration works automatically. opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index d0c9ced9..c50694d9 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -20,7 +20,6 @@ return { source = "if_many", prefix = "●", -- this will set set the prefix to a function that returns the diagnostics icon based on the severity - -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported -- prefix = "icons", }, severity_sort = true, @@ -33,14 +32,14 @@ return { }, }, }, - -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP inlay hints on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the inlay hints. inlay_hints = { enabled = true, exclude = { "vue" }, -- filetypes for which you don't want to enable inlay hints }, - -- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP code lenses on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the code lenses. codelens = { diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index c8c899d5..f36897aa 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,7 +1,7 @@ ---@class lazyvim.util.ui local M = {} --- optimized treesitter foldexpr for Neovim >= 0.10.0 +-- optimized treesitter foldexpr function M.foldexpr() local buf = vim.api.nvim_get_current_buf() if vim.b[buf].ts_folds == nil then From 4a3b4a80a89fe5a52d30fbe4afe85c152878ab1b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 07:30:27 +0200 Subject: [PATCH 06/13] fix(vue): `volar` -> `vua_ls`. Fixes #6236. Closes #6238. Closes #6174 --- lua/lazyvim/plugins/extras/lang/vue.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index 85f47772..a45caee7 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -19,13 +19,7 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - volar = { - init_options = { - vue = { - hybridMode = true, - }, - }, - }, + vue_ls = {}, vtsls = {}, }, }, From 5e2c4e62f28a85e0b27d5c97ea92af8c1ab74cef Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 08:11:33 +0200 Subject: [PATCH 07/13] feat(lsp): enable LSP folds when available --- lua/lazyvim/plugins/lsp/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index c50694d9..00a698fc 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -45,6 +45,12 @@ return { codelens = { enabled = false, }, + -- Enable this to enable the builtin LSP folding on Neovim. + -- Be aware that you also will need to properly configure your LSP server to + -- provide the folds. + folds = { + enabled = true, + }, -- add any global capabilities here capabilities = { workspace = { @@ -137,6 +143,14 @@ return { end) end + -- folds + if opts.folds.enabled then + LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer) + local win = vim.api.nvim_get_current_win() + vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()" + end) + end + -- code lens if opts.codelens.enabled and vim.lsp.codelens then LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer) From 32ef7a9d39b6fe13c81f9e3e56439bf69fa80805 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 09:22:58 +0200 Subject: [PATCH 08/13] docs: typo --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 8f59998f..567b75ed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,11 +9,12 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo ### Changes - removed compatibility code for Neovim `< 0.11.2` -- cconfigure **LSP** with the native `vim.lsp.config` +- configure **LSP** with the native `vim.lsp.config` - migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` - added new `treesitter-main` extra to test the new `main` branch of `nvim-treesitter` - after enabling, you will get errors. Update with `:Lazy` and restart Neovim - enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions +- use **LSP** based folding when available (disable with `nvim-lspconfig.folds.enabled = false`) ## 14.x From 5eac460c092103e5516bec345236853b9f35ec7c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 09:52:44 +0200 Subject: [PATCH 09/13] feat(treesitter)!: migrate to `nvim-treesitter` **main** branch --- NEWS.md | 4 +- lua/lazyvim/config/options.lua | 3 +- lua/lazyvim/plugins/editor.lua | 10 ++ .../plugins/extras/ui/treesitter-main.lua | 90 ---------- lua/lazyvim/plugins/treesitter.lua | 160 +++++++++--------- lua/lazyvim/util/plugin.lua | 1 + lua/lazyvim/util/ui.lua | 28 +-- 7 files changed, 113 insertions(+), 183 deletions(-) delete mode 100644 lua/lazyvim/plugins/extras/ui/treesitter-main.lua diff --git a/NEWS.md b/NEWS.md index 567b75ed..4f3a0d34 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,8 +11,8 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo - removed compatibility code for Neovim `< 0.11.2` - configure **LSP** with the native `vim.lsp.config` - migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` -- added new `treesitter-main` extra to test the new `main` branch of `nvim-treesitter` - - after enabling, you will get errors. Update with `:Lazy` and restart Neovim +- migrated to [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter/tree/main) **main** branch +- replace `nvim-treesitter` incremental selection with `flash.nvim`, since it is no longer supported - enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions - use **LSP** based folding when available (disable with `nvim-lspconfig.folds.enabled = false`) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index fbbb208c..62c8242e 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -68,7 +68,7 @@ opt.fillchars = { diff = "╱", eob = " ", } -opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" +opt.foldexpr = "v:lua.LazyVim.ui.foldexpr()" -- treesitter folds opt.foldlevel = 99 opt.foldmethod = "expr" opt.foldtext = "" @@ -78,6 +78,7 @@ opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" opt.ignorecase = true -- Ignore case opt.inccommand = "nosplit" -- preview incremental substitute +opt.indentexpr = "v:lua.LazyVim.ui.indentexpr()" -- treesitter indents opt.jumpoptions = "view" opt.laststatus = 3 -- global statusline opt.linebreak = true -- Wrap lines at convenient points diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 4aaf3d1f..9fdeffd9 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -40,6 +40,16 @@ return { { "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" }, + -- Simulate nvim-treesitter incremental selection + { "", mode = { "n", "o", "x" }, + function() + require("flash").treesitter({ + actions = { + [""] = "next", + [""] = "prev" + } + }) + end, desc = "Treesitter Incremental Selection" }, }, }, diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-main.lua b/lua/lazyvim/plugins/extras/ui/treesitter-main.lua deleted file mode 100644 index bb22aabb..00000000 --- a/lua/lazyvim/plugins/extras/ui/treesitter-main.lua +++ /dev/null @@ -1,90 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - version = false, -- last release is way too old and doesn't work on Windows - branch = "main", - build = ":TSUpdate", - lazy = true, - cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" }, - init = function() end, - ---@param opts TSConfig - config = function(_, opts) - if vim.fn.executable("tree-sitter") == 0 then - LazyVim.error("**treesitter-main** requires the `tree-sitter` executable to be installed") - return - end - if type(opts.ensure_installed) ~= "table" then - error("opts.ensure_installed must be a table") - end - - local TS = require("nvim-treesitter") - TS.setup(opts) - - local needed = LazyVim.dedup(opts.ensure_installed --[[@as string[] ]]) - local installed = TS.get_installed("parsers") - local install = vim.tbl_filter(function(lang) - return not vim.tbl_contains(installed, lang) - end, needed) - - if #install > 0 then - TS.install(install, { summary = true }) - vim.list_extend(installed, install) - end - - -- backwards compatibility with the old treesitter config for highlight and indent - local highlight, indent = vim.tbl_get(opts, "highlight", "enable"), vim.tbl_get(opts, "indent", "enable") - if highlight or indent then - vim.api.nvim_create_autocmd("FileType", { - callback = function(ev) - local lang = vim.treesitter.language.get_lang(ev.match) - if not vim.tbl_contains(installed, lang) then - return - end - if highlight then - pcall(vim.treesitter.start) - end - if indent then - vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - end - end, - }) - end - end, - }, - { - "nvim-treesitter/nvim-treesitter-textobjects", - branch = "main", - event = "VeryLazy", - opts = {}, - keys = function() - local moves = { - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, - } - local ret = {} ---@type LazyKeysSpec[] - for method, keymaps in pairs(moves) do - for key, query in pairs(keymaps) do - local desc = query:gsub("@", ""):gsub("%..*", "") - desc = desc:sub(1, 1):upper() .. desc:sub(2) - desc = (key:sub(1, 1) == "[" and "Prev " or "Next ") .. desc - desc = desc .. (key:sub(2, 2) == key:sub(2, 2):upper() and " End" or " Start") - ret[#ret + 1] = { - key, - function() - require("nvim-treesitter-textobjects.move")[method](query, "textobjects") - end, - desc = desc, - mode = { "n", "x", "o" }, - silent = true, - } - end - end - return ret - end, - config = function(_, opts) - require("nvim-treesitter-textobjects").setup(opts) - end, - }, -} diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 0f0c8fe8..4b15ab87 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -1,43 +1,25 @@ return { - { - "folke/which-key.nvim", - opts = { - spec = { - { "", desc = "Decrement Selection", mode = "x" }, - { "", desc = "Increment Selection", mode = { "x", "n" } }, - }, - }, - }, -- 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", + branch = "main", version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "LazyFile", "VeryLazy" }, - lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline - init = function(plugin) - -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early - -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which - -- no longer trigger the **nvim-treesitter** module to be loaded in time. - -- Luckily, the only things 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") + build = function() + local TS = require("nvim-treesitter") + if not TS.get_installed then + LazyVim.error("Please restart Neovim and run `:TSUpdate` to use the `nvim-treesitter` **main** branch.") + return + end + vim.cmd.TSUpdate() end, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, - keys = { - { "", desc = "Increment Selection" }, - { "", desc = "Decrement Selection", mode = "x" }, - }, + lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline + event = { "LazyFile", "VeryLazy" }, + cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" }, opts_extend = { "ensure_installed" }, - ---@type TSConfig - ---@diagnostic disable-next-line: missing-fields opts = { - highlight = { enable = true }, - indent = { enable = true }, ensure_installed = { "bash", "c", @@ -64,65 +46,91 @@ return { "xml", "yaml", }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, - }, - }, }, + ---@param plugin LazyPlugin ---@param opts TSConfig - config = function(_, opts) - if type(opts.ensure_installed) == "table" then - opts.ensure_installed = LazyVim.dedup(opts.ensure_installed) + config = function(plugin, opts) + if vim.fn.executable("tree-sitter") == 0 then + LazyVim.error("**treesitter-main** requires the `tree-sitter` executable to be installed") + return end - require("nvim-treesitter.configs").setup(opts) + if type(opts.ensure_installed) ~= "table" then + LazyVim.error("`nvim-treesitter` opts.ensure_installed must be a table") + end + + local TS = require("nvim-treesitter") + if not TS.get_installed then + LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + return + end + TS.setup(opts) + + local needed = LazyVim.dedup(opts.ensure_installed --[[@as string[] ]]) + LazyVim.ui.installed = TS.get_installed("parsers") + + local install = vim.tbl_filter(function(lang) + return not LazyVim.ui.have(lang) + end, needed) + + if #install > 0 then + TS.install(install, { summary = true }):await(function() + LazyVim.ui.installed = TS.get_installed("parsers") + end) + end + + vim.api.nvim_create_autocmd("FileType", { + callback = function(ev) + if LazyVim.ui.have(ev.match) then + pcall(vim.treesitter.start) + end + end, + }) end, }, { "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", event = "VeryLazy", - enabled = true, - config = function() - -- If treesitter is already loaded, we need to run config again for textobjects - if LazyVim.is_loaded("nvim-treesitter") then - local opts = LazyVim.opts("nvim-treesitter") - require("nvim-treesitter.configs").setup({ textobjects = opts.textobjects }) - end - - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - 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 + opts = {}, + keys = function() + local moves = { + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + } + local ret = {} ---@type LazyKeysSpec[] + for method, keymaps in pairs(moves) do + for key, query in pairs(keymaps) do + local desc = query:gsub("@", ""):gsub("%..*", "") + desc = desc:sub(1, 1):upper() .. desc:sub(2) + desc = (key:sub(1, 1) == "[" and "Prev " or "Next ") .. desc + desc = desc .. (key:sub(2, 2) == key:sub(2, 2):upper() and " End" or " Start") + ret[#ret + 1] = { + key, + function() + -- don't use treesitter if in diff mode and the key is one of the c/C keys + if vim.wo.diff and key:find("[cC]") then + return vim.cmd("normal! " .. key) end - end - return fn(q, ...) - end + require("nvim-treesitter-textobjects.move")[method](query, "textobjects") + end, + desc = desc, + mode = { "n", "x", "o" }, + silent = true, + } end end + return ret + end, + config = function(_, opts) + local TS = require("nvim-treesitter-textobjects") + if not TS.setup then + LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + return + end + TS.setup(opts) end, }, diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index ff3f3634..58063385 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -17,6 +17,7 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.", ["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**", ["lazyvim.plugins.extras.ui.treesitter-rewrite"] = "Disabled `treesitter-rewrite` extra for now. Not ready yet.", + ["lazyvim.plugins.extras.ui.treesitter-main"] = "the `nvim-treesitter` main branch is now used by default", ["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a core LazyVim plugin (again)", ["lazyvim.plugins.extras.lazyrc"] = "local spec files are now a lazy.nvim feature", ["lazyvim.plugins.extras.editor.trouble-v3"] = "Trouble v3 has been merged in main", diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index f36897aa..19d5642e 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,22 +1,22 @@ ---@class lazyvim.util.ui local M = {} --- optimized treesitter foldexpr +M.installed = {} ---@type string[] + +---@param ft string +function M.have(ft) + local lang = vim.treesitter.language.get_lang(ft) + return vim.tbl_contains(M.installed, lang) +end + function M.foldexpr() local buf = vim.api.nvim_get_current_buf() - if vim.b[buf].ts_folds == nil then - -- 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 - if vim.bo[buf].filetype:find("dashboard") then - vim.b[buf].ts_folds = false - else - vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf) - end - end - return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0" + return M.have(vim.b[buf].filetype) and vim.treesitter.foldexpr() or "0" +end + +function M.indentexpr() + local buf = vim.api.nvim_get_current_buf() + return M.have(vim.b[buf].filetype) and require("nvim-treesitter").indentexpr() or -1 end return M From e9344e5319b712e90cfe36521d4682f36aaaf297 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 17 Sep 2025 10:10:34 +0200 Subject: [PATCH 10/13] docs: better error and ref to checkhealth for nvim-treesitter main --- NEWS.md | 2 ++ lua/lazyvim/plugins/treesitter.lua | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 4f3a0d34..050440b2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,8 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo - configure **LSP** with the native `vim.lsp.config` - migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` - migrated to [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter/tree/main) **main** branch + - with the new version, the `tree-sitter` cli is **required** to install parsers + - best to run `:checkhealth nvim_treesitter` after updating - replace `nvim-treesitter` incremental selection with `flash.nvim`, since it is no longer supported - enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions - use **LSP** based folding when available (disable with `nvim-lspconfig.folds.enabled = false`) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 4b15ab87..d65ce551 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -51,7 +51,10 @@ return { ---@param opts TSConfig config = function(plugin, opts) if vim.fn.executable("tree-sitter") == 0 then - LazyVim.error("**treesitter-main** requires the `tree-sitter` executable to be installed") + LazyVim.error({ + "**treesitter-main** requires the `tree-sitter` CLI executable to be installed.", + "Run `:checkhealth nvim_treesitter` for more information.", + }) return end if type(opts.ensure_installed) ~= "table" then From 6eed1781c185ea6d1f313aee60a7097448f473cb Mon Sep 17 00:00:00 2001 From: EasonMo Date: Wed, 17 Sep 2025 16:13:36 +0800 Subject: [PATCH 11/13] fix(gitsigns): use silent for gitsigns keymaps (#5841) ## Description When executing `ghs`, the command line window will flicker. Therefore, it should be run silently. ## Related Issue(s) None ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- 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 9fdeffd9..5abed1a3 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -153,7 +153,7 @@ return { local gs = package.loaded.gitsigns local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc, silent = true }) end -- stylua: ignore start From fd1b02ae5740dc651cc43291391084dbe7b1b3c4 Mon Sep 17 00:00:00 2001 From: Nick Janetakis Date: Wed, 17 Sep 2025 04:14:48 -0400 Subject: [PATCH 12/13] fix(grug-far): add support for GrugFarWithin so it gets loaded by default (#5772) ## Description https://github.com/MagicDuck/grug-far.nvim is the default find and replace plugin for LazyVim. It recently added support for being able to do a find / replace within a visual selection to limit the scope of a search. It did that by introducing a new command called `:GrugFarWithin`. This PR adds that as a `cmd` so it gets loaded by default. Without this PR, you cannot call this command unless you first call `:GrugFar`. This was identified by the author of Grug Far. ## Related Issue(s) There is no issue in this repo, but this feature is related to: https://github.com/MagicDuck/grug-far.nvim/issues/357 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. I also want to give a shout-out to @MagicDuck who is the author of the plugin. He implemented this feature so fast and has been super helpful in his repo's issue tracker. --- 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 5abed1a3..8fef8e9e 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -4,7 +4,7 @@ return { { "MagicDuck/grug-far.nvim", opts = { headerMaxWidth = 80 }, - cmd = "GrugFar", + cmd = { "GrugFar", "GrugFarWithin" }, keys = { { "sr", From 112b8848b55ba5161c6713219a200a51be67d859 Mon Sep 17 00:00:00 2001 From: Jorge Villalobos Date: Wed, 17 Sep 2025 04:15:21 -0400 Subject: [PATCH 13/13] chore(which-key): remove unnecessary icons (#5461) ## Description These are already handled by which-key exactly the same way, no need to re-declare them here. Removing them from here has no effect. ## Related Issue(s) N/A ## Screenshots ![Screenshot 2025-01-23 at 21 21 14](https://github.com/user-attachments/assets/d9f777e8-d514-4836-9314-03a66cc5a34b) ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/editor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 8fef8e9e..6e2c894e 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -74,8 +74,8 @@ return { { "gh", group = "hunks" }, { "q", group = "quit/session" }, { "s", group = "search" }, - { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, - { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, + { "u", group = "ui" }, + { "x", group = "diagnostics/quickfix" }, { "[", group = "prev" }, { "]", group = "next" }, { "g", group = "goto" },