diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 1a2b85d2..d1d210f5 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "14.5.0" + ".": "14.9.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ffbf67..7c9c762e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,98 @@ # Changelog +## [14.9.0](https://github.com/LazyVim/LazyVim/compare/v14.8.0...v14.9.0) (2025-01-30) + + +### Features + +* **markdown:** added markdown support for codecompanion ([e9db488](https://github.com/LazyVim/LazyVim/commit/e9db488acaa04f1a9eca6d022e57fed4271b8af8)) +* **snacks.picker:** added <leader>si to search icons ([#5460](https://github.com/LazyVim/LazyVim/issues/5460)) ([eea52be](https://github.com/LazyVim/LazyVim/commit/eea52be3447502dde77d9e6fa75fd597a0b5a86a)) +* **snacks.picker:** added <leader>su to search undotree ([#5447](https://github.com/LazyVim/LazyVim/issues/5447)) ([332b320](https://github.com/LazyVim/LazyVim/commit/332b32080c52727a16db90e06989caa0c378caa1)) +* **snacks.picker:** added `leader-fB` to find any buffer (including hidden & nofile) ([83bf636](https://github.com/LazyVim/LazyVim/commit/83bf6360a1f28a3fc1afe31ae300247fc01c7a90)) +* **snacks.picker:** added `leader-sp` to search for plugin spec ([7cf4185](https://github.com/LazyVim/LazyVim/commit/7cf4185dc4d1fe49ad004d33a6703603fb4500ff)) +* **snacks.picker:** added alt-c to toggle between cwd/root dir ([6be7c4f](https://github.com/LazyVim/LazyVim/commit/6be7c4fee4fb755ff07f7bcc13eac96e1d8c279a)) +* **snacks.picker:** flash.nvim integration ([5d24aa6](https://github.com/LazyVim/LazyVim/commit/5d24aa63111af68fbada8c97fedb75b07b8c3c92)) +* **snacks.picker:** use snacks picker for notifications when enabled ([01a70cc](https://github.com/LazyVim/LazyVim/commit/01a70cc60ed2760afc819510177fb8d12a371b25)) +* **snacks:** extra for snacks explorer (replacement for neo-tree) ([e20d9af](https://github.com/LazyVim/LazyVim/commit/e20d9afcbc980510093a3753a3991d8c934cbb75)) +* **snippets:** an extra for mini.snippets ([#5274](https://github.com/LazyVim/LazyVim/issues/5274)) ([8b4e6ff](https://github.com/LazyVim/LazyVim/commit/8b4e6ff70d682cad3b1f4999623c3f0ac639fa82)) + + +### Bug Fixes + +* **keymaps:** remove unneeded and ambiguous `<leader>w` keymap ([#5459](https://github.com/LazyVim/LazyVim/issues/5459)) ([132986a](https://github.com/LazyVim/LazyVim/commit/132986a624b49bf740161d90ce94f16dd5ea5883)) +* **luasnip:** schedule `jump` to be compatible with blink, nvim-cmp still works after change ([#5470](https://github.com/LazyVim/LazyVim/issues/5470)) ([0350934](https://github.com/LazyVim/LazyVim/commit/0350934d56579f3e6a9d40fa47313b2970d74772)) +* **root:** pass args to root.get ([dc8512f](https://github.com/LazyVim/LazyVim/commit/dc8512fce1ec1cd4b0ca52d1077b2ed3894d51c8)) +* **snacks.picker:** flash integration ([b5cd0d0](https://github.com/LazyVim/LazyVim/commit/b5cd0d0e27081be3ef1905475a0fe541b7661870)) +* **snacks.picker:** snacks => flash ([3de7b24](https://github.com/LazyVim/LazyVim/commit/3de7b24cf6ed844772ea047476a400c56d5f4b42)) +* **snacks:** use `Snacks.picker` for recent files ([#5485](https://github.com/LazyVim/LazyVim/issues/5485)) ([f0d2629](https://github.com/LazyVim/LazyVim/commit/f0d2629bd859eeac343999b0fe145f9beb227c4a)) +* **sql:** better nvim-cmp check. Closes [#5188](https://github.com/LazyVim/LazyVim/issues/5188) ([1e83b4f](https://github.com/LazyVim/LazyVim/commit/1e83b4f843f88678189df81b1c88a400c53abdbc)) +* **vscode:** diabled some snacks plugins. Fixes [#5364](https://github.com/LazyVim/LazyVim/issues/5364) ([c7a7ab5](https://github.com/LazyVim/LazyVim/commit/c7a7ab51129692927ae47f4e57ce22d10d48467e)) + +## [14.8.0](https://github.com/LazyVim/LazyVim/compare/v14.7.0...v14.8.0) (2025-01-20) + + +### Features + +* **chezmoi:** add snacks picker integration for chezmoi files ([#5429](https://github.com/LazyVim/LazyVim/issues/5429)) ([970d1a0](https://github.com/LazyVim/LazyVim/commit/970d1a05da37554aa17b671c869431a7b387d8be)) +* **dial:** add checkbox augend for markdown ([#5411](https://github.com/LazyVim/LazyVim/issues/5411)) ([b19f207](https://github.com/LazyVim/LazyVim/commit/b19f2070b847a3067436f4d16a0cc5b84a9f9819)) +* **snacks.picker:** added leader-sS to search lsp workspace symbols ([8787ec1](https://github.com/LazyVim/LazyVim/commit/8787ec1227e10123ad7291cf916020d9a8626525)) +* **snacks:** added git diff keymap to pick hunks with leader-gd ([62cb4a4](https://github.com/LazyVim/LazyVim/commit/62cb4a465c490c7d41f7a3bf52fb0e222f2cf83b)) + + +### Bug Fixes + +* **markdown:** disable checkbox rendering since it's annoying to edit ([4f31bfa](https://github.com/LazyVim/LazyVim/commit/4f31bfab86402c819e5ea1e18b3c5d139628c864)) +* **snacks.picker:** fix mapping for `Recent (cwd)` ([#5407](https://github.com/LazyVim/LazyVim/issues/5407)) ([8307b0f](https://github.com/LazyVim/LazyVim/commit/8307b0fe506a38417f3b7835e2c4b43d9a970946)) +* **snacks.picker:** fix mapping for Projects for consistency ([#5433](https://github.com/LazyVim/LazyVim/issues/5433)) ([eb7b453](https://github.com/LazyVim/LazyVim/commit/eb7b453b48ab7e3008013e0edf2822f622111e97)) +* **snacks.picker:** respect lazyvim.config.kind_filter ([#5415](https://github.com/LazyVim/LazyVim/issues/5415)) ([df7426e](https://github.com/LazyVim/LazyVim/commit/df7426eefa79d5dfa2fcbe2f381abfb2cca70bad)) + + +### Performance Improvements + +* **java:** setting opts.dap_main to false to disable main class scan ([#5391](https://github.com/LazyVim/LazyVim/issues/5391)) ([66c3577](https://github.com/LazyVim/LazyVim/commit/66c3577bc779d31a7c2addd47de7cc6d215795ba)) + +## [14.7.0](https://github.com/LazyVim/LazyVim/compare/v14.6.1...v14.7.0) (2025-01-14) + + +### Features + +* **extras:** added extra for snacks picker ([#5368](https://github.com/LazyVim/LazyVim/issues/5368)) ([13044c2](https://github.com/LazyVim/LazyVim/commit/13044c298ed1837a2d938b64710528d359dc8407)) + +## [14.6.1](https://github.com/LazyVim/LazyVim/compare/v14.6.0...v14.6.1) (2025-01-08) + + +### Bug Fixes + +* **blink:** added new luasnip preset ([8d2d9a9](https://github.com/LazyVim/LazyVim/commit/8d2d9a9bd965aab0a752f24ec327d2f391a8406b)) +* **luasnip:** correctly remove duplicate snippets ([#5214](https://github.com/LazyVim/LazyVim/issues/5214)) ([05c3447](https://github.com/LazyVim/LazyVim/commit/05c3447558fa6eef7ae3c0d3e7ed1c281572274d)) +* **nlua:** debugger not responding ([#5319](https://github.com/LazyVim/LazyVim/issues/5319)) ([4e746d0](https://github.com/LazyVim/LazyVim/commit/4e746d0e5625662e1f121b39f63836b653ed728b)) + +## [14.6.0](https://github.com/LazyVim/LazyVim/compare/v14.5.0...v14.6.0) (2024-12-20) + + +### Features + +* **colorscheme:** add fzf integration to catppuccin ([#5175](https://github.com/LazyVim/LazyVim/issues/5175)) ([751803f](https://github.com/LazyVim/LazyVim/commit/751803f98bf3baaf7db1c1e2ddd28e082396124a)) +* **lualine:** add fzf extensions. ([#5203](https://github.com/LazyVim/LazyVim/issues/5203)) ([7a16a75](https://github.com/LazyVim/LazyVim/commit/7a16a752ba1fa535bb54d6492fb8df6c72ab8ba0)) + + +### Bug Fixes + +* **blink:** remove compatibility with 0.7.6 release ([#5212](https://github.com/LazyVim/LazyVim/issues/5212)) ([857f330](https://github.com/LazyVim/LazyVim/commit/857f330c2139c328cfce0251b11713dc179d6a81)) +* **codeium:** doesnt automatically load when `vim.g.ai_cmp` is set to false ([#5182](https://github.com/LazyVim/LazyVim/issues/5182)) ([b51279c](https://github.com/LazyVim/LazyVim/commit/b51279c6d727a09cd3d2bf3c9d0cf829810280bb)) +* **fzf:** fzf.lua compatible hidden scrollbar ([#5177](https://github.com/LazyVim/LazyVim/issues/5177)) ([3a79273](https://github.com/LazyVim/LazyVim/commit/3a79273f3c3bbd22bcdba795b7b8fe6a949db96e)) +* **luasnip:** use blink's luasnip source. Closes [#5211](https://github.com/LazyVim/LazyVim/issues/5211) ([86de9c9](https://github.com/LazyVim/LazyVim/commit/86de9c9e443572b0244ee9bbdcf5f10ecaabaf74)) + + +### Performance Improvements + +* **supermaven:** add lazy-loading ([#5183](https://github.com/LazyVim/LazyVim/issues/5183)) ([a3a28bf](https://github.com/LazyVim/LazyVim/commit/a3a28bf8e43f7239316942c2f2bac6e74b28586b)) + + +### Reverts + +* fix(fzf): fzf.lua compatible hidden scrollbar ([#5177](https://github.com/LazyVim/LazyVim/issues/5177)) ([c40692c](https://github.com/LazyVim/LazyVim/commit/c40692c1b0a95492eead8cc093972c634d54043b)) + ## [14.5.0](https://github.com/LazyVim/LazyVim/compare/v14.4.0...v14.5.0) (2024-12-17) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 4e391e96..50d40e8e 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 December 17 +*LazyVim.txt* For Neovim Last change: 2025 February 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 574e56af..cbe0a571 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "14.5.0" -- x-release-please-version +M.version = "14.9.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c618578b..3e3829d1 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -150,12 +150,12 @@ end if vim.fn.executable("lazygit") == 1 then map("n", "gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) map("n", "gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" }) - map("n", "gf", function() Snacks.lazygit.log_file() end, { desc = "Lazygit Current File History" }) - map("n", "gl", function() Snacks.lazygit.log({ cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" }) - map("n", "gL", function() Snacks.lazygit.log() end, { desc = "Lazygit Log (cwd)" }) + map("n", "gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" }) + map("n", "gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" }) + map("n", "gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" }) end -map("n", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) +map("n", "gb", function() Snacks.picker.git_log_line() end, { desc = "Git Blame Line" }) map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" }) map({"n", "x" }, "gY", function() Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false }) @@ -182,7 +182,6 @@ map("t", "", "close", { desc = "Hide Terminal" }) map("t", "", "close", { desc = "which_key_ignore" }) -- windows -map("n", "w", "", { desc = "Windows", remap = true }) map("n", "-", "s", { desc = "Split Window Below", remap = true }) map("n", "|", "v", { desc = "Split Window Right", remap = true }) map("n", "wd", "c", { desc = "Delete Window", remap = true }) diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 93a89668..fa611bf4 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -19,6 +19,7 @@ return { cmp = true, dashboard = true, flash = true, + fzf = true, grug_far = true, gitsigns = true, headlines = true, diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index f6a98605..95a1f7b9 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -397,4 +397,10 @@ return { return LazyVim.pick.want() == "telescope" end, }, + { + import = "lazyvim.plugins.extras.editor.snacks_picker", + enabled = function() + return LazyVim.pick.want() == "snacks" + end, + }, } diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua index d2d29a00..8d37d750 100644 --- a/lua/lazyvim/plugins/extras/ai/codeium.lua +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -4,6 +4,7 @@ return { { "Exafunction/codeium.nvim", cmd = "Codeium", + event = "InsertEnter", build = ":Codeium Auth", opts = { enable_cmp_source = vim.g.ai_cmp, diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 4651c689..4f1d54f2 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -5,11 +5,12 @@ return { "zbirenbaum/copilot.lua", cmd = "Copilot", build = ":Copilot auth", - event = "InsertEnter", + event = "BufReadPost", opts = { suggestion = { enabled = not vim.g.ai_cmp, auto_trigger = true, + hide_during_completion = vim.g.ai_cmp, keymap = { accept = false, -- handled by nvim-cmp / blink.cmp next = "", diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua index e491fd85..5d30f49c 100644 --- a/lua/lazyvim/plugins/extras/ai/supermaven.lua +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -1,6 +1,11 @@ return { { "supermaven-inc/supermaven-nvim", + event = "InsertEnter", + cmd = { + "SupermavenUseFree", + "SupermavenUsePro", + }, opts = { keymaps = { accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 139bf6c4..45e393e1 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -118,17 +118,6 @@ return { end end - --- NOTE: compat with latest version. Currenlty 0.7.6 - if not vim.g.lazyvim_blink_main then - ---@diagnostic disable-next-line: inject-field - opts.sources.completion = opts.sources.completion or {} - opts.sources.completion.enabled_providers = enabled - if vim.tbl_get(opts, "completion", "menu", "draw", "treesitter") then - ---@diagnostic disable-next-line: assign-type-mismatch - opts.completion.menu.draw.treesitter = true - end - end - -- Unset custom prop to pass blink.cmp validation opts.sources.compat = nil @@ -169,9 +158,7 @@ return { "saghen/blink.cmp", opts = function(_, opts) opts.appearance = opts.appearance or {} - opts.appearance.kind_icons = vim.tbl_extend("keep", { - Color = "██", -- Use block instead of icon for color items to make swatches more usable - }, LazyVim.config.icons.kinds) + opts.appearance.kind_icons = vim.tbl_extend("force", opts.appearance.kind_icons or {}, LazyVim.config.icons.kinds) end, }, diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua index 6b16ba90..85ed2fd5 100644 --- a/lua/lazyvim/plugins/extras/coding/luasnip.lua +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -30,7 +30,9 @@ return { opts = function() LazyVim.cmp.actions.snippet_forward = function() if require("luasnip").jumpable(1) then - require("luasnip").jump(1) + vim.schedule(function() + require("luasnip").jump(1) + end) return true end end @@ -67,25 +69,9 @@ return { { "saghen/blink.cmp", optional = true, - dependencies = { - { "saghen/blink.compat", opts = { impersonate_nvim_cmp = true } }, - { "saadparwaiz1/cmp_luasnip" }, - }, opts = { - sources = { compat = { "luasnip" } }, snippets = { - expand = function(snippet) - require("luasnip").lsp_expand(snippet) - end, - active = function(filter) - if filter and filter.direction then - return require("luasnip").jumpable(filter.direction) - end - return require("luasnip").in_snippet() - end, - jump = function(direction) - require("luasnip").jump(direction) - end, + preset = "luasnip", }, }, }, diff --git a/lua/lazyvim/plugins/extras/coding/mini-snippets.lua b/lua/lazyvim/plugins/extras/coding/mini-snippets.lua new file mode 100644 index 00000000..5ce82c80 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/mini-snippets.lua @@ -0,0 +1,167 @@ +if lazyvim_docs then + -- Set to `false` to prevent "non-lsp snippets"" from appearing inside completion windows + -- Motivation: Less clutter in completion windows and a more direct usage of snippits + vim.g.lazyvim_mini_snippets_in_completion = true + + -- NOTE: Please also read: + -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-snippets.md#expand + -- :h MiniSnippets-session + + -- Example override for your own config: + --[[ + return { + { + "echasnovski/mini.snippets", + opts = function(_, opts) + -- By default, for opts.snippets, the extra for mini.snippets only adds gen_loader.from_lang() + -- This provides a sensible quickstart, integrating with friendly-snippets + -- and your own language-specific snippets + -- + -- In order to change opts.snippets, replace the entire table inside your own opts + + local snippets, config_path = require("mini.snippets"), vim.fn.stdpath("config") + + opts.snippets = { -- override opts.snippets provided by extra... + -- Load custom file with global snippets first (order matters) + snippets.gen_loader.from_file(config_path .. "/snippets/global.json"), + + -- Load snippets based on current language by reading files from + -- "snippets/" subdirectories from 'runtimepath' directories. + snippets.gen_loader.from_lang(), -- this is the default in the extra... + } + end, + }, + } +--]] +end + +local include_in_completion = vim.g.lazyvim_mini_snippets_in_completion == nil + or vim.g.lazyvim_mini_snippets_in_completion + +local function expand_from_lsp(snippet) + local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert + insert({ body = snippet }) +end + +local function jump(direction) + local is_active = MiniSnippets.session.get(false) ~= nil + if is_active then + MiniSnippets.session.jump(direction) + return true + end +end + +---@type fun(snippets, insert) | nil +local expand_select_override = nil + +return { + -- disable builtin snippet support: + { "garymjr/nvim-snippets", optional = true, enabled = false }, + -- disable luasnip: + { "L3MON4D3/LuaSnip", optional = true, enabled = false }, + + -- add mini.snippets + desc = "Manage and expand snippets (alternative to Luasnip)", + { + "echasnovski/mini.snippets", + event = "InsertEnter", -- don't depend on other plugins to load... + dependencies = "rafamadriz/friendly-snippets", + opts = function() + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_stop = function() end -- by design, should not stop the session! + ---@diagnostic disable-next-line: duplicate-set-field + LazyVim.cmp.actions.snippet_forward = function() + return jump("next") + end + + local mini_snippets = require("mini.snippets") + return { + snippets = { mini_snippets.gen_loader.from_lang() }, + + -- Following the behavior of vim.snippets, + -- the intended usage of is to be able to temporarily exit into normal mode for quick edits. + -- + -- If you'd rather stop the snippet on , activate the line below in your own config: + -- mappings = { stop = "" }, -- by default, see :h MiniSnippets-session + + expand = { + select = function(snippets, insert) + -- Close completion window on snippet select - vim.ui.select + -- Needed to remove virtual text for fzf-lua and telescope, but not for mini.pick... + local select = expand_select_override or MiniSnippets.default_select + select(snippets, insert) + end, + }, + } + end, + }, + + -- nvim-cmp integration + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = include_in_completion and { "abeldekat/cmp-mini-snippets" } or nil, + opts = function(_, opts) + local cmp = require("cmp") + local cmp_config = require("cmp.config") + + opts.snippet = { + expand = function(args) + expand_from_lsp(args.body) + cmp.resubscribe({ "TextChangedI", "TextChangedP" }) + cmp_config.set_onetime({ sources = {} }) + end, + } + + if include_in_completion then + table.insert(opts.sources, { name = "mini_snippets" }) + else + expand_select_override = function(snippets, insert) + -- stylua: ignore + if cmp.visible() then cmp.close() end + MiniSnippets.default_select(snippets, insert) + end + end + end, + -- stylua: ignore + -- counterpart to defined in cmp.mappings + keys = include_in_completion and { { "", function() jump("prev") end, mode = "i" } } or nil, + }, + + -- blink.cmp integration + { + "saghen/blink.cmp", + optional = true, + opts = function(_, opts) + -- Return early + if include_in_completion then + opts.snippets = { preset = "mini_snippets" } + return + end + + -- Standalone -- + expand_select_override = function(snippets, insert) + -- Schedule, otherwise blink's virtual text is not removed on vim.ui.select + require("blink.cmp").cancel() + vim.schedule(function() + MiniSnippets.default_select(snippets, insert) + end) + end + -- + -- Blink performs a require on blink.cmp.sources.snippets.default + -- By removing the source, the default engine will not be used + opts.sources.default = vim.tbl_filter(function(source) + return source ~= "snippets" + end, opts.sources.default) + opts.snippets = { -- need to repeat blink's preset here + expand = expand_from_lsp, + active = function() + return MiniSnippets.session.get(false) ~= nil + end, + jump = function(direction) + jump(direction == -1 and "prev" or "next") + end, + } + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index a9f7bb26..602b747c 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -140,6 +140,11 @@ return { }), }, markdown = { + augend.constant.new({ + elements = { "[ ]", "[x]" }, + word = false, + cyclic = true, + }), augend.misc.alias.markdown_header, }, json = { diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index c70a6f14..d4cd4093 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -45,8 +45,9 @@ return { "ibhagwan/fzf-lua", cmd = "FzfLua", opts = function(_, opts) - local config = require("fzf-lua.config") - local actions = require("fzf-lua.actions") + local fzf = require("fzf-lua") + local config = fzf.config + local actions = fzf.actions -- Quickfix config.defaults.keymap.fzf["ctrl-q"] = "select-all+accept" @@ -285,6 +286,9 @@ return { { "neovim/nvim-lspconfig", opts = function() + if LazyVim.pick.want() ~= "fzf" then + return + end local Keys = require("lazyvim.plugins.lsp.keymaps").get() -- stylua: ignore vim.list_extend(Keys, { diff --git a/lua/lazyvim/plugins/extras/editor/snacks_explorer.lua b/lua/lazyvim/plugins/extras/editor/snacks_explorer.lua new file mode 100644 index 00000000..aa87e85c --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/snacks_explorer.lua @@ -0,0 +1,25 @@ +return { + { "nvim-neo-tree/neo-tree.nvim", enabled = false }, + { + "folke/snacks.nvim", + opts = { explorer = {} }, + keys = { + { + "fe", + function() + Snacks.explorer({ cwd = LazyVim.root() }) + end, + desc = "Explorer Snacks (root dir)", + }, + { + "fE", + function() + Snacks.explorer() + end, + desc = "Explorer Snacks (cwd)", + }, + { "e", "fe", desc = "Explorer Snacks (root dir)", remap = true }, + { "E", "fE", desc = "Explorer Snacks (cwd)", remap = true }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/editor/snacks_picker.lua b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua new file mode 100644 index 00000000..9685c369 --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua @@ -0,0 +1,201 @@ +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 = "snacks" +end + +---@module 'snacks' + +---@type LazyPicker +local picker = { + name = "snacks", + commands = { + files = "files", + live_grep = "grep", + oldfiles = "recent", + }, + + ---@param source string + ---@param opts? snacks.picker.Config + open = function(source, opts) + return Snacks.picker.pick(source, opts) + end, +} +if not LazyVim.pick.register(picker) then + return {} +end + +return { + desc = "Fast and modern file picker", + recommended = true, + { + "folke/snacks.nvim", + opts = { + picker = { + win = { + input = { + keys = { + [""] = { + "toggle_cwd", + mode = { "n", "i" }, + }, + }, + }, + }, + actions = { + ---@param p snacks.Picker + toggle_cwd = function(p) + local root = LazyVim.root({ buf = p.input.filter.current_buf, normalize = true }) + local cwd = vim.fs.normalize((vim.uv or vim.loop).cwd() or ".") + local current = p:cwd() + p:set_cwd(current == root and cwd or root) + p:find() + end, + }, + }, + }, + -- stylua: ignore + keys = { + { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "/", LazyVim.pick("grep"), desc = "Grep (Root Dir)" }, + { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, + { "", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, + -- find + { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "fB", function() Snacks.picker.buffers({ hidden = true, nofile = true }) end, desc = "Buffers (all)" }, + { "fc", LazyVim.pick.config_files(), desc = "Find Config File" }, + { "ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { "fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, + { "fg", function() Snacks.picker.git_files() end, desc = "Find Files (git-files)" }, + { "fr", LazyVim.pick("oldfiles"), desc = "Recent" }, + { "fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" }, + { "fp", function() Snacks.picker.projects() end, desc = "Projects" }, + -- git + { "gc", function() Snacks.picker.git_log() end, desc = "Git Log" }, + { "gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" }, + { "gs", function() Snacks.picker.git_status() end, desc = "Git Status" }, + -- Grep + { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, + { "sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" }, + { "sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { "sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, + { "sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" }, + { "sw", LazyVim.pick("grep_word"), desc = "Visual selection or word (Root Dir)", mode = { "n", "x" } }, + { "sW", LazyVim.pick("grep_word", { root = false }), desc = "Visual selection or word (cwd)", mode = { "n", "x" } }, + -- search + { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, + { "sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" }, + { "sc", function() Snacks.picker.command_history() end, desc = "Command History" }, + { "sC", function() Snacks.picker.commands() end, desc = "Commands" }, + { "sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, + { "sh", function() Snacks.picker.help() end, desc = "Help Pages" }, + { "sH", function() Snacks.picker.highlights() end, desc = "Highlights" }, + { "si", function() Snacks.picker.icons() end, desc = "Icons" }, + { "sj", function() Snacks.picker.jumps() end, desc = "Jumps" }, + { "sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, + { "sl", function() Snacks.picker.loclist() end, desc = "Location List" }, + { "sM", function() Snacks.picker.man() end, desc = "Man Pages" }, + { "sm", function() Snacks.picker.marks() end, desc = "Marks" }, + { "sR", function() Snacks.picker.resume() end, desc = "Resume" }, + { "sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" }, + { "su", function() Snacks.picker.undo() end, desc = "Undotree" }, + -- ui + { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, + }, + }, + { + "folke/snacks.nvim", + opts = function(_, opts) + if LazyVim.has("trouble.nvim") then + return vim.tbl_deep_extend("force", opts or {}, { + picker = { + actions = { + trouble_open = function(...) + return require("trouble.sources.snacks").actions.trouble_open.action(...) + end, + }, + win = { + input = { + keys = { + [""] = { + "trouble_open", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + }) + end + end, + }, + { + "neovim/nvim-lspconfig", + opts = function() + if LazyVim.pick.want() ~= "snacks" then + return + end + local Keys = require("lazyvim.plugins.lsp.keymaps").get() + -- stylua: ignore + vim.list_extend(Keys, { + { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", has = "definition" }, + { "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" }, + { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" }, + { "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" }, + { "ss", function() Snacks.picker.lsp_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Symbols", has = "documentSymbol" }, + { "sS", function() Snacks.picker.lsp_workspace_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Workspace Symbols", has = "workspace/symbols" }, + }) + end, + }, + { + "folke/todo-comments.nvim", + optional = true, + -- stylua: ignore + keys = { + { "st", function() Snacks.picker.todo_comments() end, desc = "Todo" }, + { "sT", function () Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" }, + }, + }, + { + "folke/flash.nvim", + optional = true, + specs = { + { + "folke/snacks.nvim", + opts = { + picker = { + win = { + input = { + keys = { + [""] = { "flash", mode = { "n", "i" } }, + ["s"] = { "flash" }, + }, + }, + }, + actions = { + flash = function(picker) + require("flash").jump({ + pattern = "^", + label = { after = { 0, 0 } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list" + end, + }, + }, + action = function(match) + local idx = picker.list:row2idx(match.pos[1]) + picker.list:_move(idx, true, true) + end, + }) + end, + }, + }, + }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 520776fe..236c86c9 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -130,6 +130,7 @@ return { -- These depend on nvim-dap, but can additionally be disabled by setting false here. dap = { hotcodereplace = "auto", config_overrides = {} }, + -- Can set this to false to disable main class scan, which is a performance killer for large project dap_main = {}, test = true, settings = { @@ -246,7 +247,9 @@ return { if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then -- custom init for Java debugger require("jdtls").setup_dap(opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + if opts.dap_main then + require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + end -- Java Test require Java debugger to work if opts.test and mason_registry.is_installed("java-test") then diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index e7977cb5..8b07985b 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -104,8 +104,11 @@ return { sign = false, icons = {}, }, + checkbox = { + enabled = false, + }, }, - ft = { "markdown", "norg", "rmd", "org" }, + ft = { "markdown", "norg", "rmd", "org", "codecompanion" }, config = function(_, opts) require("render-markdown").setup(opts) Snacks.toggle({ diff --git a/lua/lazyvim/plugins/extras/lang/sql.lua b/lua/lazyvim/plugins/extras/lang/sql.lua index 075182d6..83de5ee1 100644 --- a/lua/lazyvim/plugins/extras/lang/sql.lua +++ b/lua/lazyvim/plugins/extras/lang/sql.lua @@ -48,7 +48,7 @@ return { vim.api.nvim_create_autocmd("FileType", { pattern = sql_ft, callback = function() - if LazyVim.has("nvim-cmp") then + if LazyVim.cmp_engine() == "nvim-cmp" then local cmp = require("cmp") -- global sources diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 633f3008..cffa6749 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -19,6 +19,38 @@ local pick_chezmoi = function() }, } fzf_lua.fzf_exec(results, opts) + elseif LazyVim.pick.picker.name == "snacks" then + local results = require("chezmoi.commands").list({ + args = { + "--path-style", + "absolute", + "--include", + "files", + "--exclude", + "externals", + }, + }) + local items = {} + + for _, czFile in ipairs(results) do + table.insert(items, { + text = czFile, + file = czFile, + }) + end + + ---@type snacks.picker.Config + local opts = { + items = items, + confirm = function(picker, item) + picker:close() + require("chezmoi.commands").edit({ + targets = { item.text }, + args = { "--watch" }, + }) + end, + } + Snacks.picker.pick(opts) end end diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index b9b1e0b1..5115a2b4 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -57,9 +57,14 @@ return { { "snacks.nvim", opts = { + bigfile = { enabled = false }, + dashboard = { enabled = false }, indent = { enabled = false }, - scroll = { enabled = false }, + input = { enabled = false }, notifier = { enabled = false }, + picker = { enabled = false }, + quickfile = { enabled = false }, + scroll = { enabled = false }, statuscolumn = { enabled = false }, }, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 2bb2c644..0669054d 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -37,6 +37,9 @@ return { highlight = "Directory", text_align = "left", }, + { + filetype = "snacks_layout_box", + }, }, ---@param opts bufferline.IconFetcherOpts get_element_icon = function(opts) @@ -159,7 +162,7 @@ return { end, }, }, - extensions = { "neo-tree", "lazy" }, + extensions = { "neo-tree", "lazy", "fzf" }, } -- do not add trouble symbols if aerial is enabled @@ -278,7 +281,13 @@ return { }, -- stylua: ignore keys = { - { "n", function() Snacks.notifier.show_history() end, desc = "Notification History" }, + { "n", function() + if Snacks.config.picker and Snacks.config.picker.enabled then + Snacks.picker.notifications() + else + Snacks.notifier.show_history() + end + end, desc = "Notification History" }, { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, }, }, @@ -288,6 +297,9 @@ return { opts = { dashboard = { preset = { + pick = function(cmd, opts) + return LazyVim.pick(cmd, opts)() + end, header = [[ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z @@ -313,4 +325,18 @@ return { }, }, }, + { + "folke/snacks.nvim", + opts = function(_, opts) + if not opts.picker then + return + end + table.insert(opts.dashboard.preset.keys, 3, { + icon = " ", + key = "p", + desc = "Projects", + action = ":lua Snacks.picker.projects()", + }) + end, + }, } diff --git a/lua/lazyvim/util/pick.lua b/lua/lazyvim/util/pick.lua index 526025a3..2736d7a5 100644 --- a/lua/lazyvim/util/pick.lua +++ b/lua/lazyvim/util/pick.lua @@ -42,11 +42,13 @@ function M.register(picker) return true end ----@return "telescope" | "fzf" +---@return "telescope" | "fzf" | "snacks" 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.telescope") and "telescope" or "fzf" + return LazyVim.has_extra("editor.snacks_picker") and "snacks" + or LazyVim.has_extra("editor.telescope") and "telescope" + or "fzf" end return vim.g.lazyvim_picker end diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index b723b227..fc6d6d7d 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -1,8 +1,8 @@ ---@class lazyvim.util.root ---@overload fun(): string local M = setmetatable({}, { - __call = function(m) - return m.get() + __call = function(m, ...) + return m.get(...) end, })