From 7d9a3955651ba3f59389596e869affcedccaa489 Mon Sep 17 00:00:00 2001 From: Sergey Kochetkov Date: Thu, 12 Oct 2023 15:10:26 +0200 Subject: [PATCH 001/123] 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 af64a6f5..2a5ef5ac 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 002/123] 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 07bb1ed6..4a9a0f22 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 2751e8e6..ac2b4055 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 00000000..73c4fb15 --- /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 4e28148b..a4517bf5 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 003/123] 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 ac2b4055..ddfa55f8 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 004/123] 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 1161066d..318e04e5 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 4a9a0f22..3f84e91a 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 005/123] 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 1fb7ab5d..52ff9bee 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 006/123] 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 52ff9bee..db9fe9c3 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 007/123] 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 3f84e91a..69561c1d 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 73c4fb15..b8428add 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 a4517bf5..11707155 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 008/123] 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 | 102 ++++++++++++++++++++++------------ 3 files changed, 74 insertions(+), 41 deletions(-) diff --git a/NEWS.md b/NEWS.md index af6fca2f..50b72da3 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 009bb6fa..4eb73804 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 c71e328c..0417b81e 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) + return extras +end - ---@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 +---@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) + 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) + ---@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 009/123] 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 6e1d63b6..63a8e1b1 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 010/123] 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 318e04e5..1639dea3 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 69561c1d..774cb7ca 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 011/123] 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 d46149b1..440c9fda 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 012/123] 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 774cb7ca..af31f163 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 b8428add..d98d0382 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 013/123] 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 ea9ed565..49d339b6 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 014/123] 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 1639dea3..4573b18d 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 015/123] 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 4573b18d..80f25f8e 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 af31f163..4a5abf17 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 016/123] 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 d5903cd8..7060c7a5 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 017/123] 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 7060c7a5..b34a2afe 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 018/123] 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 855e356e..b40245ea 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 019/123] 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 6dda53d3..2424589d 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 020/123] 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 7e87678b..aaad0128 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 021/123] 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 bae7b15b..85517a65 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 7b9c2189..10e5d86f 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 022/123] 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 b40245ea..2053d1a5 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 023/123] 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 2053d1a5..5042f076 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" }, + 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 + ---@class ConformOpts + return { + -- LazyVim will use these options when formatting with the conform.nvim formatter + format = { + timeout_ms = 1000, }, - }, - }, - ---@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 - end - format_opts = opts.format - require("conform").setup(opts) + 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 024/123] 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 64e6237a..6cabd24d 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 025/123] 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 d05c941c..875c11c8 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 6ec0e572..887db7ef 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 0800e5d5..8164d19f 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 e821c33e..abba7d44 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 f23bec3b..9ff2c986 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 026/123] 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 49d339b6..0347bf2f 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 027/123] 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 5042f076..c98a7252 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 c833a707..1b4debcf 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 028/123] 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 165367bf..f0823e46 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 029/123] 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 11707155..4c212470 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 030/123] 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 00000000..123f92bf --- /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 031/123] 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 123f92bf..00000000 --- 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 032/123] 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 00000000..123f92bf --- /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 033/123] 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 835c9da8..a4783973 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 034/123] 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 457535cd..a9f40624 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 ddfa55f8..4a98aee4 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 00000000..8efcf714 --- /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 035/123] 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 4a5abf17..170f78bc 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 00000000..57748f5f --- /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 036/123] 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 80f25f8e..7754b28f 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 170f78bc..84163165 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 037/123] 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 db9fe9c3..2d2527c1 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 038/123] 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 0347bf2f..ecbf2c58 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 039/123] 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 123f92bf..f57954f1 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 a4783973..cc9bc52e 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 040/123] 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 63a8e1b1..9ee3eb03 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 875c11c8..8feee188 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 887db7ef..5f5ec9c5 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 abba7d44..0707fb5b 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 68916341..1d816b80 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 041/123] 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 6f1f3b58..a93f6ecf 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 042/123] 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 84163165..19686b57 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 f0b0ba92..32cdd17f 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 043/123] 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 0707fb5b..73a52cdf 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 4a98aee4..24fd0a1b 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 8efcf714..7eb353bf 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 d799fe44..80aece22 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 044/123] 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 80aece22..519546e1 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 045/123] 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 7eb353bf..1ec2cd19 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 046/123] 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 57748f5f..696103ce 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 047/123] 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 7754b28f..d4c3bd78 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 19686b57..3b8092c7 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 048/123] 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 85517a65..173705ab 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 049/123] 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 ecbf2c58..82cf4b6a 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 050/123] 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 173705ab..bdfdec88 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 73a52cdf..3ccda60b 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 051/123] 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 3ccda60b..69b46309 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 052/123] 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 bdfdec88..4b36d0ab 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 053/123] 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 c98a7252..28c794fc 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 054/123] 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 f57954f1..3fc9c0f1 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 055/123] 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 1ec2cd19..3e3cdb9a 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 519546e1..a6deb240 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 056/123] 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 2ffff686..51c47553 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 057/123] 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 82cf4b6a..19a7948e 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 058/123] 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 3b8092c7..fd9ffcd2 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 a6deb240..29581975 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 059/123] 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 3fc9c0f1..ecb9b0a6 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 060/123] 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 d4c3bd78..1ac78384 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 fd9ffcd2..7f491c91 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 061/123] 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 69b46309..5eaeb4a0 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 062/123] 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 5a071a15..d1605f93 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 28c794fc..66edd1bb 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 2a5ef5ac..fa972296 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 063/123] 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 1ac78384..486131ac 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 7f491c91..0e611fd9 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 064/123] fix(statuscolumn): correct line numbers & respect more options --- lua/lazyvim/util/ui.lua | 68 +++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 6c5a3c1f..c17a1e7b 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) + local is_file = vim.bo[buf].buftype == "" + local show_signs = vim.wo[win].signcolumn ~= "no" - ---@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 + 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 + + -- 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 - left = s + components[2] = is_relnum and "%r" or "%l" -- other lines end + components[2] = "%=" .. components[2] .. " " -- right align 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) - - 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(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 065/123] 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 19a7948e..5d0601e1 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 066/123] 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 66edd1bb..6d8c9bc7 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 067/123] 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 486131ac..f70e72c7 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 0e611fd9..056ab274 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 068/123] 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 2424589d..c25e0f6c 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 069/123] 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 4b36d0ab..d7a480cb 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 070/123] 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 5eaeb4a0..d0d24533 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 071/123] 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 d22e5205..321955ab 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 072/123] 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 f70e72c7..ba2d6af4 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 056ab274..2b4ff20e 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 073/123] 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 8164d19f..e05f75fb 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 074/123] 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 5d0601e1..ea17820b 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 075/123] 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 ba2d6af4..4b16dd17 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 2b4ff20e..b99f473c 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 076/123] 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 d0d24533..2f97c374 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 077/123] 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 ea17820b..b1e64e73 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 078/123] 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 1b4debcf..c8ba7f48 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 079/123] 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 2f97c374..88577395 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 080/123] 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 6d8c9bc7..eb2dd1a8 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 081/123] 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 696103ce..aac8519e 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 082/123] 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 c8ba7f48..3277ef83 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 083/123] 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 4af1deec..4f53ae8c 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 084/123] 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 4b16dd17..85e623c7 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 b99f473c..09e6c6e0 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 085/123] 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 85e623c7..4dd289f3 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 086/123] 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 e05f75fb..3936c96a 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 087/123] 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 b1e64e73..eb178733 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 088/123] 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 43b8c49d..2add9c2f 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 089/123] 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 eb178733..d3e0227b 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 090/123] 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 8ed12bbd..2c28f1c4 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 9ee3eb03..67c45e51 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 6cabd24d..e2513828 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 88577395..5f8ece20 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 091/123] 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 67c45e51..8c34f357 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 092/123] 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 d1605f93..69e8e8d3 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 c17a1e7b..68999eda 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 093/123] 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 d3e0227b..6982b959 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 094/123] 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 ecb9b0a6..24e3b891 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 095/123] 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 3277ef83..e66725c0 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 096/123] 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 24e3b891..5aa9dc33 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 097/123] 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 4dd289f3..773890db 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 09e6c6e0..4191a940 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 098/123] 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 64808bee..f7e7ca5f 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 099/123] 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 a9a4870e..e4e32c10 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 100/123] 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 d7a480cb..c5f70016 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 101/123] 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 404a072a..e95dbfdd 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 102/123] 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 773890db..c3dc6034 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 4191a940..fc5487c5 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 103/123] 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 9ff2c986..fdd76f1a 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 104/123] 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 2c28f1c4..8ed12bbd 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 105/123] 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 c3dc6034..a6de0da5 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 fc5487c5..12d49ed6 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 106/123] 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 5f8ece20..50efb153 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 107/123] 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 fdd76f1a..7ab69134 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 108/123] 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 6982b959..181205b6 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 109/123] 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 69e8e8d3..3c9686b1 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 7baa387e..c3870889 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 110/123] 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 181205b6..03a1f372 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 111/123] 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 0417b81e..4e2f0bc1 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 112/123] 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 03a1f372..bb2c94cd 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 113/123] 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 8c34f357..b5f529e5 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 114/123] 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 bb2c94cd..44ba75b1 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 115/123] 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 8ed12bbd..bb63326e 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 116/123] 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 a6de0da5..ce168232 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 12d49ed6..d84e26cd 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 117/123] 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 c5f70016..f7fe57d6 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 f0823e46..f454ac1c 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 b520070b..51e81744 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 118/123] 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 44ba75b1..2d805f3b 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 119/123] 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 68999eda..ce8b4780 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 120/123] 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 f454ac1c..048de5b8 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 121/123] 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 ce168232..a3c33fe0 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 d84e26cd..09b80d86 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 122/123] 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 048de5b8..3b60d14b 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 51e81744..db41c825 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 123/123] 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 a3c33fe0..318c543d 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 09b80d86..a296ef56 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 = {