diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 03fbd8ca..2103ea51 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -75,7 +75,7 @@ body: -- install plugins local plugins = { "folke/tokyonight.nvim", - "folke/LazyVim", + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, -- add any other plugins here } require("lazy").setup(plugins, { diff --git a/CHANGELOG.md b/CHANGELOG.md index 964e021c..47130543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [12.14.1](https://github.com/LazyVim/LazyVim/compare/v12.14.0...v12.14.1) (2024-06-14) + + +### Bug Fixes + +* **edgy:** only track other neo-tree windows with a source ([6efbdab](https://github.com/LazyVim/LazyVim/commit/6efbdabd1b2272401566354686ce85e1372fe925)) +* **extras:** better reasons as to why some extras are included in your config. ([eeccbbc](https://github.com/LazyVim/LazyVim/commit/eeccbbc40721bb825182251acf201750741c77b2)) +* **fzf:** esc and c-j, c-k keymaps with nowait. update fzf-lua as well ([c9380a3](https://github.com/LazyVim/LazyVim/commit/c9380a309dbdc9fe45ec1bc9f8f27700540c2eea)) +* **fzf:** esc and nowait ([7c7703d](https://github.com/LazyVim/LazyVim/commit/7c7703d79226cda99b1ec3d25fbfff54af04ba5b)) +* **fzf:** floating previewer closed fail ([#3638](https://github.com/LazyVim/LazyVim/issues/3638)) ([427e57d](https://github.com/LazyVim/LazyVim/commit/427e57ddf7030f7081d858d923fb9337f94bf0a7)) +* **issue template:** repro.lua didn't work ([#3628](https://github.com/LazyVim/LazyVim/issues/3628)) ([25cccb5](https://github.com/LazyVim/LazyVim/commit/25cccb5db858ad0640fd6a9eb5da4c5f465749d9)) +* **pick:** allow configuring pickers without LazyExtras. Fixes [#3626](https://github.com/LazyVim/LazyVim/issues/3626) ([304e743](https://github.com/LazyVim/LazyVim/commit/304e7439aa8ae646adafb737b292707bf77a31d9)) + ## [12.14.0](https://github.com/LazyVim/LazyVim/compare/v12.13.0...v12.14.0) (2024-06-13) diff --git a/README-CN.md b/README-CN.md index 395e146e..b78a398a 100644 --- a/README-CN.md +++ b/README-CN.md @@ -113,6 +113,10 @@ docker run -w /root -it --rm alpine:edge sh -uelic ' [![Watch the video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) +[@dusty-phillips](https://github.com/dusty-phillips) 正在编写一本名为 +[LazyVim for Ambitious Developers](https://lazyvim-ambitious-devs.phillips.codes) +的书,该书可在线免费获得。 + ## 📂 文件结构 config 下的文件会在适当的时候自动加载,所以你不需要手动引入这些文件。 diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index b82a763a..d2f8e24a 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -5,6 +5,12 @@ vim.g.maplocalleader = "\\" -- LazyVim auto format vim.g.autoformat = true +-- LazyVim picker to use. +-- Can be one of: telescope, fzf +-- Leave it to "auto" to automatically use the picker +-- enabled with `:LazyExtras` +vim.g.lazyvim_picker = "auto" + -- LazyVim root dir detection -- Each entry can be: -- * the name of a detector function like `lsp` or `cwd` diff --git a/lua/lazyvim/plugins/compat/nvim-0_9.lua b/lua/lazyvim/plugins/compat/nvim-0_9.lua index 6488952b..4f971b6f 100644 --- a/lua/lazyvim/plugins/compat/nvim-0_9.lua +++ b/lua/lazyvim/plugins/compat/nvim-0_9.lua @@ -26,4 +26,13 @@ return { "neovim/nvim-lspconfig", dependencies = {}, }, + + -- dummy import to save core imports + { + import = "foobar", + enabled = function() + LazyVim.plugin.save_core() + return false + end, + }, } diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 591497d6..05fe5c25 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -236,8 +236,8 @@ return { -- better diagnostics list and others { "folke/trouble.nvim", - cmd = { "TroubleToggle", "Trouble" }, - opts = { use_diagnostic_signs = true }, + cmd = { "Trouble" }, + opts = {}, keys = { { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, { "xX", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)" }, @@ -301,13 +301,13 @@ return { { import = "lazyvim.plugins.extras.editor.fzf", enabled = function() - return LazyVim.has_extra("editor.fzf") + return LazyVim.pick.want() == "fzf" end, }, { import = "lazyvim.plugins.extras.editor.telescope", enabled = function() - return not LazyVim.has_extra("editor.fzf") + return LazyVim.pick.want() == "telescope" end, }, } diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index 56aeead2..06765407 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -1,3 +1,9 @@ +if lazyvim_docs then + -- In case you don't want to use `:LazyExtras`, + -- then you need to set the option below. + vim.g.lazyvim_picker = "fzf" +end + ---@class FzfLuaOpts: lazyvim.util.pick.Opts ---@field cmd string? @@ -155,9 +161,8 @@ return { require("fzf-lua").register_ui_select(opts.ui_select or nil) end, keys = { - { "", "", ft = "fzf", mode = "t", nowait = true }, - { "", "", ft = "fzf", mode = "t", nowait = true }, - { "", "", ft = "fzf", mode = "t", nowait = true }, + { "", "", ft = "fzf", mode = "t", nowait = true }, + { "", "", ft = "fzf", mode = "t", nowait = true }, { ",", "FzfLua buffers sort_mru=true sort_lastused=true", diff --git a/lua/lazyvim/plugins/extras/editor/telescope.lua b/lua/lazyvim/plugins/extras/editor/telescope.lua index 52335fa7..faeb16b9 100644 --- a/lua/lazyvim/plugins/extras/editor/telescope.lua +++ b/lua/lazyvim/plugins/extras/editor/telescope.lua @@ -1,3 +1,9 @@ +if lazyvim_docs then + -- In case you don't want to use `:LazyExtras`, + -- then you need to set the option below. + vim.g.lazyvim_picker = "telescope" +end + local have_make = vim.fn.executable("make") == 1 local have_cmake = vim.fn.executable("cmake") == 1 @@ -49,6 +55,9 @@ return { { "nvim-telescope/telescope.nvim", cmd = "Telescope", + enabled = function() + return LazyVim.pick.want() == "telescope" + end, version = false, -- telescope did only one release, so use HEAD for now dependencies = { { @@ -228,6 +237,9 @@ return { { "stevearc/dressing.nvim", lazy = true, + enabled = function() + return LazyVim.pick.want() == "telescope" + end, init = function() ---@diagnostic disable-next-line: duplicate-set-field vim.ui.select = function(...) @@ -245,6 +257,9 @@ return { { "neovim/nvim-lspconfig", opts = function() + if LazyVim.pick.want() ~= "telescope" then + return + end local Keys = require("lazyvim.plugins.lsp.keymaps").get() -- stylua: ignore vim.list_extend(Keys, { diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 4ccdc5f0..f7645879 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -84,7 +84,14 @@ return { pinned = true, open = "Neotree position=top buffers", }, - "neo-tree", + { + title = "Neo-Tree Other", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source ~= nil + end, + }, + -- "neo-tree", }, keys = { -- increase width diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index e636c255..24d5fcd2 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -20,8 +20,9 @@ local v = version.major .. "_" .. version.minor local compat = { "0_9" } +LazyVim.plugin.save_core() if vim.tbl_contains(compat, v) then - extras[#extras + 1] = "lazyvim.plugins.compat.nvim-" .. v + table.insert(extras, 1, "lazyvim.plugins.compat.nvim-" .. v) end table.sort(extras, function(a, b) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index afa0ae2f..2fdef824 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -250,10 +250,30 @@ end ---@param extra LazyExtra function X:extra(extra) if not extra.managed then - self:diagnostic({ - message = "Not managed by LazyExtras (config)", - severity = vim.diagnostic.severity.WARN, - }) + ---@type LazyExtra[] + local parents = {} + for _, x in ipairs(self.extras) do + if x.enabled and vim.tbl_contains(x.imports, extra.module) then + parents[#parents + 1] = x + end + end + if #parents > 0 then + local pp = vim.tbl_map(function(x) + return x.name + end, parents) + self:diagnostic({ + message = "Required by " .. table.concat(pp, ", "), + }) + elseif vim.tbl_contains(LazyVim.plugin.core_imports, extra.module) then + self:diagnostic({ + message = "This extra is included by default", + }) + else + self:diagnostic({ + message = "Not managed by LazyExtras (config)", + severity = vim.diagnostic.severity.WARN, + }) + end end extra.row = self.text:row() local hl = extra.managed and "LazySpecial" or "LazyLocal" diff --git a/lua/lazyvim/util/pick.lua b/lua/lazyvim/util/pick.lua index aa3c20ea..e8b08e93 100644 --- a/lua/lazyvim/util/pick.lua +++ b/lua/lazyvim/util/pick.lua @@ -32,6 +32,11 @@ function M.register(picker) if vim.v.vim_did_enter == 1 then return true end + + if M.picker and M.picker.name ~= M.want() then + M.picker = nil + end + if M.picker and M.picker.name ~= picker.name then LazyVim.warn( "`LazyVim.pick`: picker already set to `" .. M.picker.name .. "`,\nignoring new picker `" .. picker.name .. "`" @@ -42,6 +47,14 @@ function M.register(picker) return true end +function M.want() + vim.g.lazyvim_picker = vim.g.lazyvim_picker or "auto" + if vim.g.lazyvim_picker == "auto" then + return LazyVim.has_extra("editor.fzf") and "fzf" or "telescope" + end + return vim.g.lazyvim_picker +end + ---@param command? string ---@param opts? lazyvim.util.pick.Opts function M.open(command, opts) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index f34527ac..1520bdce 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -3,6 +3,9 @@ local Plugin = require("lazy.core.plugin") ---@class lazyvim.util.plugin local M = {} +---@type string[] +M.core_imports = {} + M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } ---@type table @@ -32,6 +35,13 @@ M.renames = { ["glepnir/dashboard-nvim"] = "nvimdev/dashboard-nvim", } +function M.save_core() + if vim.v.vim_did_enter == 1 then + return + end + M.core_imports = vim.deepcopy(require("lazy.core.config").spec.modules) +end + function M.setup() M.fix_imports() M.fix_renames()