From 4ee6be4499008db458089fb2573b13f6b5ec5d3b Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Fri, 1 Nov 2024 23:47:03 +0200 Subject: [PATCH 01/77] fix(lazygit): file history when cwd is outside the repo (#4666) ## Description When using `gf` Lazygit is launched in the current directory rather than the root directory. ## Related Issue(s) ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/keymaps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 84bba42c..cc226964 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -137,7 +137,7 @@ map("n", "gB", LazyVim.lazygit.browse, { desc = "Git Browse" }) map("n", "gf", function() local git_path = vim.api.nvim_buf_get_name(0) - LazyVim.lazygit({args = { "-f", vim.trim(git_path) }}) + LazyVim.lazygit({args = { "-f", vim.trim(git_path) }, cwd = LazyVim.root.git()}) end, { desc = "Lazygit Current File History" }) map("n", "gl", function() From f11890bf99477898f9c003502397786026ba4287 Mon Sep 17 00:00:00 2001 From: folke Date: Fri, 1 Nov 2024 21:48:00 +0000 Subject: [PATCH 02/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index c31bcadf..44cbcbc9 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 October 24 +*LazyVim.txt* For Neovim Last change: 2024 November 01 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 1d3d64fd1ae26581b71f39091c816e568b7a3b39 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 09:46:34 +0100 Subject: [PATCH 03/77] fix(rust): disable rust_analyzer in the rust extra. Fixes #4685 --- lua/lazyvim/plugins/extras/lang/rust.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 145940ca..b8eb4a23 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -95,6 +95,7 @@ return { "neovim/nvim-lspconfig", opts = { servers = { + rust_analyzer = { enabled = false }, taplo = { keys = { { From a66b44a9fe0031c85a536f13f84582a6ba7c3f82 Mon Sep 17 00:00:00 2001 From: folke Date: Sat, 2 Nov 2024 08:48:22 +0000 Subject: [PATCH 04/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 44cbcbc9..5f4566f4 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 01 +*LazyVim.txt* For Neovim Last change: 2024 November 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* From ad52bf91bc8f1821bbb0b7218d03768eec9a9e42 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 09:54:55 +0100 Subject: [PATCH 05/77] feat(extras): blink (#4680) ## Description Extra to use [blink.cmp](https://github.com/Saghen/blink.cmp) instead of **nvim-cmp**. ## Todo - [x] tokyonight suport - [x] basic integration - [ ] check / update all cmp sources - [ ] copilot and others integration - [x] native lazydev source ## Limitations There's no copilot source, so instead when enabling both blink and copilot: - blink ghost text is disabled - copilot suggestions are enabled - use `` to navigate snippets and accept copilot completions ## Related Issue(s) - https://github.com/LazyVim/LazyVim/discussions/4679 --- lua/lazyvim/plugins/extras/coding/blink.lua | 96 +++++++++++++++++++ lua/lazyvim/plugins/extras/coding/copilot.lua | 40 ++++++++ lua/lazyvim/plugins/lsp/init.lua | 2 + lua/lazyvim/plugins/xtras.lua | 1 + lua/lazyvim/util/cmp.lua | 10 +- 5 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 lua/lazyvim/plugins/extras/coding/blink.lua diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua new file mode 100644 index 00000000..e571fc10 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -0,0 +1,96 @@ +return { + { + "hrsh7th/nvim-cmp", + enabled = false, + }, + { + "saghen/blink.cmp", + -- TODO: use release version + -- version = "*", + opts_extend = { "sources.completion.enabled_providers" }, + dependencies = { + "rafamadriz/friendly-snippets", + -- add blink.compat to dependencies + -- { "saghen/blink.compat", opts = {} }, + }, + event = "InsertEnter", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + fuzzy = { + prebuilt_binaries = { + download = true, + force_version = "v0.5.0", + }, + }, + highlight = { + -- sets the fallback highlight groups to nvim-cmp's highlight groups + -- useful for when your theme doesn't support blink.cmp + -- will be removed in a future release, assuming themes add support + use_nvim_cmp_as_default = false, + }, + -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + windows = { + autocomplete = { + draw = "reversed", + }, + documentation = { + auto_show = true, + }, + ghost_text = { + enabled = true, + }, + }, + + -- experimental auto-brackets support + accept = { auto_brackets = { enabled = true } }, + + -- experimental signature help support + -- trigger = { signature_help = { enabled = true } } + sources = { + completion = { + -- remember to enable your providers here + enabled_providers = { "lsp", "path", "snippets", "buffer" }, + }, + }, + + keymap = { + preset = "enter", + }, + }, + }, + + -- add icons + { + "saghen/blink.cmp", + opts = function(_, opts) + opts.kind_icons = LazyVim.config.icons.kinds + end, + }, + + -- lazydev + { + "saghen/blink.cmp", + opts = { + sources = { + completion = { + -- add lazydev to your completion providers + enabled_providers = { "lazydev" }, + }, + providers = { + lsp = { + -- dont show LuaLS require statements when lazydev has items + fallback_for = { "lazydev" }, + }, + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + }, + }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 8f0680ea..4d737379 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -80,4 +80,44 @@ return { }) end, }, + + { + "saghen/blink.cmp", + optional = true, + specs = { + { + "zbirenbaum/copilot.lua", + event = "InsertEnter", + opts = { + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { accept = false }, + }, + }, + }, + }, + opts = { + windows = { + ghost_text = { + enabled = false, + }, + }, + keymap = { + [""] = { + function(cmp) + if cmp.is_in_snippet() then + return cmp.accept() + elseif require("copilot.suggestion").is_visible() then + require("copilot.suggestion").accept() + else + return cmp.select_and_accept() + end + end, + "snippet_forward", + "fallback", + }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 076344dd..3e8bc8b7 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -184,11 +184,13 @@ return { local servers = opts.servers local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + local has_blink, blink = pcall(require, "blink.cmp") local capabilities = vim.tbl_deep_extend( "force", {}, vim.lsp.protocol.make_client_capabilities(), has_cmp and cmp_nvim_lsp.default_capabilities() or {}, + has_blink and blink.get_lsp_capabilities() or {}, opts.capabilities or {} ) diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 0527dde5..c2b52cb6 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -4,6 +4,7 @@ local prios = { ["lazyvim.plugins.extras.dap.core"] = 1, ["lazyvim.plugins.extras.ui.edgy"] = 2, ["lazyvim.plugins.extras.lang.typescript"] = 5, + ["lazyvim.plugins.extras.coding.blink"] = 5, ["lazyvim.plugins.extras.formatting.prettier"] = 10, -- default priority is 50 ["lazyvim.plugins.extras.editor.aerial"] = 100, diff --git a/lua/lazyvim/util/cmp.lua b/lua/lazyvim/util/cmp.lua index 8cb3d1bc..5eff81fa 100644 --- a/lua/lazyvim/util/cmp.lua +++ b/lua/lazyvim/util/cmp.lua @@ -71,9 +71,17 @@ function M.add_missing_snippet_docs(window) end function M.visible() + ---@module 'blink.cmp' + local blink = package.loaded["blink.cmp"] + if blink then + return blink.windows and blink.windows.autocomplete.win:is_open() + end ---@module 'cmp' local cmp = package.loaded["cmp"] - return cmp and cmp.core.view:visible() + if cmp then + return cmp.core.view:visible() + end + return false end -- This is a better implementation of `cmp.confirm`: From db8895b518278331fb73bbd81975cbe5012c8f71 Mon Sep 17 00:00:00 2001 From: Stefan Boca <45266795+stefanboca@users.noreply.github.com> Date: Sat, 2 Nov 2024 02:02:23 -0700 Subject: [PATCH 06/77] feat(extras): enable crates.nvim in-process lsp server (#4684) ## Description Rather than manually handling hover and completions through nvim-cmp and nvim-lspconfig, enable the crates.nvim in-process lsp server. This also allows crates.nvim to provide code actions. ## Related Issue(s) This change also removes the direct dependency on nvim-cmp, which should help with #4680 ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/rust.lua | 44 +++++++----------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index b8eb4a23..583981d4 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -6,26 +6,23 @@ return { }) end, - -- Extend auto completion + -- LSP for Cargo.toml { - "hrsh7th/nvim-cmp", - optional = true, - dependencies = { - { - "Saecki/crates.nvim", - event = { "BufRead Cargo.toml" }, - opts = { - completion = { - cmp = { enabled = true }, - }, + "Saecki/crates.nvim", + event = { "BufRead Cargo.toml" }, + opts = { + completion = { + crates = { + enabled = true, }, }, + lsp = { + enabled = true, + actions = true, + completion = true, + hover = true, + }, }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - opts.sources = opts.sources or {} - table.insert(opts.sources, { name = "crates" }) - end, }, -- Add Rust & related to treesitter @@ -96,21 +93,6 @@ return { opts = { servers = { rust_analyzer = { enabled = false }, - taplo = { - keys = { - { - "K", - function() - if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then - require("crates").show_popup() - else - vim.lsp.buf.hover() - end - end, - desc = "Show Crate Documentation", - }, - }, - }, }, }, }, From 6e1d0994d99e63a46c3eff737c44ca47e3ecbe28 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 17:41:38 +0100 Subject: [PATCH 07/77] fix(copilot): create undo point before accepting copilot suggestion when using blink --- lua/lazyvim/plugins/extras/coding/copilot.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 4d737379..9d9c6aa0 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -109,6 +109,7 @@ return { if cmp.is_in_snippet() then return cmp.accept() elseif require("copilot.suggestion").is_visible() then + LazyVim.create_undo() require("copilot.suggestion").accept() else return cmp.select_and_accept() From 28da1eb073f99abda9ea9b2349e5d8b8087ffcce Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 17:41:55 +0100 Subject: [PATCH 08/77] feat(blink): use vim.o.pumblend as winblend option for autocomplete menu in blink --- lua/lazyvim/plugins/extras/coding/blink.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index e571fc10..73ca4638 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -36,6 +36,7 @@ return { windows = { autocomplete = { draw = "reversed", + winblend = vim.o.pumblend, }, documentation = { auto_show = true, From ec616a3cecaf1e5de1687223575ff019ad688e55 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 18:12:31 +0100 Subject: [PATCH 09/77] fix(blink): explicetely set version=false for now --- lua/lazyvim/plugins/extras/coding/blink.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 73ca4638..8d1076b3 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -7,6 +7,7 @@ return { "saghen/blink.cmp", -- TODO: use release version -- version = "*", + version = false, opts_extend = { "sources.completion.enabled_providers" }, dependencies = { "rafamadriz/friendly-snippets", From a7b4c4391bccc894f56847ead7abe4ae7a8e4fc0 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 2 Nov 2024 18:51:04 +0100 Subject: [PATCH 10/77] fix(autocmds): `vim.highlight` is deprecated --- lua/lazyvim/config/autocmds.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 6fe6b139..e301bc1e 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -18,7 +18,7 @@ vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { vim.api.nvim_create_autocmd("TextYankPost", { group = augroup("highlight_yank"), callback = function() - vim.highlight.on_yank() + (vim.hl or vim.highlight).on_yank() end, }) From 29dab35619bf6a3aafe7d71904fb31452bdd23a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 3 Nov 2024 00:15:26 +0100 Subject: [PATCH 11/77] chore(main): release 12.44.0 (#4635) :robot: I have created a release *beep* *boop* --- ## [12.44.0](https://github.com/LazyVim/LazyVim/compare/v12.43.0...v12.44.0) (2024-11-02) ### Features * **blink:** use vim.o.pumblend as winblend option for autocomplete menu in blink ([28da1eb](https://github.com/LazyVim/LazyVim/commit/28da1eb073f99abda9ea9b2349e5d8b8087ffcce)) * **extras:** blink ([#4680](https://github.com/LazyVim/LazyVim/issues/4680)) ([ad52bf9](https://github.com/LazyVim/LazyVim/commit/ad52bf91bc8f1821bbb0b7218d03768eec9a9e42)) * **extras:** enable crates.nvim in-process lsp server ([#4684](https://github.com/LazyVim/LazyVim/issues/4684)) ([db8895b](https://github.com/LazyVim/LazyVim/commit/db8895b518278331fb73bbd81975cbe5012c8f71)) ### Bug Fixes * **autocmds:** `vim.highlight` is deprecated ([a7b4c43](https://github.com/LazyVim/LazyVim/commit/a7b4c4391bccc894f56847ead7abe4ae7a8e4fc0)) * **autocmds:** change mapping for `lazyvim_close_with_q` ([#4638](https://github.com/LazyVim/LazyVim/issues/4638)) ([5f432d9](https://github.com/LazyVim/LazyVim/commit/5f432d997e397790cea39d9bb8826c1d4ca14afb)) * **autocmds:** close window and force delete buf on q. See [#4638](https://github.com/LazyVim/LazyVim/issues/4638) ([cb40a09](https://github.com/LazyVim/LazyVim/commit/cb40a09538dc0c417a7ffbbacdbdec90be4a792c)) * **autocmds:** force close buffers with q. See [#4638](https://github.com/LazyVim/LazyVim/issues/4638) ([0eb4009](https://github.com/LazyVim/LazyVim/commit/0eb400908d17f4116f02c6464d7ef81456ca303c)) * **blink:** explicetely set version=false for now ([ec616a3](https://github.com/LazyVim/LazyVim/commit/ec616a3cecaf1e5de1687223575ff019ad688e55)) * **catppuccin:** fix bufferline integration when no colorscheme is set. Closes [#4641](https://github.com/LazyVim/LazyVim/issues/4641) ([6570a14](https://github.com/LazyVim/LazyVim/commit/6570a141c0de30fccee38e2b10dcd14830624e16)) * **copilot:** create undo point before accepting copilot suggestion when using blink ([6e1d099](https://github.com/LazyVim/LazyVim/commit/6e1d0994d99e63a46c3eff737c44ca47e3ecbe28)) * **dap:** remove explicit `load_launchjs` call ([#4634](https://github.com/LazyVim/LazyVim/issues/4634)) ([2f6c1f6](https://github.com/LazyVim/LazyVim/commit/2f6c1f60834108359b3404748453a65843909a03)) * **lazygit:** file history when cwd is outside the repo ([#4666](https://github.com/LazyVim/LazyVim/issues/4666)) ([4ee6be4](https://github.com/LazyVim/LazyVim/commit/4ee6be4499008db458089fb2573b13f6b5ec5d3b)) * **rust:** disable rust_analyzer in the rust extra. Fixes [#4685](https://github.com/LazyVim/LazyVim/issues/4685) ([1d3d64f](https://github.com/LazyVim/LazyVim/commit/1d3d64fd1ae26581b71f39091c816e568b7a3b39)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/.release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 3d20ea43..e2b3ecea 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.43.0" + ".": "12.44.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index df0deeba..5e0dd3b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## [12.44.0](https://github.com/LazyVim/LazyVim/compare/v12.43.0...v12.44.0) (2024-11-02) + + +### Features + +* **blink:** use vim.o.pumblend as winblend option for autocomplete menu in blink ([28da1eb](https://github.com/LazyVim/LazyVim/commit/28da1eb073f99abda9ea9b2349e5d8b8087ffcce)) +* **extras:** blink ([#4680](https://github.com/LazyVim/LazyVim/issues/4680)) ([ad52bf9](https://github.com/LazyVim/LazyVim/commit/ad52bf91bc8f1821bbb0b7218d03768eec9a9e42)) +* **extras:** enable crates.nvim in-process lsp server ([#4684](https://github.com/LazyVim/LazyVim/issues/4684)) ([db8895b](https://github.com/LazyVim/LazyVim/commit/db8895b518278331fb73bbd81975cbe5012c8f71)) + + +### Bug Fixes + +* **autocmds:** `vim.highlight` is deprecated ([a7b4c43](https://github.com/LazyVim/LazyVim/commit/a7b4c4391bccc894f56847ead7abe4ae7a8e4fc0)) +* **autocmds:** change mapping for `lazyvim_close_with_q` ([#4638](https://github.com/LazyVim/LazyVim/issues/4638)) ([5f432d9](https://github.com/LazyVim/LazyVim/commit/5f432d997e397790cea39d9bb8826c1d4ca14afb)) +* **autocmds:** close window and force delete buf on q. See [#4638](https://github.com/LazyVim/LazyVim/issues/4638) ([cb40a09](https://github.com/LazyVim/LazyVim/commit/cb40a09538dc0c417a7ffbbacdbdec90be4a792c)) +* **autocmds:** force close buffers with q. See [#4638](https://github.com/LazyVim/LazyVim/issues/4638) ([0eb4009](https://github.com/LazyVim/LazyVim/commit/0eb400908d17f4116f02c6464d7ef81456ca303c)) +* **blink:** explicetely set version=false for now ([ec616a3](https://github.com/LazyVim/LazyVim/commit/ec616a3cecaf1e5de1687223575ff019ad688e55)) +* **catppuccin:** fix bufferline integration when no colorscheme is set. Closes [#4641](https://github.com/LazyVim/LazyVim/issues/4641) ([6570a14](https://github.com/LazyVim/LazyVim/commit/6570a141c0de30fccee38e2b10dcd14830624e16)) +* **copilot:** create undo point before accepting copilot suggestion when using blink ([6e1d099](https://github.com/LazyVim/LazyVim/commit/6e1d0994d99e63a46c3eff737c44ca47e3ecbe28)) +* **dap:** remove explicit `load_launchjs` call ([#4634](https://github.com/LazyVim/LazyVim/issues/4634)) ([2f6c1f6](https://github.com/LazyVim/LazyVim/commit/2f6c1f60834108359b3404748453a65843909a03)) +* **lazygit:** file history when cwd is outside the repo ([#4666](https://github.com/LazyVim/LazyVim/issues/4666)) ([4ee6be4](https://github.com/LazyVim/LazyVim/commit/4ee6be4499008db458089fb2573b13f6b5ec5d3b)) +* **rust:** disable rust_analyzer in the rust extra. Fixes [#4685](https://github.com/LazyVim/LazyVim/issues/4685) ([1d3d64f](https://github.com/LazyVim/LazyVim/commit/1d3d64fd1ae26581b71f39091c816e568b7a3b39)) + ## [12.43.0](https://github.com/LazyVim/LazyVim/compare/v12.42.0...v12.43.0) (2024-10-23) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 70b54722..b03a3d01 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 = "12.43.0" -- x-release-please-version +M.version = "12.44.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions From 0403e80a8e6250130fe94af1034a6f0760a24ca8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 3 Nov 2024 12:48:11 +0100 Subject: [PATCH 12/77] fix(java): jdtls run with args (#4689) ## Description Makes run with args work for jdtls ## Related Issue(s) - Closes #4686 - Closes #4673 --- lua/lazyvim/plugins/extras/dap/core.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index ac6709f1..a605052c 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -1,11 +1,17 @@ ----@param config {args?:string[]|fun():string[]?} +---@param config {type?:string, args?:string[]|fun():string[]?} local function get_args(config) - local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} --[[@as string[] | string ]] + local args_str = type(args) == "table" and table.concat(args, " ") or args --[[@as string]] + config = vim.deepcopy(config) ---@cast args string[] config.args = function() - local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] - return vim.split(vim.fn.expand(new_args) --[[@as string]], " ") + local new_args = vim.fn.expand(vim.fn.input("Run with args: ", args_str)) + if config.type and config.type == "java" then + ---@diagnostic disable-next-line: return-type-mismatch + return new_args + end + return vim.split(new_args, " ") end return config end From f4d78ac0de8fd4c9237516df8ef93974a29cb6fb Mon Sep 17 00:00:00 2001 From: folke Date: Sun, 3 Nov 2024 11:49:08 +0000 Subject: [PATCH 13/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 5f4566f4..301c542c 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 02 +*LazyVim.txt* For Neovim Last change: 2024 November 03 ============================================================================== Table of Contents *LazyVim-table-of-contents* From fa3739678af494b8657d68ddc44bcc598f9bd00a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 3 Nov 2024 12:53:08 +0100 Subject: [PATCH 14/77] fix(copilot): properly process tab with copilot and blink. Fixes #4692 --- lua/lazyvim/plugins/extras/coding/copilot.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 9d9c6aa0..22ba0c64 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -111,6 +111,7 @@ return { elseif require("copilot.suggestion").is_visible() then LazyVim.create_undo() require("copilot.suggestion").accept() + return true else return cmp.select_and_accept() end From 7ebed5349d49dd9996d61155bc12605871058ec1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 3 Nov 2024 15:26:45 +0100 Subject: [PATCH 15/77] fix(blink): use release version --- lua/lazyvim/plugins/extras/coding/blink.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 8d1076b3..e6d4e29b 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -5,9 +5,7 @@ return { }, { "saghen/blink.cmp", - -- TODO: use release version - -- version = "*", - version = false, + version = "*", opts_extend = { "sources.completion.enabled_providers" }, dependencies = { "rafamadriz/friendly-snippets", @@ -19,12 +17,6 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - fuzzy = { - prebuilt_binaries = { - download = true, - force_version = "v0.5.0", - }, - }, highlight = { -- sets the fallback highlight groups to nvim-cmp's highlight groups -- useful for when your theme doesn't support blink.cmp From 73f14943bac5830905d715804ca581a91844272a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:55:25 +0100 Subject: [PATCH 16/77] chore(main): release 12.44.1 (#4694) :robot: I have created a release *beep* *boop* --- ## [12.44.1](https://github.com/LazyVim/LazyVim/compare/v12.44.0...v12.44.1) (2024-11-03) ### Bug Fixes * **blink:** use release version ([7ebed53](https://github.com/LazyVim/LazyVim/commit/7ebed5349d49dd9996d61155bc12605871058ec1)) * **copilot:** properly process tab with copilot and blink. Fixes [#4692](https://github.com/LazyVim/LazyVim/issues/4692) ([fa37396](https://github.com/LazyVim/LazyVim/commit/fa3739678af494b8657d68ddc44bcc598f9bd00a)) * **java:** jdtls run with args ([#4689](https://github.com/LazyVim/LazyVim/issues/4689)) ([0403e80](https://github.com/LazyVim/LazyVim/commit/0403e80a8e6250130fe94af1034a6f0760a24ca8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/.release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ lua/lazyvim/config/init.lua | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index e2b3ecea..eac7e537 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.44.0" + ".": "12.44.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e0dd3b9..8c5fc58f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [12.44.1](https://github.com/LazyVim/LazyVim/compare/v12.44.0...v12.44.1) (2024-11-03) + + +### Bug Fixes + +* **blink:** use release version ([7ebed53](https://github.com/LazyVim/LazyVim/commit/7ebed5349d49dd9996d61155bc12605871058ec1)) +* **copilot:** properly process tab with copilot and blink. Fixes [#4692](https://github.com/LazyVim/LazyVim/issues/4692) ([fa37396](https://github.com/LazyVim/LazyVim/commit/fa3739678af494b8657d68ddc44bcc598f9bd00a)) +* **java:** jdtls run with args ([#4689](https://github.com/LazyVim/LazyVim/issues/4689)) ([0403e80](https://github.com/LazyVim/LazyVim/commit/0403e80a8e6250130fe94af1034a6f0760a24ca8)) + ## [12.44.0](https://github.com/LazyVim/LazyVim/compare/v12.43.0...v12.44.0) (2024-11-02) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index b03a3d01..f1a8cf21 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 = "12.44.0" -- x-release-please-version +M.version = "12.44.1" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions From 75750be1c0493659c9fbc60ff5e06dba053ef528 Mon Sep 17 00:00:00 2001 From: folke Date: Mon, 4 Nov 2024 11:56:40 +0000 Subject: [PATCH 17/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 301c542c..b66d2ea3 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 03 +*LazyVim.txt* For Neovim Last change: 2024 November 04 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 2f4697443c0186663ba4421bd4b856e36c3bd7cc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 15:54:47 +0100 Subject: [PATCH 18/77] feat(core)!: move a bunch of LazyVim features to snacks.nvim (#4706) ## Description LazyVim comes with a bunch of smaller QoL plugin like features, but it's not easy for non LazyVim users to use them. That's why I started working on [snacks.nvim](https://github.com/folke/snacks.nvim), a collection of small QoL plugins for Neovim. Snacks also includes a bunch of new improvements to these features. This PR fully integrates with snacks. ## Todo - [ ] add proper deprecations where needed - [ ] create snacks docs - [ ] document all the new improvements relevant to LazyVim users ## Closes - [ ] #4492 - [ ] #4333 - [ ] #4687 ## Screenshots ## Checklist - [ ] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- NEWS.md | 14 ++ lua/lazyvim/config/autocmds.lua | 40 +-- lua/lazyvim/config/keymaps.lua | 65 ++--- lua/lazyvim/config/options.lua | 1 - lua/lazyvim/plugins/coding.lua | 1 + lua/lazyvim/plugins/editor.lua | 2 +- .../plugins/extras/editor/mini-files.lua | 2 +- lua/lazyvim/plugins/extras/lang/markdown.lua | 4 +- lua/lazyvim/plugins/extras/ui/edgy.lua | 25 +- .../plugins/extras/ui/mini-animate.lua | 4 +- .../plugins/extras/ui/mini-indentscope.lua | 6 +- .../plugins/extras/ui/treesitter-context.lua | 6 +- lua/lazyvim/plugins/extras/util/gitui.lua | 4 +- lua/lazyvim/plugins/init.lua | 41 ++++ lua/lazyvim/plugins/lsp/init.lua | 2 - lua/lazyvim/plugins/lsp/keymaps.lua | 18 +- lua/lazyvim/plugins/ui.lua | 55 +---- lua/lazyvim/util/deprecated.lua | 59 +++++ lua/lazyvim/util/format.lua | 16 ++ lua/lazyvim/util/init.lua | 27 +- lua/lazyvim/util/lazygit.lua | 231 ------------------ lua/lazyvim/util/lsp.lua | 133 ---------- lua/lazyvim/util/mini.lua | 5 +- lua/lazyvim/util/news.lua | 24 +- lua/lazyvim/util/plugin.lua | 25 -- lua/lazyvim/util/terminal.lua | 64 +---- lua/lazyvim/util/toggle.lua | 210 ---------------- lua/lazyvim/util/ui.lua | 217 +++------------- tests/util/lazygit_spec.lua | 42 ---- 29 files changed, 277 insertions(+), 1066 deletions(-) create mode 100644 lua/lazyvim/util/deprecated.lua delete mode 100644 lua/lazyvim/util/lazygit.lua delete mode 100644 lua/lazyvim/util/toggle.lua delete mode 100644 tests/util/lazygit_spec.lua diff --git a/NEWS.md b/NEWS.md index 20b6156b..b2bb693b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,19 @@ # What's new? +## 13.x + +- Big new release with a lot of changes and improvements! + +- The biggest change is the move of a bunch of core features to + [snacks.nvim](https://github.com/folke/snacks.nvim) and fully + integrating it into **LazyVim**. + +- I highly suggest having a look at the **snacks.nvim** documentation + to see all the new features and improvements. Most important changes: + - `Snacks.notifier` for notifications instead of `nvim-notify` + - `Snacks.terminal` is similar to `lazyterm`, but has more features + and creates bottom splits by default (similar to the `edgy` integrating) + ## 12.x - **Markdown Extra**: [headlines.nvim](https://github.com/lukas-reineke/headlines.nvim) has been removed in favor of [markdown.nvim](https://github.com/MeanderingProgrammer/markdown.nvim) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index e301bc1e..0a6d92e3 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -55,20 +55,22 @@ vim.api.nvim_create_autocmd("FileType", { group = augroup("close_with_q"), pattern = { "PlenaryTestPopup", + "checkhealth", + "dbout", + "gitsigns-blame", "grug-far", "help", "lspinfo", + "neotest-output", + "neotest-output-panel", + "neotest-summary", "notify", "qf", + "snacks_win", + "snacks_notif", "spectre_panel", "startuptime", "tsplayground", - "neotest-output", - "checkhealth", - "neotest-summary", - "neotest-output-panel", - "dbout", - "gitsigns-blame", }, callback = function(event) vim.bo[event.buf].buflisted = false @@ -124,29 +126,3 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") end, }) - -vim.filetype.add({ - pattern = { - [".*"] = { - function(path, buf) - return vim.bo[buf] - and vim.bo[buf].filetype ~= "bigfile" - and path - and vim.fn.getfsize(path) > vim.g.bigfile_size - and "bigfile" - or nil - end, - }, - }, -}) - -vim.api.nvim_create_autocmd({ "FileType" }, { - group = augroup("bigfile"), - pattern = "bigfile", - callback = function(ev) - vim.b.minianimate_disable = true - vim.schedule(function() - vim.bo[ev.buf].syntax = vim.filetype.match({ buf = ev.buf }) or "" - end) - end, -}) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index cc226964..422cadd2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -37,7 +37,9 @@ 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" }) -map("n", "bd", LazyVim.ui.bufremove, { desc = "Delete Buffer" }) +map("n", "bd", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) -- Clear search with @@ -115,37 +117,28 @@ map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) -- stylua: ignore start -- toggle options -LazyVim.toggle.map("uf", LazyVim.toggle.format()) -LazyVim.toggle.map("uF", LazyVim.toggle.format(true)) -LazyVim.toggle.map("us", LazyVim.toggle("spell", { name = "Spelling" })) -LazyVim.toggle.map("uw", LazyVim.toggle("wrap", { name = "Wrap" })) -LazyVim.toggle.map("uL", LazyVim.toggle("relativenumber", { name = "Relative Number" })) -LazyVim.toggle.map("ud", LazyVim.toggle.diagnostics) -LazyVim.toggle.map("ul", LazyVim.toggle.number) -LazyVim.toggle.map( "uc", LazyVim.toggle("conceallevel", { values = { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 } })) -LazyVim.toggle.map("uT", LazyVim.toggle.treesitter) -LazyVim.toggle.map("ub", LazyVim.toggle("background", { values = { "light", "dark" }, name = "Background" })) +LazyVim.format.snacks_toggle():map("uf") +LazyVim.format.snacks_toggle(true):map("uF") +Snacks.toggle.option("spell", { name = "Spelling"}):map("us") +Snacks.toggle.option("wrap", {name = "Wrap"}):map("uw") +Snacks.toggle.option("relativenumber", { name = "Relative Number"}):map("uL") +Snacks.toggle.diagnostics():map("ud") +Snacks.toggle.line_number():map("ul") +Snacks.toggle.option("conceallevel", {off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2}):map("uc") +Snacks.toggle.treesitter():map("uT") +Snacks.toggle.option("background", { off = "light", on = "dark" , name = "Dark Background"}):map("ub") if vim.lsp.inlay_hint then - LazyVim.toggle.map("uh", LazyVim.toggle.inlay_hints) + Snacks.toggle.inlay_hints():map("uh") end -- lazygit -map("n", "gg", function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) -map("n", "gG", function() LazyVim.lazygit() end, { desc = "Lazygit (cwd)" }) -map("n", "gb", LazyVim.lazygit.blame_line, { desc = "Git Blame Line" }) -map("n", "gB", LazyVim.lazygit.browse, { desc = "Git Browse" }) - -map("n", "gf", function() - local git_path = vim.api.nvim_buf_get_name(0) - LazyVim.lazygit({args = { "-f", vim.trim(git_path) }, cwd = LazyVim.root.git()}) -end, { desc = "Lazygit Current File History" }) - -map("n", "gl", function() - LazyVim.lazygit({ args = { "log" }, cwd = LazyVim.root.git() }) -end, { desc = "Lazygit Log" }) -map("n", "gL", function() - LazyVim.lazygit({ args = { "log" } }) -end, { desc = "Lazygit Log (cwd)" }) +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", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) +map("n", "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) +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)" }) -- quit map("n", "qq", "qa", { desc = "Quit All" }) @@ -158,18 +151,12 @@ map("n", "uI", "InspectTree", { desc = "Inspect Tree" }) map("n", "L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" }) -- floating terminal -local lazyterm = function() LazyVim.terminal(nil, { cwd = LazyVim.root() }) end -map("n", "ft", lazyterm, { desc = "Terminal (Root Dir)" }) -map("n", "fT", function() LazyVim.terminal() end, { desc = "Terminal (cwd)" }) -map("n", "", lazyterm, { desc = "Terminal (Root Dir)" }) -map("n", "", lazyterm, { desc = "which_key_ignore" }) +map("n", "fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" }) +map("n", "ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) +map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) +map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) -- Terminal Mappings -map("t", "", "", { desc = "Enter Normal Mode" }) -map("t", "", "wincmd h", { desc = "Go to Left Window" }) -map("t", "", "wincmd j", { desc = "Go to Lower Window" }) -map("t", "", "wincmd k", { desc = "Go to Upper Window" }) -map("t", "", "wincmd l", { desc = "Go to Right Window" }) map("t", "", "close", { desc = "Hide Terminal" }) map("t", "", "close", { desc = "which_key_ignore" }) @@ -178,7 +165,7 @@ 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 }) -LazyVim.toggle.map("wm", LazyVim.toggle.maximize) +LazyVim.ui.maximize():map("wm") -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 3ad70c16..796bbf16 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -107,7 +107,6 @@ opt.spelloptions:append("noplainbuffer") opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current -opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 18ce7407..34a747ea 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -201,6 +201,7 @@ return { library = { { path = "luvit-meta/library", words = { "vim%.uv" } }, { path = "LazyVim", words = { "LazyVim" } }, + { path = "snacks.nvim", words = { "Snacks" } }, { path = "lazy.nvim", words = { "LazyVim" } }, }, }, diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index a57d9aeb..bac949fc 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -105,7 +105,7 @@ return { }, config = function(_, opts) local function on_move(data) - LazyVim.lsp.on_rename(data.source, data.destination) + Snacks.rename.on_rename_file(data.source, data.destination) end local events = require("neo-tree.events") diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index 461e6dca..70a42940 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -104,7 +104,7 @@ return { vim.api.nvim_create_autocmd("User", { pattern = "MiniFilesActionRename", callback = function(event) - LazyVim.lsp.on_rename(event.data.from, event.data.to) + Snacks.rename.on_rename_file(event.data.from, event.data.to) end, }) end, diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index 4829098b..e7977cb5 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -108,7 +108,7 @@ return { ft = { "markdown", "norg", "rmd", "org" }, config = function(_, opts) require("render-markdown").setup(opts) - LazyVim.toggle.map("um", { + Snacks.toggle({ name = "Render Markdown", get = function() return require("render-markdown.state").enabled @@ -121,7 +121,7 @@ return { m.disable() end end, - }) + }):map("um") end, }, } diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index f63e31ad..dbe76d1b 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -31,14 +31,6 @@ return { return vim.api.nvim_win_get_config(win).relative == "" end, }, - { - ft = "lazyterm", - title = "LazyTerm", - size = { height = 0.4 }, - filter = function(buf) - return not vim.b[buf].lazyterm_cmd - end, - }, "Trouble", { ft = "qf", title = "QuickFix" }, { @@ -103,6 +95,7 @@ return { end end + -- trouble for _, pos in ipairs({ "top", "bottom", "left", "right" }) do opts[pos] = opts[pos] or {} table.insert(opts[pos], { @@ -116,6 +109,22 @@ return { end, }) end + + -- snacks terminal + for _, pos in ipairs({ "top", "bottom", "left", "right" }) do + opts[pos] = opts[pos] or {} + table.insert(opts[pos], { + ft = "snacks_terminal", + size = { height = 0.4 }, + title = "%{b:snacks_terminal.id}: %{b:term_title}", + filter = function(_buf, win) + return vim.w[win].snacks_win + and vim.w[win].snacks_win.position == pos + and vim.w[win].snacks_win.relative == "editor" + and not vim.w[win].trouble_preview + end, + }) + end return opts end, }, diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index 1136230a..925a9f80 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -21,7 +21,7 @@ return { end, }) - LazyVim.toggle.map("ua", { + Snacks.toggle({ name = "Mini Animate", get = function() return not vim.g.minianimate_disable @@ -29,7 +29,7 @@ return { set = function(state) vim.g.minianimate_disable = not state end, - }) + }):map("ua") local animate = require("mini.animate") return { diff --git a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua index 1b8beeb6..3c49d83b 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua @@ -14,17 +14,19 @@ return { init = function() vim.api.nvim_create_autocmd("FileType", { pattern = { + "Trouble", "alpha", "dashboard", "fzf", "help", "lazy", - "lazyterm", "mason", "neo-tree", "notify", + "snacks_notif", + "snacks_terminal", + "snacks_win", "toggleterm", - "Trouble", "trouble", }, callback = function() diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua index 019977ed..ba9565a1 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua @@ -4,8 +4,7 @@ return { event = "VeryLazy", opts = function() local tsc = require("treesitter-context") - - LazyVim.toggle.map("ut", { + Snacks.toggle({ name = "Treesitter Context", get = tsc.enabled, set = function(state) @@ -15,8 +14,7 @@ return { tsc.disable() end end, - }) - + }):map("ut") return { mode = "cursor", max_lines = 3 } end, } diff --git a/lua/lazyvim/plugins/extras/util/gitui.lua b/lua/lazyvim/plugins/extras/util/gitui.lua index b5033235..e0dd6049 100644 --- a/lua/lazyvim/plugins/extras/util/gitui.lua +++ b/lua/lazyvim/plugins/extras/util/gitui.lua @@ -8,14 +8,14 @@ return { { "gG", function() - LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false }) + Snacks.terminal({ "gitui" }) end, desc = "GitUi (cwd)", }, { "gg", function() - LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false }) + Snacks.terminal({ "gitui" }, { cwd = LazyVim.root.get() }) end, desc = "GitUi (Root Dir)", }, diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index 4a43f115..ad646b8e 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -10,7 +10,48 @@ end require("lazyvim.config").init() +-- Terminal Mappings +local function term_nav(dir) + ---@param self snacks.terminal + return function(self) + return self:is_floating() and "" or vim.schedule(function() + vim.cmd.wincmd(dir) + end) + end +end + return { { "folke/lazy.nvim", version = "*" }, { "LazyVim/LazyVim", priority = 10000, lazy = false, opts = {}, cond = true, version = "*" }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = function() + ---@type snacks.Config + return { + toggle = { map = LazyVim.safe_keymap_set }, + notifier = { enabled = not LazyVim.has("noice.nvim") }, + terminal = { + win = { + keys = { + nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, + nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, + nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, + nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + }, + }, + }, + } + end, + keys = { + { + "un", + function() + Snacks.notifier.hide() + end, + desc = "Dismiss All Notifications", + }, + }, + }, } diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 3e8bc8b7..eb37acc3 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -129,8 +129,6 @@ return { LazyVim.lsp.setup() LazyVim.lsp.on_dynamic_capability(require("lazyvim.plugins.lsp.keymaps").on_attach) - LazyVim.lsp.words.setup(opts.document_highlight) - -- diagnostics signs if vim.fn.has("nvim-0.10.0") == 0 then if type(opts.diagnostics.signs) ~= "boolean" then diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 2a35dc97..e9b7c49d 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -25,17 +25,17 @@ function M.get() { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, { "cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" }, - { "cR", LazyVim.lsp.rename_file, desc = "Rename File", mode ={"n"}, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, + { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", mode ={"n"}, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" } }, { "cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }, { "cA", LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" }, - { "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight", - desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end }, - { "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight", - desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end }, - { "", function() LazyVim.lsp.words.jump(vim.v.count1, true) end, has = "documentHighlight", - desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end }, - { "", function() LazyVim.lsp.words.jump(-vim.v.count1, true) end, has = "documentHighlight", - desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end }, + { "]]", function() Snacks.words.jump(vim.v.count1) end, has = "documentHighlight", + desc = "Next Reference", cond = function() return Snacks.words.is_enabled() end }, + { "[[", function() Snacks.words.jump(-vim.v.count1) end, has = "documentHighlight", + desc = "Prev Reference", cond = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(vim.v.count1, true) end, has = "documentHighlight", + desc = "Next Reference", cond = function() return Snacks.words.is_enabled() end }, + { "", function() Snacks.words.jump(-vim.v.count1, true) end, has = "documentHighlight", + desc = "Prev Reference", cond = function() return Snacks.words.is_enabled() end }, } return M._keys diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 14807497..136c372b 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -1,39 +1,4 @@ return { - -- Better `vim.notify()` - { - "rcarriga/nvim-notify", - keys = { - { - "un", - function() - require("notify").dismiss({ silent = true, pending = true }) - end, - desc = "Dismiss All Notifications", - }, - }, - opts = { - stages = "static", - timeout = 3000, - max_height = function() - return math.floor(vim.o.lines * 0.75) - end, - max_width = function() - return math.floor(vim.o.columns * 0.75) - end, - on_open = function(win) - vim.api.nvim_win_set_config(win, { zindex = 100 }) - end, - }, - init = function() - -- when noice is not enabled, install notify on VeryLazy - if not LazyVim.has("noice.nvim") then - LazyVim.on_very_lazy(function() - vim.notify = require("notify") - end) - end - end, - }, - -- This is what powers LazyVim's fancy-looking -- tabs, which include filetype icons and close buttons. { @@ -55,9 +20,9 @@ return { opts = { options = { -- stylua: ignore - close_command = function(n) LazyVim.ui.bufremove(n) end, + close_command = function(n) Snacks.bufdelete(n) end, -- stylua: ignore - right_mouse_command = function(n) LazyVim.ui.bufremove(n) end, + right_mouse_command = function(n) Snacks.bufdelete(n) end, diagnostics = "nvim_lsp", always_show_bufferline = false, diagnostics_indicator = function(_, _, diag) @@ -226,7 +191,7 @@ return { "lukas-reineke/indent-blankline.nvim", event = "LazyFile", opts = function() - LazyVim.toggle.map("ug", { + Snacks.toggle({ name = "Indention Guides", get = function() return require("ibl.config").get_config(0).enabled @@ -234,7 +199,7 @@ return { set = function(state) require("ibl").setup_buffer(0, { enabled = state }) end, - }) + }):map("ug") return { indent = { @@ -244,17 +209,19 @@ return { scope = { show_start = false, show_end = false }, exclude = { filetypes = { - "help", + "Trouble", "alpha", "dashboard", - "neo-tree", - "Trouble", - "trouble", + "help", "lazy", "mason", + "neo-tree", "notify", + "snacks_notif", + "snacks_terminal", + "snacks_win", "toggleterm", - "lazyterm", + "trouble", }, }, } diff --git a/lua/lazyvim/util/deprecated.lua b/lua/lazyvim/util/deprecated.lua new file mode 100644 index 00000000..43d73fcf --- /dev/null +++ b/lua/lazyvim/util/deprecated.lua @@ -0,0 +1,59 @@ +local M = {} + +M.moved = { + lsp = { + rename_file = { "Snacks.rename.rename_file" }, + on_rename = { "Snacks.rename.on_rename_file" }, + words = { "Snacks.words" }, + }, + terminal = { + open = { "Snacks.terminal" }, + __call = { "Snacks.terminal" }, + }, + ui = { + statuscolumn = { "Snacks.statuscolumn" }, + bufremove = { "Snacks.bufdelete" }, + }, +} + +---@param name string +---@param mod table +function M.decorate(name, mod) + if not M.moved[name] then + return mod + end + setmetatable(mod, { + __call = function(_, ...) + local to = M.moved[name].__call[1] + LazyVim.deprecate("LazyVim." .. name, to) + local ret = vim.tbl_get(_G, unpack(vim.split(to, ".", { plain = true }))) + return ret(...) + end, + __index = function(_, k) + if M.moved[name][k] then + local to = M.moved[name][k][1] + LazyVim.deprecate("LazyVim." .. name .. "." .. k, to) + local ret = vim.tbl_get(_G, unpack(vim.split(to, ".", { plain = true }))) + return ret + end + return nil + end, + }) +end + +function M.lazygit() + LazyVim.deprecate("LazyVim.lazygit", "Snacks.lazygit") + return Snacks.lazygit +end + +function M.toggle() + LazyVim.deprecate("LazyVim.toggle", "Snacks.toggle") + return { + map = function() end, + wrap = function() + return {} + end, + } +end + +return M diff --git a/lua/lazyvim/util/format.lua b/lua/lazyvim/util/format.lua index de6ad052..7b0ccfd2 100644 --- a/lua/lazyvim/util/format.lua +++ b/lua/lazyvim/util/format.lua @@ -177,4 +177,20 @@ function M.setup() end, { desc = "Show info about the formatters for the current buffer" }) end +---@param buf? boolean +function M.snacks_toggle(buf) + return Snacks.toggle({ + name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")", + get = function() + if not buf then + return vim.g.autoformat == nil or vim.g.autoformat + end + return LazyVim.format.enabled() + end, + set = function(state) + LazyVim.format.enable(state, buf) + end, + }) +end + return M diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 106cbdc0..8d94f582 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -6,8 +6,6 @@ local LazyUtil = require("lazy.core.util") ---@field lsp lazyvim.util.lsp ---@field root lazyvim.util.root ---@field terminal lazyvim.util.terminal ----@field lazygit lazyvim.util.lazygit ----@field toggle lazyvim.util.toggle ---@field format lazyvim.util.format ---@field plugin lazyvim.util.plugin ---@field extras lazyvim.util.extras @@ -20,36 +18,17 @@ local LazyUtil = require("lazy.core.util") ---@field cmp lazyvim.util.cmp local M = {} ----@type table -local deprecated = { - get_clients = "lsp", - on_attach = "lsp", - on_rename = "lsp", - root_patterns = { "root", "patterns" }, - get_root = { "root", "get" }, - float_term = { "terminal", "open" }, - toggle_diagnostics = { "toggle", "diagnostics" }, - toggle_number = { "toggle", "number" }, - fg = "ui", - telescope = "pick", -} - setmetatable(M, { __index = function(t, k) if LazyUtil[k] then return LazyUtil[k] end - local dep = deprecated[k] - if dep then - local mod = type(dep) == "table" and dep[1] or dep - local key = type(dep) == "table" and dep[2] or k - M.deprecate([[LazyVim.]] .. k, [[LazyVim.]] .. mod .. "." .. key) - ---@diagnostic disable-next-line: no-unknown - t[mod] = require("lazyvim.util." .. mod) -- load here to prevent loops - return t[mod][key] + if k == "lazygit" or k == "toggle" then -- HACK: special case for lazygit + return M.deprecated[k]() end ---@diagnostic disable-next-line: no-unknown t[k] = require("lazyvim.util." .. k) + M.deprecated.decorate(k, t[k]) return t[k] end, }) diff --git a/lua/lazyvim/util/lazygit.lua b/lua/lazyvim/util/lazygit.lua deleted file mode 100644 index ff96c85c..00000000 --- a/lua/lazyvim/util/lazygit.lua +++ /dev/null @@ -1,231 +0,0 @@ ----@class lazyvim.util.lazygit ----@field config_dir? string ----@overload fun(cmd: string|string[], opts: LazyTermOpts): LazyFloat -local M = setmetatable({}, { - __call = function(m, ...) - return m.open(...) - end, -}) - ----@alias LazyGitColor {fg?:string, bg?:string, bold?:boolean} - ----@class LazyGitTheme: table ----@field activeBorderColor LazyGitColor ----@field cherryPickedCommitBgColor LazyGitColor ----@field cherryPickedCommitFgColor LazyGitColor ----@field defaultFgColor LazyGitColor ----@field inactiveBorderColor LazyGitColor ----@field optionsTextColor LazyGitColor ----@field searchingActiveBorderColor LazyGitColor ----@field selectedLineBgColor LazyGitColor ----@field unstagedChangesColor LazyGitColor -M.theme = { - [241] = { fg = "Special" }, - activeBorderColor = { fg = "MatchParen", bold = true }, - cherryPickedCommitBgColor = { fg = "Identifier" }, - cherryPickedCommitFgColor = { fg = "Function" }, - defaultFgColor = { fg = "Normal" }, - inactiveBorderColor = { fg = "FloatBorder" }, - optionsTextColor = { fg = "Function" }, - searchingActiveBorderColor = { fg = "MatchParen", bold = true }, - selectedLineBgColor = { bg = "Visual" }, -- set to `default` to have no background colour - unstagedChangesColor = { fg = "DiagnosticError" }, -} - -M.theme_path = LazyVim.norm(vim.fn.stdpath("cache") .. "/lazygit-theme.yml") - --- re-create config file on startup -M.dirty = true - --- re-create theme file on ColorScheme change -vim.api.nvim_create_autocmd("ColorScheme", { - callback = function() - M.dirty = true - end, -}) - --- Opens lazygit ----@param opts? LazyTermOpts | {args?: string[]} -function M.open(opts) - if vim.g.lazygit_theme ~= nil then - LazyVim.deprecate("vim.g.lazygit_theme", "vim.g.lazygit_config") - end - - opts = vim.tbl_deep_extend("force", {}, { - esc_esc = false, - ctrl_hjkl = false, - }, opts or {}) - - local cmd = { "lazygit" } - vim.list_extend(cmd, opts.args or {}) - - if vim.g.lazygit_config then - if M.dirty then - M.update_config() - end - - if not M.config_dir then - local Process = require("lazy.manage.process") - local ok, lines = pcall(Process.exec, { "lazygit", "-cd" }) - if ok then - M.config_dir = lines[1] - vim.env.LG_CONFIG_FILE = LazyVim.norm(M.config_dir .. "/config.yml" .. "," .. M.theme_path) - local custom_config = LazyVim.norm(M.config_dir .. "/custom.yml") - if vim.uv.fs_stat(custom_config) and vim.uv.fs_stat(custom_config).type == "file" then - vim.env.LG_CONFIG_FILE = vim.env.LG_CONFIG_FILE .. "," .. custom_config - end - else - ---@diagnostic disable-next-line: cast-type-mismatch - ---@cast lines string - LazyVim.error( - { "Failed to get **lazygit** config directory.", "Will not apply **lazygit** config.", "", "# Error:", lines }, - { title = "lazygit" } - ) - end - end - end - - return LazyVim.terminal(cmd, opts) -end - -function M.set_ansi_color(idx, color) - io.write(("\27]4;%d;%s\7"):format(idx, color)) -end - ----@param v LazyGitColor ----@return string[] -function M.get_color(v) - ---@type string[] - local color = {} - if v.fg then - color[1] = LazyVim.ui.color(v.fg) - elseif v.bg then - color[1] = LazyVim.ui.color(v.bg, true) - end - if v.bold then - table.insert(color, "bold") - end - return color -end - -function M.update_config() - ---@type table - local theme = {} - - for k, v in pairs(M.theme) do - if type(k) == "number" then - local color = M.get_color(v) - -- LazyGit uses color 241 a lot, so also set it to a nice color - -- pcall, since some terminals don't like this - pcall(M.set_ansi_color, k, color[1]) - else - theme[k] = M.get_color(v) - end - end - - local config = [[ -os: - editPreset: "nvim-remote" -gui: - nerdFontsVersion: 3 - theme: -]] - - ---@type string[] - local lines = {} - for k, v in pairs(theme) do - lines[#lines + 1] = (" %s:"):format(k) - for _, c in ipairs(v) do - lines[#lines + 1] = (" - %q"):format(c) - end - end - config = config .. table.concat(lines, "\n") - require("lazy.util").write_file(M.theme_path, config) - M.dirty = false -end - ----@param opts? {count?: number}|LazyCmdOptions -function M.blame_line(opts) - opts = vim.tbl_deep_extend("force", { - count = 3, - filetype = "git", - size = { - width = 0.6, - height = 0.6, - }, - border = "rounded", - }, opts or {}) - local cursor = vim.api.nvim_win_get_cursor(0) - local line = cursor[1] - local file = vim.api.nvim_buf_get_name(0) - local root = LazyVim.root.detectors.pattern(0, { ".git" })[1] or "." - local cmd = { "git", "-C", root, "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file } - return require("lazy.util").float_cmd(cmd, opts) -end - --- stylua: ignore -M.remote_patterns = { - { "^(https?://.*)%.git$" , "%1" }, - { "^git@(.+):(.+)%.git$" , "https://%1/%2" }, - { "^git@(.+):(.+)$" , "https://%1/%2" }, - { "^git@(.+)/(.+)$" , "https://%1/%2" }, - { "^ssh://git@(.*)$" , "https://%1" }, - { "ssh%.dev%.azure%.com/v3/(.*)/(.*)$", "dev.azure.com/%1/_git/%2" }, - { "^https://%w*@(.*)" , "https://%1" }, - { "^git@(.*)" , "https://%1" }, - { ":%d+" , "" }, - { "%.git$" , "" }, -} - ----@param remote string -function M.get_url(remote) - local ret = remote - for _, pattern in ipairs(M.remote_patterns) do - ret = ret:gsub(pattern[1], pattern[2]) - end - return ret:find("https://") == 1 and ret or ("https://%s"):format(ret) -end - -function M.browse() - local lines = require("lazy.manage.process").exec({ "git", "remote", "-v" }) - local remotes = {} ---@type {name:string, url:string}[] - - for _, line in ipairs(lines) do - local name, remote = line:match("(%S+)%s+(%S+)%s+%(fetch%)") - if name and remote then - local url = M.get_url(remote) - if url then - table.insert(remotes, { - name = name, - url = url, - }) - end - end - end - - local function open(remote) - if remote then - LazyVim.info(("Opening [%s](%s)"):format(remote.name, remote.url)) - if vim.fn.has("nvim-0.10") == 0 then - require("lazy.util").open(remote.url, { system = true }) - return - end - vim.ui.open(remote.url) - end - end - - if #remotes == 0 then - return LazyVim.error("No git remotes found") - elseif #remotes == 1 then - return open(remotes[1]) - end - - vim.ui.select(remotes, { - prompt = "Select remote to browse", - format_item = function(item) - return item.name .. (" "):rep(8 - #item.name) .. " 🔗 " .. item.url - end, - }, open) -end - -return M diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index 7efd8622..e868dcf0 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -118,63 +118,6 @@ function M.on_supports_method(method, fn) }) end -function M.rename_file() - local buf = vim.api.nvim_get_current_buf() - local old = assert(LazyVim.root.realpath(vim.api.nvim_buf_get_name(buf))) - local root = assert(LazyVim.root.realpath(LazyVim.root.get({ normalize = true }))) - assert(old:find(root, 1, true) == 1, "File not in project root") - - local extra = old:sub(#root + 2) - - vim.ui.input({ - prompt = "New File Name: ", - default = extra, - completion = "file", - }, function(new) - if not new or new == "" or new == extra then - return - end - new = LazyVim.norm(root .. "/" .. new) - vim.fn.mkdir(vim.fs.dirname(new), "p") - M.on_rename(old, new, function() - vim.fn.rename(old, new) - vim.cmd.edit(new) - vim.api.nvim_buf_delete(buf, { force = true }) - vim.fn.delete(old) - end) - end) -end - ----@param from string ----@param to string ----@param rename? fun() -function M.on_rename(from, to, rename) - local changes = { files = { { - oldUri = vim.uri_from_fname(from), - newUri = vim.uri_from_fname(to), - } } } - - local clients = M.get_clients() - for _, client in ipairs(clients) do - if client.supports_method("workspace/willRenameFiles") then - local resp = client.request_sync("workspace/willRenameFiles", changes, 1000, 0) - if resp and resp.result ~= nil then - vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) - end - end - end - - if rename then - rename() - end - - for _, client in ipairs(clients) do - if client.supports_method("workspace/didRenameFiles") then - client.notify("workspace/didRenameFiles", changes) - end - end -end - ---@return _.lspconfig.options function M.get_config(server) local configs = require("lspconfig.configs") @@ -260,82 +203,6 @@ function M.format(opts) end end ----@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}} 1-0 indexed -M.words = {} -M.words.enabled = false -M.words.ns = vim.api.nvim_create_namespace("vim_lsp_references") - ----@param opts? {enabled?: boolean} -function M.words.setup(opts) - opts = opts or {} - if not opts.enabled then - return - end - M.words.enabled = true - local handler = vim.lsp.handlers["textDocument/documentHighlight"] - vim.lsp.handlers["textDocument/documentHighlight"] = function(err, result, ctx, config) - if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then - return - end - vim.lsp.buf.clear_references() - return handler(err, result, ctx, config) - end - - M.on_supports_method("textDocument/documentHighlight", function(_, buf) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, { - group = vim.api.nvim_create_augroup("lsp_word_" .. buf, { clear = true }), - buffer = buf, - callback = function(ev) - if not require("lazyvim.plugins.lsp.keymaps").has(buf, "documentHighlight") then - return false - end - - if not ({ M.words.get() })[2] then - if ev.event:find("CursorMoved") then - vim.lsp.buf.clear_references() - elseif not LazyVim.cmp.visible() then - vim.lsp.buf.document_highlight() - end - end - end, - }) - end) -end - ----@return LspWord[] words, number? current -function M.words.get() - local cursor = vim.api.nvim_win_get_cursor(0) - local current, ret = nil, {} ---@type number?, LspWord[] - for _, extmark in ipairs(vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true })) do - local w = { - from = { extmark[2] + 1, extmark[3] }, - to = { extmark[4].end_row + 1, extmark[4].end_col }, - } - ret[#ret + 1] = w - if cursor[1] >= w.from[1] and cursor[1] <= w.to[1] and cursor[2] >= w.from[2] and cursor[2] <= w.to[2] then - current = #ret - end - end - return ret, current -end - ----@param count number ----@param cycle? boolean -function M.words.jump(count, cycle) - local words, idx = M.words.get() - if not idx then - return - end - idx = idx + count - if cycle then - idx = (idx - 1) % #words + 1 - end - local target = words[idx] - if target then - vim.api.nvim_win_set_cursor(0, target.from) - end -end - M.action = setmetatable({}, { __index = function(_, action) return function() diff --git a/lua/lazyvim/util/mini.lua b/lua/lazyvim/util/mini.lua index e7320a73..28d38f5b 100644 --- a/lua/lazyvim/util/mini.lua +++ b/lua/lazyvim/util/mini.lua @@ -121,7 +121,7 @@ end ---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean} function M.pairs(opts) - LazyVim.toggle.map("up", { + Snacks.toggle({ name = "Mini Pairs", get = function() return not vim.g.minipairs_disable @@ -129,7 +129,8 @@ function M.pairs(opts) set = function(state) vim.g.minipairs_disable = not state end, - }) + }):map("up") + local pairs = require("mini.pairs") pairs.setup(opts) local open = pairs.open diff --git a/lua/lazyvim/util/news.lua b/lua/lazyvim/util/news.lua index 5fb4a08c..f473f3a3 100644 --- a/lua/lazyvim/util/news.lua +++ b/lua/lazyvim/util/news.lua @@ -72,15 +72,23 @@ function M.open(file, opts) end end - local float = require("lazy.util").float({ - file = file, - size = { width = 0.6, height = 0.6 }, + Snacks.config.style("news", { + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = "yes", + statuscolumn = " ", + 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 + + local float = Snacks.win({ + file = file, + style = "news", + }) + if vim.diagnostic.enable then pcall(vim.diagnostic.enable, false, { bufnr = float.buf }) else diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 92c75540..f4a933e9 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -71,31 +71,6 @@ function M.extra_idx(name) end function M.lazy_file() - -- This autocmd will only trigger when a file was loaded from the cmdline. - -- It will render the file as quickly as possible. - vim.api.nvim_create_autocmd("BufReadPost", { - once = true, - callback = function(event) - -- Skip if we already entered vim - if vim.v.vim_did_enter == 1 then - return - end - - -- Try to guess the filetype (may change later on during Neovim startup) - local ft = vim.filetype.match({ buf = event.buf }) - if ft then - -- Add treesitter highlights and fallback to syntax - local lang = vim.treesitter.language.get_lang(ft) - if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then - vim.bo[event.buf].syntax = ft - end - - -- Trigger early redraw - vim.cmd([[redraw]]) - end - end, - }) - -- Add support for the LazyFile event local Event = require("lazy.core.handler.event") diff --git a/lua/lazyvim/util/terminal.lua b/lua/lazyvim/util/terminal.lua index 87f8553b..b9345c1d 100644 --- a/lua/lazyvim/util/terminal.lua +++ b/lua/lazyvim/util/terminal.lua @@ -1,13 +1,5 @@ ---@class lazyvim.util.terminal ----@overload fun(cmd: string|string[], opts: LazyTermOpts): LazyFloat -local M = setmetatable({}, { - __call = function(m, ...) - return m.open(...) - end, -}) - ----@type table -local terminals = {} +local M = {} ---@param shell? string function M.setup(shell) @@ -40,58 +32,4 @@ function M.setup(shell) end end ----@class LazyTermOpts: LazyCmdOptions ----@field interactive? boolean ----@field esc_esc? boolean ----@field ctrl_hjkl? boolean - --- Opens a floating terminal (interactive by default) ----@param cmd? string[]|string ----@param opts? LazyTermOpts -function M.open(cmd, opts) - opts = vim.tbl_deep_extend("force", { - ft = "lazyterm", - size = { width = 0.9, height = 0.9 }, - backdrop = LazyVim.has("edgy.nvim") and not cmd and 100 or nil, - }, opts or {}, { persistent = true }) --[[@as LazyTermOpts]] - - local termkey = vim.inspect({ cmd = cmd or "shell", cwd = opts.cwd, env = opts.env, count = vim.v.count1 }) - - if terminals[termkey] and terminals[termkey]:buf_valid() then - terminals[termkey]:toggle() - else - terminals[termkey] = require("lazy.util").float_term(cmd, opts) - local buf = terminals[termkey].buf - vim.b[buf].lazyterm_cmd = cmd - if opts.esc_esc == false then - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - end - if opts.ctrl_hjkl == false then - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) - end - - vim.keymap.set("n", "gf", function() - local f = vim.fn.findfile(vim.fn.expand("")) - if f ~= "" then - vim.cmd("close") - vim.cmd("e " .. f) - end - end, { buffer = buf }) - - vim.api.nvim_create_autocmd("BufEnter", { - buffer = buf, - callback = function() - vim.cmd.startinsert() - end, - }) - - vim.cmd("noh") - end - - return terminals[termkey] -end - return M diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua deleted file mode 100644 index d693dd9d..00000000 --- a/lua/lazyvim/util/toggle.lua +++ /dev/null @@ -1,210 +0,0 @@ ----@class lazyvim.util.toggle -local M = {} - ----@class lazyvim.Toggle ----@field name string ----@field icon? string ----@field color_enabled? string ----@field color_disabled? string ----@field get fun():boolean ----@field set fun(state:boolean) - ----@class lazyvim.Toggle.wrap: lazyvim.Toggle ----@operator call:boolean - ----@param toggle lazyvim.Toggle -function M.wrap(toggle) - return setmetatable(toggle, { - __call = function() - toggle.set(not toggle.get()) - local state = toggle.get() - if state then - LazyVim.info("Enabled " .. toggle.name, { title = toggle.name }) - else - LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name }) - end - return state - end, - }) --[[@as lazyvim.Toggle.wrap]] -end - ----@param lhs string ----@param toggle lazyvim.Toggle -function M.map(lhs, toggle) - local t = M.wrap(toggle) - LazyVim.safe_keymap_set("n", lhs, function() - t() - end, { desc = "Toggle " .. toggle.name }) - M.wk(lhs, toggle) -end - -function M.wk(lhs, toggle) - if not LazyVim.has("which-key.nvim") then - return - end - local function safe_get() - local ok, enabled = pcall(toggle.get) - if not ok then - LazyVim.error({ "Failed to get toggle state for **" .. toggle.name .. "**:\n", enabled }, { once = true }) - end - return enabled - end - require("which-key").add({ - { - lhs, - icon = function() - return safe_get() and { icon = toggle.icon or " ", color = toggle.color_enabled or "green" } - or { icon = toggle.icon or " ", color = toggle.color_disabled or "yellow" } - end, - desc = function() - return (safe_get() and "Disable " or "Enable ") .. toggle.name - end, - }, - }) -end - -M.treesitter = M.wrap({ - name = "Treesitter Highlight", - get = function() - return vim.b.ts_highlight - end, - set = function(state) - if state then - vim.treesitter.start() - else - vim.treesitter.stop() - end - end, -}) - ----@param buf? boolean -function M.format(buf) - return M.wrap({ - name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")", - get = function() - if not buf then - return vim.g.autoformat == nil or vim.g.autoformat - end - return LazyVim.format.enabled() - end, - set = function(state) - LazyVim.format.enable(state, buf) - end, - }) -end - ----@param opts? {values?: {[1]:any, [2]:any}, name?: string} -function M.option(option, opts) - opts = opts or {} - local name = opts.name or option - local on = opts.values and opts.values[2] or true - local off = opts.values and opts.values[1] or false - return M.wrap({ - name = name, - get = function() - return vim.opt_local[option]:get() == on - end, - set = function(state) - vim.opt_local[option] = state and on or off - end, - }) -end - -local nu = { number = true, relativenumber = true } -M.number = M.wrap({ - name = "Line Numbers", - get = function() - return vim.opt_local.number:get() or vim.opt_local.relativenumber:get() - end, - set = function(state) - if state then - vim.opt_local.number = nu.number - vim.opt_local.relativenumber = nu.relativenumber - else - nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() } - vim.opt_local.number = false - vim.opt_local.relativenumber = false - end - end, -}) - -M.diagnostics = M.wrap({ - name = "Diagnostics", - get = function() - local enabled = false - if vim.diagnostic.is_enabled then - enabled = vim.diagnostic.is_enabled() - elseif vim.diagnostic.is_disabled then - enabled = not vim.diagnostic.is_disabled() - end - return enabled - end, - set = function(state) - if vim.fn.has("nvim-0.10") == 0 then - if state then - pcall(vim.diagnostic.enable) - else - pcall(vim.diagnostic.disable) - end - else - vim.diagnostic.enable(state) - end - end, -}) - -M.inlay_hints = M.wrap({ - name = "Inlay Hints", - get = function() - return vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }) - end, - set = function(state) - vim.lsp.inlay_hint.enable(state, { bufnr = 0 }) - end, -}) - ----@type {k:string, v:any}[] -M._maximized = nil -M.maximize = M.wrap({ - name = "Maximize", - get = function() - return M._maximized ~= nil - end, - set = function(state) - if state then - M._maximized = {} - local function set(k, v) - table.insert(M._maximized, 1, { k = k, v = vim.o[k] }) - vim.o[k] = v - end - set("winwidth", 999) - set("winheight", 999) - set("winminwidth", 10) - set("winminheight", 4) - vim.cmd("wincmd =") - -- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that - -- `VimLeavePre` might be another consideration? Not sure about differences between the 2 - vim.api.nvim_create_autocmd("ExitPre", { - once = true, - group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }), - desc = "Restore width/height when close Neovim while maximized", - callback = function() - M.maximize.set(false) - end, - }) - else - for _, opt in ipairs(M._maximized) do - vim.o[opt.k] = opt.v - end - M._maximized = nil - vim.cmd("wincmd =") - end - end, -}) - -setmetatable(M, { - __call = function(m, ...) - return m.option(...) - end, -}) - -return M diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 7c6780ea..14d0850f 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,77 +1,6 @@ ---@class lazyvim.util.ui local M = {} ----@alias Sign {name:string, text:string, texthl:string, priority:number} - --- Returns a list of regular and extmark signs sorted by priority (low to high) ----@return Sign[] ----@param buf number ----@param lnum number -function M.get_signs(buf, lnum) - -- Get regular signs - ---@type Sign[] - 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( - buf, - -1, - { lnum - 1, 0 }, - { lnum - 1, -1 }, - { details = true, type = "sign" } - ) - for _, extmark in pairs(extmarks) do - signs[#signs + 1] = { - name = extmark[4].sign_hl_group or extmark[4].sign_name or "", - text = extmark[4].sign_text, - texthl = extmark[4].sign_hl_group, - priority = extmark[4].priority, - } - end - - -- Sort by priority - table.sort(signs, function(a, b) - return (a.priority or 0) < (b.priority or 0) - end) - - return signs -end - ----@return Sign? ----@param buf number ----@param lnum number -function M.get_mark(buf, lnum) - local marks = vim.fn.getmarklist(buf) - vim.list_extend(marks, vim.fn.getmarklist()) - for _, mark in ipairs(marks) do - if mark.pos[1] == buf and mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then - return { text = mark.mark:sub(2), texthl = "DiagnosticHint" } - end - end -end - ----@param sign? Sign ----@param len? number -function M.icon(sign, len) - sign = sign or {} - len = len or 2 - local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string - text = text .. string.rep(" ", len - vim.fn.strchars(text)) - return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text -end - function M.foldtext() local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf()) local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext() @@ -91,74 +20,6 @@ function M.foldtext() return ret end -function M.statuscolumn() - local win = vim.g.statusline_winid - local buf = vim.api.nvim_win_get_buf(win) - local is_file = vim.bo[buf].buftype == "" - local show_signs = vim.wo[win].signcolumn ~= "no" - - local components = { "", "", "" } -- left, middle, right - - local show_open_folds = vim.g.lazyvim_statuscolumn and vim.g.lazyvim_statuscolumn.folds_open - local use_githl = vim.g.lazyvim_statuscolumn and vim.g.lazyvim_statuscolumn.folds_githl - - if show_signs then - local signs = M.get_signs(buf, vim.v.lnum) - - ---@type Sign?,Sign?,Sign? - local left, right, fold, githl - for _, s in ipairs(signs) do - if s.name and (s.name:find("GitSign") or s.name:find("MiniDiffSign")) then - right = s - if use_githl then - githl = s["texthl"] - end - else - left = s - end - 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 = githl or "Folded" } - elseif - show_open_folds - and not LazyVim.ui.skip_foldexpr[buf] - and tostring(vim.treesitter.foldexpr(vim.v.lnum)):sub(1, 1) == ">" - then -- fold start - fold = { text = vim.opt.fillchars:get().foldopen or "", texthl = githl } - 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.fn.has("nvim-0.11") == 1 then - components[2] = "%l" -- 0.11 handles both the current and other lines with %l - else - if vim.v.relnum == 0 then - components[2] = is_num and "%l" or "%r" -- the current line - else - components[2] = is_relnum and "%r" or "%l" -- other lines - end - end - components[2] = "%=" .. components[2] .. " " -- right align - end - - if vim.v.virtnum ~= 0 then - components[2] = "%= " - end - - return table.concat(components, "") -end - ---@return {fg?:string}? function M.fg(name) local color = M.color(name) @@ -224,47 +85,45 @@ function M.foldexpr() return "0" end ----@param buf number? -function M.bufremove(buf) - buf = buf or 0 - buf = buf == 0 and vim.api.nvim_get_current_buf() or buf - - if vim.bo.modified then - local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") - if choice == 0 or choice == 3 then -- 0 for / and 3 for Cancel - return - end - if choice == 1 then -- Yes - vim.cmd.write() - end - end - - for _, win in ipairs(vim.fn.win_findbuf(buf)) do - vim.api.nvim_win_call(win, function() - if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then - return +function M.maximize() + ---@type {k:string, v:any}[]? + local maximized = nil + return Snacks.toggle({ + name = "Maximize", + get = function() + return maximized ~= nil + end, + set = function(state) + if state then + maximized = {} + local function set(k, v) + table.insert(maximized, 1, { k = k, v = vim.o[k] }) + vim.o[k] = v + end + set("winwidth", 999) + set("winheight", 999) + set("winminwidth", 10) + set("winminheight", 4) + vim.cmd("wincmd =") + -- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that + -- `VimLeavePre` might be another consideration? Not sure about differences between the 2 + vim.api.nvim_create_autocmd("ExitPre", { + once = true, + group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }), + desc = "Restore width/height when close Neovim while maximized", + callback = function() + M.maximize.set(false) + end, + }) + else + for _, opt in ipairs(maximized) do + vim.o[opt.k] = opt.v + end + maximized = nil + vim.cmd("wincmd =") end - -- Try using alternate buffer - local alt = vim.fn.bufnr("#") - if alt ~= buf and vim.fn.buflisted(alt) == 1 then - vim.api.nvim_win_set_buf(win, alt) - return - end - - -- Try using previous buffer - local has_previous = pcall(vim.cmd, "bprevious") - if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then - return - end - - -- Create new listed buffer - local new_buf = vim.api.nvim_create_buf(true, false) - vim.api.nvim_win_set_buf(win, new_buf) - end) - end - if vim.api.nvim_buf_is_valid(buf) then - pcall(vim.cmd, "bdelete! " .. buf) - end + end, + }) end return M diff --git a/tests/util/lazygit_spec.lua b/tests/util/lazygit_spec.lua deleted file mode 100644 index 518e886a..00000000 --- a/tests/util/lazygit_spec.lua +++ /dev/null @@ -1,42 +0,0 @@ ----@module "luassert" - -_G.LazyVim = require("lazyvim.util") - --- stylua: ignore -local git_remotes_cases = { - ["https://github.com/LazyVim/LazyVim.git"] = "https://github.com/LazyVim/LazyVim", - ["https://github.com/LazyVim/LazyVim"] = "https://github.com/LazyVim/LazyVim", - ["git@github.com:LazyVim/LazyVim"] = "https://github.com/LazyVim/LazyVim", - ["git@ssh.dev.azure.com:v3/neovim-org/owner/repo"] = "https://dev.azure.com/neovim-org/owner/_git/repo", - ["https://folkelemaitre@bitbucket.org/samiulazim/neovim.git"] = "https://bitbucket.org/samiulazim/neovim", - ["git@bitbucket.org:samiulazim/neovim.git"] = "https://bitbucket.org/samiulazim/neovim", - ["git@gitlab.com:inkscape/inkscape.git"] = "https://gitlab.com/inkscape/inkscape", - ["https://gitlab.com/inkscape/inkscape.git"] = "https://gitlab.com/inkscape/inkscape", - ["git@github.com:torvalds/linux.git"] = "https://github.com/torvalds/linux", - ["https://github.com/torvalds/linux.git"] = "https://github.com/torvalds/linux", - ["git@bitbucket.org:team/repo.git"] = "https://bitbucket.org/team/repo", - ["https://bitbucket.org/team/repo.git"] = "https://bitbucket.org/team/repo", - ["git@gitlab.com:example-group/example-project.git"] = "https://gitlab.com/example-group/example-project", - ["https://gitlab.com/example-group/example-project.git"] = "https://gitlab.com/example-group/example-project", - ["git@ssh.dev.azure.com:v3/org/project/repo"] = "https://dev.azure.com/org/project/_git/repo", - ["https://username@dev.azure.com/org/project/_git/repo"] = "https://dev.azure.com/org/project/_git/repo", - ["ssh://git@ghe.example.com:2222/org/repo.git"] = "https://ghe.example.com/org/repo", - ["https://ghe.example.com/org/repo.git"] = "https://ghe.example.com/org/repo", - ["git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo"] = "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", - ["https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo"] = "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", - ["ssh://git@source.developers.google.com:2022/p/project/r/repo"] = "https://source.developers.google.com/p/project/r/repo", - ["https://source.developers.google.com/p/project/r/repo"] = "https://source.developers.google.com/p/project/r/repo", - ["git@git.sr.ht:~user/repo"] = "https://git.sr.ht/~user/repo", - ["https://git.sr.ht/~user/repo"] = "https://git.sr.ht/~user/repo", - ["git@git.sr.ht:~user/another-repo"] = "https://git.sr.ht/~user/another-repo", - ["https://git.sr.ht/~user/another-repo"] = "https://git.sr.ht/~user/another-repo", -} - -describe("util.lazygit", function() - for remote, expected in pairs(git_remotes_cases) do - it("should parse git remote " .. remote, function() - local url = LazyVim.lazygit.get_url(remote) - assert.are.equal(expected, url) - end) - end -end) From 81a4f3f690509d682404c0bc81eb560c06c18c41 Mon Sep 17 00:00:00 2001 From: folke Date: Thu, 7 Nov 2024 14:55:42 +0000 Subject: [PATCH 19/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index b66d2ea3..f557c902 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 04 +*LazyVim.txt* For Neovim Last change: 2024 November 07 ============================================================================== Table of Contents *LazyVim-table-of-contents* From a86c25286b83d766af8935db31417c0ce417b865 Mon Sep 17 00:00:00 2001 From: Josh Medeski Date: Thu, 7 Nov 2024 09:05:32 -0600 Subject: [PATCH 20/77] fix(copilot-chat): setup cmp conditionally (#4716) ## Description Check for cmp before setting up copilot chat. ## Related Issue(s) For https://github.com/LazyVim/LazyVim/issues/4702 I would like to set up the cmp compatability later if possible, but this is a quick patch to allow copilot chat to work without cmp (for now). ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/coding/copilot-chat.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua index fd58b857..042ab8ff 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua @@ -73,7 +73,9 @@ return { }, config = function(_, opts) local chat = require("CopilotChat") - require("CopilotChat.integrations.cmp").setup() + if pcall(require, "cmp") then + require("CopilotChat.integrations.cmp").setup() + end vim.api.nvim_create_autocmd("BufEnter", { pattern = "copilot-chat", From 0bc09d8206cfec1a4b3481acbc3e864a548c499a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 16:10:45 +0100 Subject: [PATCH 21/77] fix(telescope): check for gmake if needed --- lua/lazyvim/plugins/extras/editor/telescope.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/telescope.lua b/lua/lazyvim/plugins/extras/editor/telescope.lua index 11cfef1b..bab88576 100644 --- a/lua/lazyvim/plugins/extras/editor/telescope.lua +++ b/lua/lazyvim/plugins/extras/editor/telescope.lua @@ -4,8 +4,13 @@ if lazyvim_docs then vim.g.lazyvim_picker = "telescope" end -local have_make = vim.fn.executable("make") == 1 -local have_cmake = vim.fn.executable("cmake") == 1 +local build_cmd ---@type string? +for _, cmd in ipairs({ "make", "cmake", "gmake" }) do + if vim.fn.executable(cmd) == 1 then + build_cmd = cmd + break + end +end ---@type LazyPicker local picker = { @@ -63,9 +68,9 @@ return { dependencies = { { "nvim-telescope/telescope-fzf-native.nvim", - build = have_make and "make" + build = (build_cmd ~= "cmake") and "make" or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", - enabled = have_make or have_cmake, + enabled = build_cmd ~= nil, config = function(plugin) LazyVim.on_load("telescope.nvim", function() local ok, err = pcall(require("telescope").load_extension, "fzf") From 4ff36062dd33b852f9734d3731c55a5a8c50cf75 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Thu, 7 Nov 2024 07:11:36 -0800 Subject: [PATCH 22/77] fix(prettier): keep existing formatters_by_ft (#4719) ## Description This change makes it possible to configure other formatters for filetypes supported by the prettier extra, for instance ```js return { { "stevearc/conform.nvim", opts = { formatters_by_ft = { css = { "stylelint" }, }, }, }, } ``` Currently the prettier extra overwrites any existing `formatters_by_ft` for the filetypes it supports. I've changed it to use `table.insert` [like the sql extra does](https://github.com/LazyVim/LazyVim/blob/75750be1c0493659c9fbc60ff5e06dba053ef528/lua/lazyvim/plugins/extras/lang/sql.lua#L148-L149). ## Related Issue(s) None that I know of ## Screenshots N/A ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/formatting/prettier.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua index 13704ca9..855dc258 100644 --- a/lua/lazyvim/plugins/extras/formatting/prettier.lua +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -70,7 +70,8 @@ return { opts = function(_, opts) opts.formatters_by_ft = opts.formatters_by_ft or {} for _, ft in ipairs(supported) do - opts.formatters_by_ft[ft] = { "prettier" } + opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {} + table.insert(opts.formatters_by_ft[ft], "prettier") end opts.formatters = opts.formatters or {} From 37cc03948d8a2475c4889d788df17b293bb7d1e9 Mon Sep 17 00:00:00 2001 From: Conarius <34580743+Conarius@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:11:59 +0100 Subject: [PATCH 23/77] feat(extras.nushell): update to upstream treesitter (#4715) ## Description Since the nushell treesitter parser is now upstream, as seen in [this pr](https://github.com/nvim-treesitter/nvim-treesitter/pull/7267), it updates the treesitter config of this extra ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Co-authored-by: Conarius --- lua/lazyvim/plugins/extras/lang/nushell.lua | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/nushell.lua b/lua/lazyvim/plugins/extras/lang/nushell.lua index d025112e..b67f9093 100644 --- a/lua/lazyvim/plugins/extras/lang/nushell.lua +++ b/lua/lazyvim/plugins/extras/lang/nushell.lua @@ -12,23 +12,6 @@ return { }, { "nvim-treesitter/nvim-treesitter", - dependencies = { - { "nushell/tree-sitter-nu" }, - }, - opts = function(_, opts) - ---@diagnostic disable-next-line: inject-field - require("nvim-treesitter.parsers").get_parser_configs().nu = { - install_info = { - url = "https://github.com/nushell/tree-sitter-nu", - files = { "src/parser.c" }, - branch = "main", - }, - filetype = "nu", - } - - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "nu" }) - end - end, + opts = { ensure_installed = { "nu" } }, }, } From c879b397c7c4998c060247c0aa7ab68400967022 Mon Sep 17 00:00:00 2001 From: Nicky Meuleman Date: Thu, 7 Nov 2024 16:16:41 +0100 Subject: [PATCH 24/77] fix(dial): follow comment explanation for integers (#4658) relevant doc page: https://github.com/monaqa/dial.nvim?tab=readme-ov-file#augend-alias ## Description The specific augend for integers in several languages is a different one than what the comment explaining it suggests. Changed the augend to the one that includes negative integers like the comment suggests. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/editor/dial.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 5d2dcaa1..4bfb285d 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -120,17 +120,17 @@ return { months, }, typescript = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.constant.alias.bool, -- boolean value (true <-> false) logical_alias, augend.constant.new({ elements = { "let", "const" } }), }, yaml = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.constant.alias.bool, -- boolean value (true <-> false) }, css = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.hexcolor.new({ case = "lower", }), @@ -142,11 +142,11 @@ return { augend.misc.alias.markdown_header, }, json = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.semver.alias.semver, -- versioning (v1.1.2) }, lua = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.constant.alias.bool, -- boolean value (true <-> false) augend.constant.new({ elements = { "and", "or" }, @@ -155,7 +155,7 @@ return { }), }, python = { - augend.integer.alias.decimal, -- nonnegative and negative decimal number + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number capitalized_boolean, logical_alias, }, From 1e975be7a547f9a2dea63edb21cbaefab40d0cfa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 16:19:16 +0100 Subject: [PATCH 25/77] fix(options): removed deprecated options --- lua/lazyvim/config/options.lua | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 796bbf16..6e8ab149 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -18,22 +18,6 @@ vim.g.lazyvim_picker = "auto" -- * a function with signature `function(buf) -> string|string[]` vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } --- LazyVim automatically configures lazygit: --- * theme, based on the active colorscheme. --- * editPreset to nvim-remote --- * enables nerd font icons --- Set to false to disable. --- Set the options you want to override in `~/.config/lazygit/custom.yml` --- WARN: on Windows you might want to set `editPreset: "nvim"` due to --- this issue https://github.com/jesseduffield/lazygit/issues/3467 -vim.g.lazygit_config = true - --- Options for the LazyVim statuscolumn -vim.g.lazyvim_statuscolumn = { - folds_open = false, -- show fold sign when fold is open - folds_githl = false, -- highlight fold sign with git sign color -} - -- Optionally setup the terminal to use -- This sets `vim.o.shell` and does some additional configuration for: -- * pwsh @@ -47,12 +31,6 @@ vim.g.root_lsp_ignore = { "copilot" } -- Hide deprecation warnings vim.g.deprecation_warnings = false --- Set filetype to `bigfile` for files larger than 1.5 MB --- Only vim syntax will be enabled (with the correct filetype) --- LSP, treesitter and other ft plugins will be disabled. --- mini.animate will also be disabled. -vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB - -- Show the current document symbols location from Trouble in lualine -- You can disable this for a buffer by setting `vim.b.trouble_lualine = false` vim.g.trouble_lualine = true From aa53cd47c45ad4a087a35ab9150807d1dfef65ed Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 16:21:48 +0100 Subject: [PATCH 26/77] feat(keymaps): only add lazygit keymaps when available. Closes #4643. Closes #4247 --- lua/lazyvim/config/keymaps.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 422cadd2..c4160bef 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -132,13 +132,15 @@ if vim.lsp.inlay_hint then end -- lazygit -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", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) -map("n", "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) -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)" }) +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", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) + map("n", "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) + 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)" }) +end -- quit map("n", "qq", "qa", { desc = "Quit All" }) From 1d4157e68128373609385452d594b3bdf77b0fc0 Mon Sep 17 00:00:00 2001 From: Jamie Davies Date: Thu, 7 Nov 2024 15:26:17 +0000 Subject: [PATCH 27/77] fix(lualine): apply highlight groups correctly to truncated pretty_paths (#4379) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This is a small fix to the path truncating in `LazyVim.lualine.pretty_path()` to make the filename highlighting actually apply to only the filename, rather than the filename and all path elements after the inserted ellipsis (`…`). This keeps it consistent with the behaviour exhibited when the path isn't truncated, and is what I think most users would expect the behaviour to be. ## Screenshots Before this fix: image ``` nvim/…/nvim/lua/plugins/lazyvim/ui.lua └──┬──┘└──────────────┬──────────────┘ directory_hl filename_hl ``` After this fix: image ``` nvim/…/nvim/lua/plugins/lazyvim/ui.lua └──────────────┬───────────────┘└─┬──┘ directory_hl filename_hl ``` ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/util/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 6284504a..4c8c28a8 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -106,7 +106,7 @@ function M.pretty_path(opts) if opts.length == 0 then parts = parts elseif #parts > opts.length then - parts = { parts[1], "…", table.concat({ unpack(parts, #parts - opts.length + 2, #parts) }, sep) } + parts = { parts[1], "…", unpack(parts, #parts - opts.length + 2, #parts) } end if opts.modified_hl and vim.bo.modified then From 4379fafc7bbfe69f4e4d0da8131089cb7601f7c4 Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Thu, 7 Nov 2024 12:40:06 -0300 Subject: [PATCH 28/77] feat(extras): lang/zig (#4437) ## Description A fresh and minimalist take on #1750. It only adds what is maintainable (has activity in the past year at least). ## Related Issue(s) Closes #1750. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/zig.lua | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/zig.lua diff --git a/lua/lazyvim/plugins/extras/lang/zig.lua b/lua/lazyvim/plugins/extras/lang/zig.lua new file mode 100644 index 00000000..07499b11 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/zig.lua @@ -0,0 +1,32 @@ +return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "zig", "zir" }, + root = { "zls.json", "build.zig" }, + }) + end, + { + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "zig" } }, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + zls = {}, + }, + }, + }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "lawrence-laz/neotest-zig", + }, + opts = { + adapters = { + ["neotest-zig"] = {}, + }, + }, + }, +} From db052ed9c02be96d7c0a744d0f5f0d30efa447d0 Mon Sep 17 00:00:00 2001 From: Dusty Phillips <86920+dusty-phillips@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:45:39 -0400 Subject: [PATCH 29/77] docs(Readme): reflect that LazyVim For Ambitious Developers is complete (#4407) ## Description LazyVim for Ambitious Developers is completely released online, with ebooks available and print edition coming shortly. This just updates the links to remove the "is working on" wording. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- README.md | 2 +- doc/LazyVim.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67684a03..c9a9ead3 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ There's a great video created by [@elijahmanor](https://github.com/elijahmanor) [![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) is working on a book called +[@dusty-phillips](https://github.com/dusty-phillips) wrote a comprehensive book called [LazyVim for Ambitious Developers](https://lazyvim-ambitious-devs.phillips.codes) available for free online. diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index f557c902..641a14b4 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -102,7 +102,7 @@ There’s a great video created by @elijahmanor -@dusty-phillips is working on a book called +@dusty-phillips wrote a comprehensive book called LazyVim for Ambitious Developers available for free online. From d017bb861e313fbb2f7b4fce8ae6f150dadd7b88 Mon Sep 17 00:00:00 2001 From: folke Date: Thu, 7 Nov 2024 15:46:41 +0000 Subject: [PATCH 30/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 641a14b4..32264a6f 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -102,8 +102,8 @@ There’s a great video created by @elijahmanor -@dusty-phillips wrote a comprehensive book called -LazyVim for Ambitious Developers +@dusty-phillips wrote a comprehensive book +called LazyVim for Ambitious Developers available for free online. From 67b216c973dd03fee84e362465266bab96402831 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 17:01:08 +0100 Subject: [PATCH 31/77] fix(lualine): make sure path is in root before substituting --- lua/lazyvim/util/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 4c8c28a8..db8311c4 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -96,7 +96,7 @@ function M.pretty_path(opts) if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then path = path:sub(#cwd + 2) - else + elseif path:find(root, 1, true) == 1 then path = path:sub(#root + 2) end From e6f612f1cc5dfe942a4b48878d8c356c32232fad Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 22:52:11 +0100 Subject: [PATCH 32/77] fix(snacks): dont add `snacks_notif` to close_with_q --- lua/lazyvim/config/autocmds.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 0a6d92e3..7e6018fa 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -67,7 +67,6 @@ vim.api.nvim_create_autocmd("FileType", { "notify", "qf", "snacks_win", - "snacks_notif", "spectre_panel", "startuptime", "tsplayground", From b841a1dfc36f68033ed02866b57a0a03112b06c3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 22:52:38 +0100 Subject: [PATCH 33/77] fix(blink): remove `draw="reversed"` for now till new release --- lua/lazyvim/plugins/extras/coding/blink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index e6d4e29b..eb5d5471 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -28,7 +28,7 @@ return { nerd_font_variant = "mono", windows = { autocomplete = { - draw = "reversed", + -- draw = "reversed", winblend = vim.o.pumblend, }, documentation = { From 67ba58215b9122f4c422801c4af74412a8aa21d4 Mon Sep 17 00:00:00 2001 From: bitbird development Date: Fri, 8 Nov 2024 09:00:36 +0100 Subject: [PATCH 34/77] feat(toggle): add illuminate toggle for which-key (#4708) ## Description Adds a Toggle-Shortcut to enable/disable [Illuminate](https://github.com/RRethy/vim-illuminate) I dont think 'leader ux' is the right shortcut here. I just took the next free one. ![image](https://github.com/user-attachments/assets/65990e1b-f527-4691-8d2e-eee103695bff) --- lua/lazyvim/plugins/extras/editor/illuminate.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/illuminate.lua b/lua/lazyvim/plugins/extras/editor/illuminate.lua index d4f4bf89..59aada0a 100644 --- a/lua/lazyvim/plugins/extras/editor/illuminate.lua +++ b/lua/lazyvim/plugins/extras/editor/illuminate.lua @@ -15,6 +15,21 @@ return { config = function(_, opts) require("illuminate").configure(opts) + Snacks.toggle({ + name = "Illuminate", + get = function() + return not require("illuminate.engine").is_paused() + end, + set = function(enabled) + local m = require("illuminate") + if enabled then + m.resume() + else + m.pause() + end + end, + }):map("ux") + local function map(key, dir, buffer) vim.keymap.set("n", key, function() require("illuminate")["goto_" .. dir .. "_reference"](false) From b5b312284302157b4f47c17796c2c45defc6ec8b Mon Sep 17 00:00:00 2001 From: folke Date: Fri, 8 Nov 2024 08:01:42 +0000 Subject: [PATCH 35/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 32264a6f..ec46d7d2 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 07 +*LazyVim.txt* For Neovim Last change: 2024 November 08 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b0ced339a8e19253b93c147e796e921c44735418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Rabiec?= Date: Fri, 8 Nov 2024 13:25:09 +0100 Subject: [PATCH 36/77] fix(extras): make kulala keys only for http files (#4574) ## Description [Kulala's](https://github.com/mistweaverco/kulala.nvim) keys are currently globally active. This PR makes them available in .http files only. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/util/rest.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/rest.lua b/lua/lazyvim/plugins/extras/util/rest.lua index 61092ca6..a8e12154 100644 --- a/lua/lazyvim/plugins/extras/util/rest.lua +++ b/lua/lazyvim/plugins/extras/util/rest.lua @@ -8,11 +8,11 @@ return { "mistweaverco/kulala.nvim", ft = "http", keys = { - { "R", "", desc = "+Rest" }, - { "Rs", "lua require('kulala').run()", desc = "Send the request" }, - { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body" }, - { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request" }, - { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request" }, + { "R", "", desc = "+Rest", ft = "http" }, + { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, + { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, + { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, + { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request", ft = "http" }, }, opts = {}, }, From 4e1fd660780198f4dc9347609eb9ec74ed77cfef Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Fri, 8 Nov 2024 13:25:56 +0100 Subject: [PATCH 37/77] docs(dap): document `continue` to be used also for `run` (#4603) The `dap.continue` is meant to be used also to start the program if no debugging session is active. The documentation states: > `continue()` is the main entry-point for users to start debugging an application. With this change, it should be clearer to the user that `continue` is the way to start a program. Otherwise, one could think to use `Run with args` (which is misleading). At least for me, it was, until I read the dap documentation. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/dap/core.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index a605052c..2f2b6be3 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -36,7 +36,7 @@ return { { "d", "", desc = "+debug", mode = {"n", "v"} }, { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, - { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "dc", function() require("dap").continue() end, desc = "Run/Continue" }, { "da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, { "dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, From ee2ec7e4747f1be73f56f8a5f75047e5bc64cc93 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:26:31 +0200 Subject: [PATCH 38/77] fix(lang/r): make keymaps in which-key menu available in visual mode (#4565) ## Description `r.nvim` keymaps don't show group names in visual mode. ## Related Issue(s) No, rather discussion #4564 ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/r.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index f2c46041..6320f624 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -22,6 +22,7 @@ return { local wk = require("which-key") wk.add({ buffer = true, + mode = { "n", "v" }, { "a", group = "all" }, { "b", group = "between marks" }, { "c", group = "chunks" }, From 776994a20703d9f9cca380dbb0398ec2a6d79bd8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 8 Nov 2024 13:31:16 +0100 Subject: [PATCH 39/77] fix(dap): use dap's splitstr when running with args. Closes #4387 --- lua/lazyvim/plugins/extras/dap/core.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 2f2b6be3..b0582673 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -6,12 +6,12 @@ local function get_args(config) config = vim.deepcopy(config) ---@cast args string[] config.args = function() - local new_args = vim.fn.expand(vim.fn.input("Run with args: ", args_str)) + local new_args = vim.fn.expand(vim.fn.input("Run with args: ", args_str)) --[[@as string]] if config.type and config.type == "java" then ---@diagnostic disable-next-line: return-type-mismatch return new_args end - return vim.split(new_args, " ") + return require("dap.utils").splitstr(new_args) end return config end From dfde9148ef128d8c81a836ff85eb9cd25a01ac1f Mon Sep 17 00:00:00 2001 From: Benjman Date: Fri, 8 Nov 2024 05:37:09 -0700 Subject: [PATCH 40/77] fix(neotest): disambiguous key map descriptions (#4374) ## Description Neotest key map descriptions were too ambiguous. This change simply adds the plugin name to the key map descriptions, following the pattern of other plugin related key map descriptions. ## Screenshots ![240830_09h47m20s_screenshot](https://github.com/user-attachments/assets/9c63b9f5-139d-4f9d-a6aa-4f9744c62a57) ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/test/core.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index f9d8a4ac..48f886ad 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -106,15 +106,15 @@ return { -- stylua: ignore keys = { {"t", "", desc = "+test"}, - { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, - { "tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" }, - { "tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, - { "tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, - { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, - { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, - { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, - { "tS", function() require("neotest").run.stop() end, desc = "Stop" }, - { "tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch" }, + { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File (Neotest)" }, + { "tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files (Neotest)" }, + { "tr", function() require("neotest").run.run() end, desc = "Run Nearest (Neotest)" }, + { "tl", function() require("neotest").run.run_last() end, desc = "Run Last (Neotest)" }, + { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary (Neotest)" }, + { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output (Neotest)" }, + { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel (Neotest)" }, + { "tS", function() require("neotest").run.stop() end, desc = "Stop (Neotest)" }, + { "tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch (Neotest)" }, }, }, { From 15527910c321f3a6a01e1216442f8d21e5f19247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Fri, 8 Nov 2024 04:40:25 -0800 Subject: [PATCH 41/77] fix(snippet): don't set navigation mappings in nightly (#4375) ## Description Since [this commit in Neovim](https://github.com/neovim/neovim/pull/27339), snippet navigation mappings are set by default to `` and ``, and hence don't need to be redefined here. Moreover, the core implementation makes sure that those snippet navigation mappings are active only when snippet expansion is happening, and if other user bindings are using those keys, they're restored when snippet navigation ends. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/coding.lua | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 34a747ea..8f1d7968 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -105,26 +105,17 @@ return { table.insert(opts.sources, { name = "snippets" }) end end, - keys = { - { - "", - function() + init = function() + -- Neovim enabled snippet navigation mappings by default in v0.11 + if vim.fn.has("nvim-0.11") == 0 then + vim.keymap.set({ "i", "s" }, "", function() return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - { - "", - function() + end, { expr = true, silent = true }) + vim.keymap.set({ "i", "s" }, "", function() return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - }, + end, { expr = true, silent = true }) + end + end, }, -- auto pairs From c09735594a26a1749b775847c958e98f566fbac5 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:43:11 +0200 Subject: [PATCH 42/77] fix(project.nvim): correctly delete projects (#4314) ## Description Unfortunately, the upstream Github repo hasn't been active for over a year. This overwrites the `history.delete_project` function to correctly be able to delete projects. Because of `ipairs` being used, when you delete the first key from the table the `for` loop iteration will just stop, since there will be a gap between the available indices. > will iterate over the pairs (`1,t[1]`), (`2,t[2]`), ..., up to the first integer key absent from the table. There's also a [PR](https://github.com/ahmedkhalf/project.nvim/pull/106/files) for this upstream, but like I mentioned the Github repo hasn't been active for over a year. Feel free to disregard, since this is obviously something that should be rather fixed upstream under normal circumstances. I just created this PR, since it's such a basic functionality with little change in LazyVim's codebase, that I thought it might be acceptable. ## Related Issue(s) No, rather a discussion #4310 ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/util/project.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 77705f37..5d399125 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -91,6 +91,15 @@ return { event = "VeryLazy", config = function(_, opts) require("project_nvim").setup(opts) + local history = require("project_nvim.utils.history") + history.delete_project = function(project) + for k, v in pairs(history.recent_projects) do + if v == project.value then + history.recent_projects[k] = nil + return + end + end + end LazyVim.on_load("telescope.nvim", function() require("telescope").load_extension("projects") end) From cf86484797f70d1783166e8f572a4cfedd510ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Reegn?= Date: Fri, 8 Nov 2024 13:44:59 +0100 Subject: [PATCH 43/77] feat(extras): rego language support (#4297) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It took a while, but finally we can work with [OPA](https://www.openpolicyagent.org/) like a BOSS in neovim. Linking some PR-s that had to land in the past couple of months to make this config as simple as it is now: - treesitter commentstring support in - regols support in nvim-lspconfig: - regols support in mason-registry: - regols support in mason-lspconfig: - regal support in nvim-lspconfig: - regal support in mason-registry: - regal support in mason-lspconfig: ## Description ## Related Issue(s) ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Signed-off-by: Zoltán Reegn --- lua/lazyvim/plugins/extras/lang/rego.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/rego.lua diff --git a/lua/lazyvim/plugins/extras/lang/rego.lua b/lua/lazyvim/plugins/extras/lang/rego.lua new file mode 100644 index 00000000..d605c684 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/rego.lua @@ -0,0 +1,20 @@ +return { + recommended = { + ft = "rego", + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + regols = {}, + regal = {}, + }, + }, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { "rego" }, + }, + }, +} From 2d6687c6460e8e4ab639bc0a655d7c3f2b90d002 Mon Sep 17 00:00:00 2001 From: Mykhailo Sabatura <34069301+mishasbtr@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:45:53 +0100 Subject: [PATCH 44/77] feat(lang.angular): configure `prettier` as formatter for `angular` templates (#4345) ## Description Angular templates didn't have a configured formatter. This PR configures prettier as a default formatter for angular templates. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/angular.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/angular.lua b/lua/lazyvim/plugins/extras/lang/angular.lua index f039c3a0..d2f7fdee 100644 --- a/lua/lazyvim/plugins/extras/lang/angular.lua +++ b/lua/lazyvim/plugins/extras/lang/angular.lua @@ -57,4 +57,15 @@ return { }) end, }, + + -- formatting + { + "conform.nvim", + opts = function(_, opts) + if LazyVim.has_extra("formatting.prettier") then + opts.formatters_by_ft = opts.formatters_by_ft or {} + opts.formatters_by_ft.htmlangular = { "prettier" } + end + end, + }, } From 8534af4a7938d6fb8e7cfe5314ad13943414a42e Mon Sep 17 00:00:00 2001 From: Willian Fernandes Date: Fri, 8 Nov 2024 09:56:05 -0300 Subject: [PATCH 45/77] fix(extras): use the correct naming when setting up eruby formatter (#4625) ## Description Eruby files (.*.erb) are not formatted because the formatter name is incorrect. This PR fixes it. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/ruby.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index 6eb4fce5..d949e429 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -64,7 +64,7 @@ return { opts = { formatters_by_ft = { ruby = { formatter }, - eruby = { "erb-format" }, + eruby = { "erb_format" }, }, }, }, From fd361d07a295313273c64548784fdcdea59b8a69 Mon Sep 17 00:00:00 2001 From: kik4444 <7779637+kik4444@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:56:44 +0200 Subject: [PATCH 46/77] fix(lang/ruby): do not enable Rubocop as LSP if Solargraph is used (#4566) ## Description Solargraph already delegates some diagnostics to Rubocop by itself if it is installed on your system. However, if Rubocop is also enabled as an LSP while you're using Solargraph, then all Rubocop diagnostics are going to be duplicated and shown twice. Once from Solargraph after it calls Rubocop, and again by Rubocop separately running as an LSP. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/ruby.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index d949e429..9e21331e 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -36,7 +36,10 @@ return { enabled = lsp == "solargraph", }, rubocop = { - enabled = formatter == "rubocop", + -- If Solargraph and Rubocop are both enabled as an LSP, + -- diagnostics will be duplicated because Solargraph + -- already calls Rubocop if it is installed + enabled = formatter == "rubocop" and lsp ~= "solargraph", }, standardrb = { enabled = formatter == "standardrb", From 2d2e425d25b02b93ef3e4ce4cb0a3edc30903fa5 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Sat, 9 Nov 2024 00:05:00 +1100 Subject: [PATCH 47/77] feat(eslint): add option to disable eslint auto format (#4225) ## Description This adds an option to disable eslint's autoformatting. The reasons for not wanting an auto format by eslint are: 1. It is generally not recommended to use a linter as a formatter as highlighted by https://typescript-eslint.io/users/what-about-formatting/#:~:text=We%20recommend%20against%20using%20ESLint,dprint%2C%20or%20an%20equivalent%20instead 2. A personal preference not to have a linter change my code which I'm sure other people share. 3. As highlighted in the link above, eslint auto format can be quite slow. I would even argue that this should be the default, but I've left it as is in order not to break anyone's config or ruffle anyone's feathers. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/linting/eslint.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index df6e79dd..01f134e2 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -1,3 +1,10 @@ +if lazyvim_docs then + -- Set to false to disable auto format + vim.g.lazyvim_eslint_auto_format = true +end + +local auto_format = vim.g.lazyvim_eslint_auto_format == nil or vim.g.lazyvim_eslint_auto_format + return { { "neovim/nvim-lspconfig", @@ -9,11 +16,16 @@ return { settings = { -- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root workingDirectories = { mode = "auto" }, + format = auto_format, }, }, }, setup = { eslint = function() + if not auto_format then + return + end + local function get_client(buf) return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] end From f78bc3b85881b43fd082add4c80d9a75c573a882 Mon Sep 17 00:00:00 2001 From: Miguel Palau Date: Fri, 8 Nov 2024 07:06:39 -0600 Subject: [PATCH 48/77] fix(telescope): buffers to start at final item (#4189) ## Description Currently hitting `fb` triggers the telescope buffers command but because we're passing the `sort_lastused=true` flag the index starts at the second item. This happens because of this line of code in telescope.nvim: https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/__internal.lua#L941-L943 This makes it annoying to actually use the tool to find buffers because you have to first type your query then exit insert mode, then scroll one item down, and then hitting enter: https://github.com/user-attachments/assets/4126d017-df4b-48dc-b6d4-f7d9b8f491ff When removing that flag it makes the function much more usable in terms of UX since now you can just write your query and hit enter to go straight to it. ## Related Issue(s) ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/editor/telescope.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/editor/telescope.lua b/lua/lazyvim/plugins/extras/editor/telescope.lua index bab88576..55ccaceb 100644 --- a/lua/lazyvim/plugins/extras/editor/telescope.lua +++ b/lua/lazyvim/plugins/extras/editor/telescope.lua @@ -99,7 +99,11 @@ return { { ":", "Telescope command_history", desc = "Command History" }, { "", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, -- find - { "fb", "Telescope buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, + { + "fb", + "Telescope buffers sort_mru=true sort_lastused=true ignore_current_buffer=true", + desc = "Buffers", + }, { "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)" }, From 64b0f0b71d2678ca1342429c594eee61d8b9e0af Mon Sep 17 00:00:00 2001 From: Nate McCurdy Date: Fri, 8 Nov 2024 05:08:43 -0800 Subject: [PATCH 49/77] fix(navic): use the same background color as lualine section_c (#4231) ## Description Prior to this, when using the navic Extra, the symbol breadcrumbs shown in lualine section_c had a background color different from the background of lualine_c, causing it to standout and not blend in with some colorschemes. There were ways around this problem, but hose involved overriding a lot of highlights. See https://github.com/LazyVim/LazyVim/issues/328 This change uses the new (as of April 2023) lualine component built in to SmiteshP/nvim-navic, which has a `color_correction` option to fix the problem described above. This built-in component replaces the manual method of calling `require("nvim-navic").is_available()` and `require("nvim-navic").get_location()`. * https://github.com/SmiteshP/nvim-navic/commit/711e9f117a0936c9d4420a135d658d2ca53a9e99 * https://github.com/SmiteshP/nvim-navic/commit/bf587250f8e399da75b4efe12261e18d8783ecef With `color_correction` set to "static" or "dynamic", navic uses the lualine section's background color when building the breadcrumbs text. * https://github.com/SmiteshP/nvim-navic/blob/bf587250f8e399da75b4efe12261e18d8783ecef/doc/navic.txt#L83-L88 I chose to set color_correction to "dynamic" to provide the best user experience as that will update the background any time the lualine section's background changes (e.g. when switching modes). ## Related Issue(s) * Fixes #328 ## Screenshots Before this fix, the breadcrumb's background did not match lualine section_c's: ![before](https://github.com/user-attachments/assets/b30e9844-5aac-4ec8-96fd-a5243de8cded) After this fix, the breadcrumb's background does match: ![after](https://github.com/user-attachments/assets/63945c48-2edc-4aea-8144-ae0bff1ed952) ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/editor/navic.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/navic.lua b/lua/lazyvim/plugins/extras/editor/navic.lua index 642a4a99..e25d1b51 100644 --- a/lua/lazyvim/plugins/extras/editor/navic.lua +++ b/lua/lazyvim/plugins/extras/editor/navic.lua @@ -30,14 +30,7 @@ return { optional = true, opts = function(_, opts) if not vim.g.trouble_lualine then - table.insert(opts.sections.lualine_c, { - function() - return require("nvim-navic").get_location() - end, - cond = function() - return package.loaded["nvim-navic"] and require("nvim-navic").is_available() - end, - }) + table.insert(opts.sections.lualine_c, { "navic", color_correction = "dynamic" }) end end, }, From 859646f628ff0d99e6afe835ba0a48faed2972af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Donk=C3=B3?= Date: Fri, 8 Nov 2024 14:09:17 +0100 Subject: [PATCH 50/77] feat(scala): add key for worksheet hover (#3853) ## What is this PR for? Worksheet hovering is a useful feature provided by `metals` to see not just the end result, but also the entire output of a function call, as can be seen here for example: https://youtu.be/Jv9B1crzpWM?t=16m20s Having a default key assigned not only makes it more convenient, but also increases discoverability. (I was also contemplating `mK` as the mapping to be in line with `K` for regular hover, but I wasn't convinced that the consistency is worth the extra keypress.) ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/scala.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/scala.lua b/lua/lazyvim/plugins/extras/lang/scala.lua index 3b159697..791b515a 100644 --- a/lua/lazyvim/plugins/extras/lang/scala.lua +++ b/lua/lazyvim/plugins/extras/lang/scala.lua @@ -34,6 +34,13 @@ return { end, desc = "Metals compile cascade", }, + { + "mh", + function() + require("metals").hover_worksheet() + end, + desc = "Metals hover worksheet", + }, }, init_options = { statusBarProvider = "off", From 2fcd4cdc5fdbed0d2ac097db31578acb0b86b8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Guimar=C3=A3es?= Date: Fri, 8 Nov 2024 05:10:11 -0800 Subject: [PATCH 51/77] feat(elixir): add support for livebook files (`*.livemd`) (#4184) Livebook is a subset of Markdown, so we can safely use markdown's treesitter for it. Co-authored-by: Iordanis Petkakis --- lua/lazyvim/plugins/extras/lang/elixir.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index f391edbd..289e50df 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -1,7 +1,7 @@ return { recommended = function() return LazyVim.extras.wants({ - ft = { "elixir", "eelixir", "heex", "surface" }, + ft = { "elixir", "eelixir", "heex", "surface", "livebook" }, root = "mix.exs", }) end, @@ -40,7 +40,11 @@ return { }, { "nvim-treesitter/nvim-treesitter", - opts = { ensure_installed = { "elixir", "heex", "eex" } }, + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "elixir", "heex", "eex" }) + vim.treesitter.language.register("markdown", "livebook") + end, }, { "nvim-neotest/neotest", @@ -85,4 +89,11 @@ return { } end, }, + { + "MeanderingProgrammer/render-markdown.nvim", + optional = true, + ft = function(_, ft) + vim.list_extend(ft, { "livebook" }) + end, + }, } From 76168166e565a5aa135f2b5c5dabb2ffbb8a6075 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 8 Nov 2024 16:55:40 +0100 Subject: [PATCH 52/77] fix(lsp): wrap hover and signature_help --- lua/lazyvim/plugins/lsp/keymaps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index e9b7c49d..5eacba92 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -19,8 +19,8 @@ function M.get() { "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" }, { "gy", vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" }, { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, - { "K", vim.lsp.buf.hover, desc = "Hover" }, - { "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, + { "K", function() return vim.lsp.buf.hover() end, desc = "Hover" }, + { "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" }, { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, From da3058a72dbf086128b10ce19a0011000669b9ff Mon Sep 17 00:00:00 2001 From: Alexey Svirshchevskiy Date: Fri, 8 Nov 2024 17:10:53 +0100 Subject: [PATCH 53/77] fix(options): disable default ruler (#4731) ## Description The ruler option causes numbers to be briefly shown on the dashboard while LazyVim is loading. This MR disables the ruler. ## Screenshots image ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/options.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 6e8ab149..34819686 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -70,6 +70,7 @@ opt.number = true -- Print line number opt.pumblend = 10 -- Popup blend opt.pumheight = 10 -- Maximum number of entries in a popup opt.relativenumber = true -- Relative line numbers +opt.ruler = false -- Disable the default ruler opt.scrolloff = 4 -- Lines of context opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } opt.shiftround = true -- Round indent From 5efb88f44a03d0fd8ca3801067de904aecf7e86d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:18:00 +0100 Subject: [PATCH 54/77] chore(main): release 13.0.0 (#4723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :robot: I have created a release *beep* *boop* --- ## [13.0.0](https://github.com/LazyVim/LazyVim/compare/v12.44.1...v13.0.0) (2024-11-08) ### ⚠ BREAKING CHANGES * **core:** move a bunch of LazyVim features to snacks.nvim ([#4706](https://github.com/LazyVim/LazyVim/issues/4706)) ### Features * **core:** move a bunch of LazyVim features to snacks.nvim ([#4706](https://github.com/LazyVim/LazyVim/issues/4706)) ([2f46974](https://github.com/LazyVim/LazyVim/commit/2f4697443c0186663ba4421bd4b856e36c3bd7cc)) * **elixir:** add support for livebook files (`*.livemd`) ([#4184](https://github.com/LazyVim/LazyVim/issues/4184)) ([2fcd4cd](https://github.com/LazyVim/LazyVim/commit/2fcd4cdc5fdbed0d2ac097db31578acb0b86b8a2)) * **eslint:** add option to disable eslint auto format ([#4225](https://github.com/LazyVim/LazyVim/issues/4225)) ([2d2e425](https://github.com/LazyVim/LazyVim/commit/2d2e425d25b02b93ef3e4ce4cb0a3edc30903fa5)) * **extras.nushell:** update to upstream treesitter ([#4715](https://github.com/LazyVim/LazyVim/issues/4715)) ([37cc039](https://github.com/LazyVim/LazyVim/commit/37cc03948d8a2475c4889d788df17b293bb7d1e9)) * **extras:** lang/zig ([#4437](https://github.com/LazyVim/LazyVim/issues/4437)) ([4379faf](https://github.com/LazyVim/LazyVim/commit/4379fafc7bbfe69f4e4d0da8131089cb7601f7c4)) * **extras:** rego language support ([#4297](https://github.com/LazyVim/LazyVim/issues/4297)) ([cf86484](https://github.com/LazyVim/LazyVim/commit/cf86484797f70d1783166e8f572a4cfedd510ab5)) * **keymaps:** only add lazygit keymaps when available. Closes [#4643](https://github.com/LazyVim/LazyVim/issues/4643). Closes [#4247](https://github.com/LazyVim/LazyVim/issues/4247) ([aa53cd4](https://github.com/LazyVim/LazyVim/commit/aa53cd47c45ad4a087a35ab9150807d1dfef65ed)) * **lang.angular:** configure `prettier` as formatter for `angular` templates ([#4345](https://github.com/LazyVim/LazyVim/issues/4345)) ([2d6687c](https://github.com/LazyVim/LazyVim/commit/2d6687c6460e8e4ab639bc0a655d7c3f2b90d002)) * **scala:** add key for worksheet hover ([#3853](https://github.com/LazyVim/LazyVim/issues/3853)) ([859646f](https://github.com/LazyVim/LazyVim/commit/859646f628ff0d99e6afe835ba0a48faed2972af)) * **toggle:** add illuminate toggle for which-key ([#4708](https://github.com/LazyVim/LazyVim/issues/4708)) ([67ba582](https://github.com/LazyVim/LazyVim/commit/67ba58215b9122f4c422801c4af74412a8aa21d4)) ### Bug Fixes * **blink:** remove `draw="reversed"` for now till new release ([b841a1d](https://github.com/LazyVim/LazyVim/commit/b841a1dfc36f68033ed02866b57a0a03112b06c3)) * **copilot-chat:** setup cmp conditionally ([#4716](https://github.com/LazyVim/LazyVim/issues/4716)) ([a86c252](https://github.com/LazyVim/LazyVim/commit/a86c25286b83d766af8935db31417c0ce417b865)) * **dap:** use dap's splitstr when running with args. Closes [#4387](https://github.com/LazyVim/LazyVim/issues/4387) ([776994a](https://github.com/LazyVim/LazyVim/commit/776994a20703d9f9cca380dbb0398ec2a6d79bd8)) * **dial:** follow comment explanation for integers ([#4658](https://github.com/LazyVim/LazyVim/issues/4658)) ([c879b39](https://github.com/LazyVim/LazyVim/commit/c879b397c7c4998c060247c0aa7ab68400967022)) * **extras:** make kulala keys only for http files ([#4574](https://github.com/LazyVim/LazyVim/issues/4574)) ([b0ced33](https://github.com/LazyVim/LazyVim/commit/b0ced339a8e19253b93c147e796e921c44735418)) * **extras:** use the correct naming when setting up eruby formatter ([#4625](https://github.com/LazyVim/LazyVim/issues/4625)) ([8534af4](https://github.com/LazyVim/LazyVim/commit/8534af4a7938d6fb8e7cfe5314ad13943414a42e)) * **lang/r:** make keymaps in which-key menu available in visual mode ([#4565](https://github.com/LazyVim/LazyVim/issues/4565)) ([ee2ec7e](https://github.com/LazyVim/LazyVim/commit/ee2ec7e4747f1be73f56f8a5f75047e5bc64cc93)) * **lang/ruby:** do not enable Rubocop as LSP if Solargraph is used ([#4566](https://github.com/LazyVim/LazyVim/issues/4566)) ([fd361d0](https://github.com/LazyVim/LazyVim/commit/fd361d07a295313273c64548784fdcdea59b8a69)) * **lsp:** wrap hover and signature_help ([7616816](https://github.com/LazyVim/LazyVim/commit/76168166e565a5aa135f2b5c5dabb2ffbb8a6075)) * **lualine:** apply highlight groups correctly to truncated pretty_paths ([#4379](https://github.com/LazyVim/LazyVim/issues/4379)) ([1d4157e](https://github.com/LazyVim/LazyVim/commit/1d4157e68128373609385452d594b3bdf77b0fc0)) * **lualine:** make sure path is in root before substituting ([67b216c](https://github.com/LazyVim/LazyVim/commit/67b216c973dd03fee84e362465266bab96402831)) * **navic:** use the same background color as lualine section_c ([#4231](https://github.com/LazyVim/LazyVim/issues/4231)) ([64b0f0b](https://github.com/LazyVim/LazyVim/commit/64b0f0b71d2678ca1342429c594eee61d8b9e0af)) * **neotest:** disambiguous key map descriptions ([#4374](https://github.com/LazyVim/LazyVim/issues/4374)) ([dfde914](https://github.com/LazyVim/LazyVim/commit/dfde9148ef128d8c81a836ff85eb9cd25a01ac1f)) * **options:** disable default ruler ([#4731](https://github.com/LazyVim/LazyVim/issues/4731)) ([da3058a](https://github.com/LazyVim/LazyVim/commit/da3058a72dbf086128b10ce19a0011000669b9ff)) * **options:** removed deprecated options ([1e975be](https://github.com/LazyVim/LazyVim/commit/1e975be7a547f9a2dea63edb21cbaefab40d0cfa)) * **prettier:** keep existing formatters_by_ft ([#4719](https://github.com/LazyVim/LazyVim/issues/4719)) ([4ff3606](https://github.com/LazyVim/LazyVim/commit/4ff36062dd33b852f9734d3731c55a5a8c50cf75)) * **project.nvim:** correctly delete projects ([#4314](https://github.com/LazyVim/LazyVim/issues/4314)) ([c097355](https://github.com/LazyVim/LazyVim/commit/c09735594a26a1749b775847c958e98f566fbac5)) * **snacks:** dont add `snacks_notif` to close_with_q ([e6f612f](https://github.com/LazyVim/LazyVim/commit/e6f612f1cc5dfe942a4b48878d8c356c32232fad)) * **snippet:** don't set navigation mappings in nightly ([#4375](https://github.com/LazyVim/LazyVim/issues/4375)) ([1552791](https://github.com/LazyVim/LazyVim/commit/15527910c321f3a6a01e1216442f8d21e5f19247)) * **telescope:** buffers to start at final item ([#4189](https://github.com/LazyVim/LazyVim/issues/4189)) ([f78bc3b](https://github.com/LazyVim/LazyVim/commit/f78bc3b85881b43fd082add4c80d9a75c573a882)) * **telescope:** check for gmake if needed ([0bc09d8](https://github.com/LazyVim/LazyVim/commit/0bc09d8206cfec1a4b3481acbc3e864a548c499a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/.release-please-manifest.json | 2 +- CHANGELOG.md | 45 +++++++++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index eac7e537..2af89238 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.44.1" + ".": "13.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c5fc58f..ca9ffc6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,50 @@ # Changelog +## [13.0.0](https://github.com/LazyVim/LazyVim/compare/v12.44.1...v13.0.0) (2024-11-08) + + +### ⚠ BREAKING CHANGES + +* **core:** move a bunch of LazyVim features to snacks.nvim ([#4706](https://github.com/LazyVim/LazyVim/issues/4706)) + +### Features + +* **core:** move a bunch of LazyVim features to snacks.nvim ([#4706](https://github.com/LazyVim/LazyVim/issues/4706)) ([2f46974](https://github.com/LazyVim/LazyVim/commit/2f4697443c0186663ba4421bd4b856e36c3bd7cc)) +* **elixir:** add support for livebook files (`*.livemd`) ([#4184](https://github.com/LazyVim/LazyVim/issues/4184)) ([2fcd4cd](https://github.com/LazyVim/LazyVim/commit/2fcd4cdc5fdbed0d2ac097db31578acb0b86b8a2)) +* **eslint:** add option to disable eslint auto format ([#4225](https://github.com/LazyVim/LazyVim/issues/4225)) ([2d2e425](https://github.com/LazyVim/LazyVim/commit/2d2e425d25b02b93ef3e4ce4cb0a3edc30903fa5)) +* **extras.nushell:** update to upstream treesitter ([#4715](https://github.com/LazyVim/LazyVim/issues/4715)) ([37cc039](https://github.com/LazyVim/LazyVim/commit/37cc03948d8a2475c4889d788df17b293bb7d1e9)) +* **extras:** lang/zig ([#4437](https://github.com/LazyVim/LazyVim/issues/4437)) ([4379faf](https://github.com/LazyVim/LazyVim/commit/4379fafc7bbfe69f4e4d0da8131089cb7601f7c4)) +* **extras:** rego language support ([#4297](https://github.com/LazyVim/LazyVim/issues/4297)) ([cf86484](https://github.com/LazyVim/LazyVim/commit/cf86484797f70d1783166e8f572a4cfedd510ab5)) +* **keymaps:** only add lazygit keymaps when available. Closes [#4643](https://github.com/LazyVim/LazyVim/issues/4643). Closes [#4247](https://github.com/LazyVim/LazyVim/issues/4247) ([aa53cd4](https://github.com/LazyVim/LazyVim/commit/aa53cd47c45ad4a087a35ab9150807d1dfef65ed)) +* **lang.angular:** configure `prettier` as formatter for `angular` templates ([#4345](https://github.com/LazyVim/LazyVim/issues/4345)) ([2d6687c](https://github.com/LazyVim/LazyVim/commit/2d6687c6460e8e4ab639bc0a655d7c3f2b90d002)) +* **scala:** add key for worksheet hover ([#3853](https://github.com/LazyVim/LazyVim/issues/3853)) ([859646f](https://github.com/LazyVim/LazyVim/commit/859646f628ff0d99e6afe835ba0a48faed2972af)) +* **toggle:** add illuminate toggle for which-key ([#4708](https://github.com/LazyVim/LazyVim/issues/4708)) ([67ba582](https://github.com/LazyVim/LazyVim/commit/67ba58215b9122f4c422801c4af74412a8aa21d4)) + + +### Bug Fixes + +* **blink:** remove `draw="reversed"` for now till new release ([b841a1d](https://github.com/LazyVim/LazyVim/commit/b841a1dfc36f68033ed02866b57a0a03112b06c3)) +* **copilot-chat:** setup cmp conditionally ([#4716](https://github.com/LazyVim/LazyVim/issues/4716)) ([a86c252](https://github.com/LazyVim/LazyVim/commit/a86c25286b83d766af8935db31417c0ce417b865)) +* **dap:** use dap's splitstr when running with args. Closes [#4387](https://github.com/LazyVim/LazyVim/issues/4387) ([776994a](https://github.com/LazyVim/LazyVim/commit/776994a20703d9f9cca380dbb0398ec2a6d79bd8)) +* **dial:** follow comment explanation for integers ([#4658](https://github.com/LazyVim/LazyVim/issues/4658)) ([c879b39](https://github.com/LazyVim/LazyVim/commit/c879b397c7c4998c060247c0aa7ab68400967022)) +* **extras:** make kulala keys only for http files ([#4574](https://github.com/LazyVim/LazyVim/issues/4574)) ([b0ced33](https://github.com/LazyVim/LazyVim/commit/b0ced339a8e19253b93c147e796e921c44735418)) +* **extras:** use the correct naming when setting up eruby formatter ([#4625](https://github.com/LazyVim/LazyVim/issues/4625)) ([8534af4](https://github.com/LazyVim/LazyVim/commit/8534af4a7938d6fb8e7cfe5314ad13943414a42e)) +* **lang/r:** make keymaps in which-key menu available in visual mode ([#4565](https://github.com/LazyVim/LazyVim/issues/4565)) ([ee2ec7e](https://github.com/LazyVim/LazyVim/commit/ee2ec7e4747f1be73f56f8a5f75047e5bc64cc93)) +* **lang/ruby:** do not enable Rubocop as LSP if Solargraph is used ([#4566](https://github.com/LazyVim/LazyVim/issues/4566)) ([fd361d0](https://github.com/LazyVim/LazyVim/commit/fd361d07a295313273c64548784fdcdea59b8a69)) +* **lsp:** wrap hover and signature_help ([7616816](https://github.com/LazyVim/LazyVim/commit/76168166e565a5aa135f2b5c5dabb2ffbb8a6075)) +* **lualine:** apply highlight groups correctly to truncated pretty_paths ([#4379](https://github.com/LazyVim/LazyVim/issues/4379)) ([1d4157e](https://github.com/LazyVim/LazyVim/commit/1d4157e68128373609385452d594b3bdf77b0fc0)) +* **lualine:** make sure path is in root before substituting ([67b216c](https://github.com/LazyVim/LazyVim/commit/67b216c973dd03fee84e362465266bab96402831)) +* **navic:** use the same background color as lualine section_c ([#4231](https://github.com/LazyVim/LazyVim/issues/4231)) ([64b0f0b](https://github.com/LazyVim/LazyVim/commit/64b0f0b71d2678ca1342429c594eee61d8b9e0af)) +* **neotest:** disambiguous key map descriptions ([#4374](https://github.com/LazyVim/LazyVim/issues/4374)) ([dfde914](https://github.com/LazyVim/LazyVim/commit/dfde9148ef128d8c81a836ff85eb9cd25a01ac1f)) +* **options:** disable default ruler ([#4731](https://github.com/LazyVim/LazyVim/issues/4731)) ([da3058a](https://github.com/LazyVim/LazyVim/commit/da3058a72dbf086128b10ce19a0011000669b9ff)) +* **options:** removed deprecated options ([1e975be](https://github.com/LazyVim/LazyVim/commit/1e975be7a547f9a2dea63edb21cbaefab40d0cfa)) +* **prettier:** keep existing formatters_by_ft ([#4719](https://github.com/LazyVim/LazyVim/issues/4719)) ([4ff3606](https://github.com/LazyVim/LazyVim/commit/4ff36062dd33b852f9734d3731c55a5a8c50cf75)) +* **project.nvim:** correctly delete projects ([#4314](https://github.com/LazyVim/LazyVim/issues/4314)) ([c097355](https://github.com/LazyVim/LazyVim/commit/c09735594a26a1749b775847c958e98f566fbac5)) +* **snacks:** dont add `snacks_notif` to close_with_q ([e6f612f](https://github.com/LazyVim/LazyVim/commit/e6f612f1cc5dfe942a4b48878d8c356c32232fad)) +* **snippet:** don't set navigation mappings in nightly ([#4375](https://github.com/LazyVim/LazyVim/issues/4375)) ([1552791](https://github.com/LazyVim/LazyVim/commit/15527910c321f3a6a01e1216442f8d21e5f19247)) +* **telescope:** buffers to start at final item ([#4189](https://github.com/LazyVim/LazyVim/issues/4189)) ([f78bc3b](https://github.com/LazyVim/LazyVim/commit/f78bc3b85881b43fd082add4c80d9a75c573a882)) +* **telescope:** check for gmake if needed ([0bc09d8](https://github.com/LazyVim/LazyVim/commit/0bc09d8206cfec1a4b3481acbc3e864a548c499a)) + ## [12.44.1](https://github.com/LazyVim/LazyVim/compare/v12.44.0...v12.44.1) (2024-11-03) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index f1a8cf21..af389ff6 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 = "12.44.1" -- x-release-please-version +M.version = "13.0.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions From 548fddd1d5db65a80b11500e32cfe86e69bc8777 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 8 Nov 2024 21:05:30 +0100 Subject: [PATCH 55/77] fix(options): make sure spelling works in regular text files --- lua/lazyvim/config/options.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 34819686..726f869d 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -82,7 +82,6 @@ opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift t opt.smartcase = true -- Don't ignore case with capitals opt.smartindent = true -- Insert indents automatically opt.spelllang = { "en" } -opt.spelloptions:append("noplainbuffer") opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current From 94b42193272569f8005587069733f3ba0610bc9b Mon Sep 17 00:00:00 2001 From: EJ <8498296+maddawik@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:08:21 -0500 Subject: [PATCH 56/77] fix(extras): lazy-load telescope-terraform plugins (#4667) ## Description In the current terraform extra, both `cappyzawa/telescope-terraform.nvim` and `ANGkeith/telescope-terraform-doc.nvim` are dependencies of `telescope.nvim`. This should be reversed so that the telescope extensions only load when needed (I added a `ft` trigger which I think makes the most sense), and not as a dependency of `telescope.nvim`. ## Related Issue(s) No related issues, just fixed this when the loading time of `telescope-terraform-doc.nvim` in-particular was annoying (+~30ms startup). ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/terraform.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 5ab58f86..43d30935 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -58,9 +58,10 @@ return { { "nvim-telescope/telescope.nvim", optional = true, - dependencies = { + specs = { { "ANGkeith/telescope-terraform-doc.nvim", + ft = { "terraform", "hcl" }, config = function() LazyVim.on_load("telescope.nvim", function() require("telescope").load_extension("terraform_doc") @@ -69,6 +70,7 @@ return { }, { "cappyzawa/telescope-terraform.nvim", + ft = { "terraform", "hcl" }, config = function() LazyVim.on_load("telescope.nvim", function() require("telescope").load_extension("terraform") From 4876d1137d374af6f39661e402926220517ae4ab Mon Sep 17 00:00:00 2001 From: loqusion Date: Fri, 8 Nov 2024 14:14:22 -0600 Subject: [PATCH 57/77] feat(terraform): add formatter for packer files (#4591) ## Description Adds a formatter for Packer configuration files (`ft=hcl`), a file type already partially supported by the `lang.terraform` extra. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/terraform.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/terraform.lua b/lua/lazyvim/plugins/extras/lang/terraform.lua index 43d30935..8ae3f843 100644 --- a/lua/lazyvim/plugins/extras/lang/terraform.lua +++ b/lua/lazyvim/plugins/extras/lang/terraform.lua @@ -29,6 +29,7 @@ return { opts = function(_, opts) local null_ls = require("null-ls") opts.sources = vim.list_extend(opts.sources or {}, { + null_ls.builtins.formatting.packer, null_ls.builtins.formatting.terraform_fmt, null_ls.builtins.diagnostics.terraform_validate, }) @@ -49,6 +50,7 @@ return { optional = true, opts = { formatters_by_ft = { + hcl = { "packer_fmt" }, terraform = { "terraform_fmt" }, tf = { "terraform_fmt" }, ["terraform-vars"] = { "terraform_fmt" }, From 220148f47f175229232eee31982577fbdd637663 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 9 Nov 2024 15:49:39 +0100 Subject: [PATCH 58/77] fix(snacks): noice now honors `Snacks.config.notifier.enabled = false` --- lua/lazyvim/plugins/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index ad646b8e..5d305a75 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -31,7 +31,6 @@ return { ---@type snacks.Config return { toggle = { map = LazyVim.safe_keymap_set }, - notifier = { enabled = not LazyVim.has("noice.nvim") }, terminal = { win = { keys = { From 5b66db294f8dbeccbd76571ba69ef35d1a0a0b6f Mon Sep 17 00:00:00 2001 From: folke Date: Sat, 9 Nov 2024 14:50:33 +0000 Subject: [PATCH 59/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index ec46d7d2..b7e4dd5d 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 08 +*LazyVim.txt* For Neovim Last change: 2024 November 09 ============================================================================== Table of Contents *LazyVim-table-of-contents* From f57944f926176a9782c5e3f2804bec0132195d77 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:51:45 +0100 Subject: [PATCH 60/77] chore(main): release 13.1.0 (#4733) :robot: I have created a release *beep* *boop* --- ## [13.1.0](https://github.com/LazyVim/LazyVim/compare/v13.0.0...v13.1.0) (2024-11-09) ### Features * **terraform:** add formatter for packer files ([#4591](https://github.com/LazyVim/LazyVim/issues/4591)) ([4876d11](https://github.com/LazyVim/LazyVim/commit/4876d1137d374af6f39661e402926220517ae4ab)) ### Bug Fixes * **extras:** lazy-load telescope-terraform plugins ([#4667](https://github.com/LazyVim/LazyVim/issues/4667)) ([94b4219](https://github.com/LazyVim/LazyVim/commit/94b42193272569f8005587069733f3ba0610bc9b)) * **options:** make sure spelling works in regular text files ([548fddd](https://github.com/LazyVim/LazyVim/commit/548fddd1d5db65a80b11500e32cfe86e69bc8777)) * **snacks:** noice now honors `Snacks.config.notifier.enabled = false` ([220148f](https://github.com/LazyVim/LazyVim/commit/220148f47f175229232eee31982577fbdd637663)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/.release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 2af89238..f045d1cc 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "13.0.0" + ".": "13.1.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9ffc6c..9a33475c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [13.1.0](https://github.com/LazyVim/LazyVim/compare/v13.0.0...v13.1.0) (2024-11-09) + + +### Features + +* **terraform:** add formatter for packer files ([#4591](https://github.com/LazyVim/LazyVim/issues/4591)) ([4876d11](https://github.com/LazyVim/LazyVim/commit/4876d1137d374af6f39661e402926220517ae4ab)) + + +### Bug Fixes + +* **extras:** lazy-load telescope-terraform plugins ([#4667](https://github.com/LazyVim/LazyVim/issues/4667)) ([94b4219](https://github.com/LazyVim/LazyVim/commit/94b42193272569f8005587069733f3ba0610bc9b)) +* **options:** make sure spelling works in regular text files ([548fddd](https://github.com/LazyVim/LazyVim/commit/548fddd1d5db65a80b11500e32cfe86e69bc8777)) +* **snacks:** noice now honors `Snacks.config.notifier.enabled = false` ([220148f](https://github.com/LazyVim/LazyVim/commit/220148f47f175229232eee31982577fbdd637663)) + ## [13.0.0](https://github.com/LazyVim/LazyVim/compare/v12.44.1...v13.0.0) (2024-11-08) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index af389ff6..e48837de 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 = "13.0.0" -- x-release-please-version +M.version = "13.1.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions From 9c9e650530dcd211afd5a8b7f5e3e33e44abd11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Sim=C3=B5es?= Date: Sat, 9 Nov 2024 09:57:48 -0500 Subject: [PATCH 61/77] fix(extras): fix alpha-nvim non-string keycodes (#4735) ## Description The `dashboard.button` function provided by alpha-nvim expects a string keybind, not a function: https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/dashboard.lua#L63 ## Related Issue(s) Fixes https://github.com/LazyVim/LazyVim/issues/3728. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/ui/alpha.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index 1898bd08..33f79ba9 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -23,11 +23,11 @@ return { dashboard.section.header.val = vim.split(logo, "\n") -- stylua: ignore dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", LazyVim.pick()), + dashboard.button("f", " " .. " Find file", " lua LazyVim.pick()() "), dashboard.button("n", " " .. " New file", [[ ene startinsert ]]), - dashboard.button("r", " " .. " Recent files", LazyVim.pick("oldfiles")), - dashboard.button("g", " " .. " Find text", LazyVim.pick("live_grep")), - dashboard.button("c", " " .. " Config", LazyVim.pick.config_files()), + dashboard.button("r", " " .. " Recent files", [[ lua LazyVim.pick("oldfiles")() ]]), + dashboard.button("g", " " .. " Find text", [[ lua LazyVim.pick("live_grep")() ]]), + dashboard.button("c", " " .. " Config", " lua LazyVim.pick.config_files()() "), dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), dashboard.button("x", " " .. " Lazy Extras", " LazyExtras "), dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), From 24665fc73651970e5a1e20a63d6031bd99b97637 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 9 Nov 2024 16:13:11 +0100 Subject: [PATCH 62/77] feat(keymaps): leader-bo to close other buffers --- lua/lazyvim/config/keymaps.lua | 3 +++ lua/lazyvim/plugins/ui.lua | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c4160bef..e12ff3f7 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -40,6 +40,9 @@ map("n", "`", "e #", { desc = "Switch to Other Buffer" }) map("n", "bd", function() Snacks.bufdelete() end, { desc = "Delete Buffer" }) +map("n", "bo", function() + Snacks.bufdelete.other() +end, { desc = "Delete Other Buffers" }) map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) -- Clear search with diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 136c372b..0361826e 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -7,7 +7,6 @@ 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" }, From b9dae579612ccf1cd749150ff1603ff6dffc2610 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 9 Nov 2024 23:33:05 +0100 Subject: [PATCH 63/77] perf(ui): only enable treesitter folds if the buffer has treesitter highlighting --- lua/lazyvim/util/ui.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 14d0850f..267137dc 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -53,6 +53,11 @@ local skip_check = assert(vim.uv.new_check()) function M.foldexpr() local buf = vim.api.nvim_get_current_buf() + -- no highlight, no foldexpr + if not vim.b[buf].ts_highlight then + return "0" + end + -- still in the same tick and no parser if M.skip_foldexpr[buf] then return "0" From 309d1894484777b66845c26d45ccb1b59e8e68c3 Mon Sep 17 00:00:00 2001 From: folke Date: Sun, 10 Nov 2024 07:19:09 +0000 Subject: [PATCH 64/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index b7e4dd5d..f1f430a7 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 09 +*LazyVim.txt* For Neovim Last change: 2024 November 10 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 86904d2fb1ef406386b2dad43f42756e09b28182 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 10 Nov 2024 11:27:21 +0100 Subject: [PATCH 65/77] feat(ai): move ai related extras from `coding` to `ai` (#4751) ## Description ## Related Issue(s) ## Screenshots ## Checklist - [ ] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/init.lua | 2 +- lua/lazyvim/plugins/extras/{coding => ai}/codeium.lua | 0 lua/lazyvim/plugins/extras/{coding => ai}/copilot-chat.lua | 0 lua/lazyvim/plugins/extras/{coding => ai}/copilot.lua | 0 lua/lazyvim/plugins/extras/{coding => ai}/tabnine.lua | 0 lua/lazyvim/util/json.lua | 7 +++++++ 6 files changed, 8 insertions(+), 1 deletion(-) rename lua/lazyvim/plugins/extras/{coding => ai}/codeium.lua (100%) rename lua/lazyvim/plugins/extras/{coding => ai}/copilot-chat.lua (100%) rename lua/lazyvim/plugins/extras/{coding => ai}/copilot.lua (100%) rename lua/lazyvim/plugins/extras/{coding => ai}/tabnine.lua (100%) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index e48837de..5c148a92 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -135,7 +135,7 @@ local defaults = { } M.json = { - version = 6, + version = 7, path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json", data = { version = nil, ---@type string? diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua similarity index 100% rename from lua/lazyvim/plugins/extras/coding/codeium.lua rename to lua/lazyvim/plugins/extras/ai/codeium.lua diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua similarity index 100% rename from lua/lazyvim/plugins/extras/coding/copilot-chat.lua rename to lua/lazyvim/plugins/extras/ai/copilot-chat.lua diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua similarity index 100% rename from lua/lazyvim/plugins/extras/coding/copilot.lua rename to lua/lazyvim/plugins/extras/ai/copilot.lua diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/ai/tabnine.lua similarity index 100% rename from lua/lazyvim/plugins/extras/coding/tabnine.lua rename to lua/lazyvim/plugins/extras/ai/tabnine.lua diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua index a823606a..f3ca7fcf 100644 --- a/lua/lazyvim/util/json.lua +++ b/lua/lazyvim/util/json.lua @@ -90,6 +90,13 @@ function M.migrate() json.data.extras = vim.tbl_filter(function(extra) return not (extra == "lazyvim.plugins.extras.editor.trouble-v3") end, json.data.extras or {}) + elseif json.data.version == 6 then + local ai = { "copilot", "codeium", "copilot-chat", "tabnine" } + json.data.extras = vim.tbl_map(function(extra) + return extra:gsub("^lazyvim%.plugins%.extras%.coding%.(.*)$", function(name) + return vim.tbl_contains(ai, name) and ("lazyvim.plugins.extras.ai." .. name) or extra + end) + end, json.data.extras or {}) end M.save() From 17a1b846f08db62e3a93c76426db4017ad3cc2eb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 11 Nov 2024 09:37:47 +0100 Subject: [PATCH 66/77] fix(snacks): allow overriding `statuscolumn` through `options.lua` --- lua/lazyvim/config/options.lua | 1 + lua/lazyvim/plugins/init.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 726f869d..bfd77056 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -85,6 +85,7 @@ opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current +opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index 5d305a75..c0e27c14 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -31,6 +31,7 @@ return { ---@type snacks.Config return { toggle = { map = LazyVim.safe_keymap_set }, + statuscolumn = { enabled = false }, -- we set this in options.lua terminal = { win = { keys = { From dcab30f2426a34c3612bc12b2170c508eaa770ef Mon Sep 17 00:00:00 2001 From: folke Date: Mon, 11 Nov 2024 08:38:55 +0000 Subject: [PATCH 67/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index f1f430a7..f0ae8f04 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 10 +*LazyVim.txt* For Neovim Last change: 2024 November 11 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 06071dd452baf1e9b8b5aab140553c4f51fa522e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 11 Nov 2024 09:41:43 +0100 Subject: [PATCH 68/77] fix(vscode): added snacks.nvim to allowed plugins for vscode. Fixes #4757 --- lua/lazyvim/plugins/extras/vscode.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index a272d2ce..e941d91c 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -3,6 +3,7 @@ if not vim.g.vscode then end local enabled = { + "LazyVim", "dial.nvim", "flit.nvim", "lazy.nvim", @@ -15,10 +16,10 @@ local enabled = { "nvim-treesitter", "nvim-treesitter-textobjects", "nvim-ts-context-commentstring", + "snacks.nvim", "ts-comments.nvim", "vim-repeat", "yanky.nvim", - "LazyVim", } local Config = require("lazy.core.config") From c22db724351bc7a05c56046c48d23a2be8efe71b Mon Sep 17 00:00:00 2001 From: cbosvik <132846580+cbosvik@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:44:11 +0100 Subject: [PATCH 69/77] feat(rest): add more keymaps to util.rest (#4467) ## Description Add keymaps util.rest extra ## Related Issue(s) n/a ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: janbua Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/util/rest.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/util/rest.lua b/lua/lazyvim/plugins/extras/util/rest.lua index a8e12154..9f2e6d67 100644 --- a/lua/lazyvim/plugins/extras/util/rest.lua +++ b/lua/lazyvim/plugins/extras/util/rest.lua @@ -9,10 +9,23 @@ return { ft = "http", keys = { { "R", "", desc = "+Rest", ft = "http" }, - { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, - { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, - { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, + { "Rb", "lua require('kulala').scratchpad()", desc = "Open scratchpad", ft = "http" }, + { "Rc", "lua require('kulala').copy()", desc = "Copy as cURL", ft = "http" }, + { "RC", "lua require('kulala').from_curl()", desc = "Paste from curl", ft = "http" }, + { + "Rg", + "lua require('kulala').download_graphql_schema()", + desc = "Download GraphQL schema", + ft = "http", + }, + { "Ri", "lua require('kulala').inspect()", desc = "Inspect current request", ft = "http" }, { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request", ft = "http" }, + { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, + { "Rq", "lua require('kulala').close()", desc = "Close window", ft = "http" }, + { "Rr", "lua require('kulala').replay()", desc = "Replay the last request", ft = "http" }, + { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, + { "RS", "lua require('kulala').show_stats()", desc = "Show stats", ft = "http" }, + { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, }, opts = {}, }, From fbf881f80b8f0fb2d9e4bc69d04f66323b25c4b9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 11 Nov 2024 10:50:57 +0100 Subject: [PATCH 70/77] feat(ai): better completion/suggestions of AI engines (#4752) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description The whole completion / snippets / AI is very tricky: - multiple snippet engines - native snippets on > 0.11 set their own keymaps, but not on 0.10 - multiple completion engines, like `nvim-cmp` and `blink.cmp` - multiple ai completion engines that have a different API - user's preference of showing ai suggestions as completion or not - none of the ai completion engines currently set undo points, which is bad Solution: - [x] added `LazyVim.cmp.actions`, where snippet engines and ai engines can register their action. - [x] an action returns `true` if it succeeded, or `false|nil` otherwise - [x] in a completion engine, we then try running multiple actions and use the fallback if needed - [x] so `` runs `{"snippet_forward", "ai_accept", "fallback"}` - [x] added `vim.g.ai_cmp`. When `true` we try to integrate the AI source in the completion engine. - [x] when `false`, `` should be used to insert the AI suggestion - [x] when `false`, the completion engine's ghost text is disabled - [x] luasnip support for blink (only works with blink `main`) - [x] create undo points when accepting AI suggestions ## Test Matrix | completion | snippets | ai | ai_cmp | tested? | |--------------|--------------|-------------|--------|---------| | nvim-cmp | native | copilot | true | ✅ | | nvim-cmp | native | copilot | false | ✅ | | nvim-cmp | native | codeium | true | ✅ | | nvim-cmp | native | codeium | false | ✅ | | nvim-cmp | luasnip | copilot | true | ✅ | | nvim-cmp | luasnip | copilot | false | ✅ | | nvim-cmp | luasnip | codeium | true | ✅ | | nvim-cmp | luasnip | codeium | false | ✅ | | blink.cmp | native | copilot | true | ✅ | | blink.cmp | native | copilot | false | ✅ | | blink.cmp | native | codeium | true | ✅ | | blink.cmp | native | codeium | false | ✅ | | blink.cmp | luasnip | copilot | true | ✅ | | blink.cmp | luasnip | copilot | false | ✅ | | blink.cmp | luasnip | codeium | true | ✅ | | blink.cmp | luasnip | codeium | false | ✅ | ## Related Issue(s) - [ ] Closes #4702 ## Screenshots ## Checklist - [ ] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/keymaps.lua | 10 ++ lua/lazyvim/config/options.lua | 4 + lua/lazyvim/plugins/coding.lua | 19 +--- lua/lazyvim/plugins/extras/ai/codeium.lua | 58 ++++++++-- lua/lazyvim/plugins/extras/ai/copilot.lua | 103 +++++++++--------- lua/lazyvim/plugins/extras/coding/blink.lua | 40 ++++++- lua/lazyvim/plugins/extras/coding/luasnip.lua | 63 +++++++---- lua/lazyvim/util/cmp.lua | 30 +++++ lua/lazyvim/util/lualine.lua | 2 +- 9 files changed, 230 insertions(+), 99 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index e12ff3f7..5a9fbc80 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -180,3 +180,13 @@ map("n", "", "tabnew", { desc = "New Tab" }) map("n", "]", "tabnext", { desc = "Next Tab" }) map("n", "d", "tabclose", { desc = "Close Tab" }) map("n", "[", "tabprevious", { desc = "Previous Tab" }) + +-- native snippets. only needed on < 0.11, as 0.11 creates these by default +if vim.fn.has("nvim-0.11") == 0 then + map("s", "", function() + return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" + end, { expr = true, desc = "Jump Next" }) + map({ "i", "s" }, "", function() + return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" + end, { expr = true, desc = "Jump Previous" }) +end diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index bfd77056..bc504675 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -11,6 +11,10 @@ vim.g.autoformat = true -- enabled with `:LazyExtras` vim.g.lazyvim_picker = "auto" +-- if the completion engine supports the AI source, +-- use that instead of inline suggestions +vim.g.ai_cmp = true + -- LazyVim root dir detection -- Each entry can be: -- * the name of a detector function like `lsp` or `cwd` diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 8f1d7968..5b2901e3 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -43,6 +43,9 @@ return { cmp.abort() fallback() end, + [""] = function(fallback) + return LazyVim.cmp.map({ "snippet_forward", "ai_accept" }, fallback)() + end, }), sources = cmp.config.sources({ { name = "nvim_lsp" }, @@ -72,9 +75,10 @@ return { end, }, experimental = { - ghost_text = { + -- only show ghost text when we show ai completions + ghost_text = vim.g.ai_cmp and { hl_group = "CmpGhostText", - }, + } or false, }, sorting = defaults.sorting, } @@ -105,17 +109,6 @@ return { table.insert(opts.sources, { name = "snippets" }) end end, - init = function() - -- Neovim enabled snippet navigation mappings by default in v0.11 - if vim.fn.has("nvim-0.11") == 0 then - vim.keymap.set({ "i", "s" }, "", function() - return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, { expr = true, silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, { expr = true, silent = true }) - end - end, }, -- auto pairs diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua index b95ad433..6d2646a1 100644 --- a/lua/lazyvim/plugins/extras/ai/codeium.lua +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -1,18 +1,42 @@ return { + -- codeium + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = { + enable_cmp_source = vim.g.ai_cmp, + virtual_text = { + enabled = not vim.g.ai_cmp, + key_bindings = { + accept = false, -- handled by nvim-cmp / blink.cmp + next = "", + prev = "", + }, + }, + }, + }, + + -- add ai_accept action + { + "Exafunction/codeium.nvim", + opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("codeium.virtual_text").get_current_completion_item() then + LazyVim.create_undo() + vim.api.nvim_input(require("codeium.virtual_text").accept()) + return true + end + end + end, + }, + -- codeium cmp source { "nvim-cmp", - dependencies = { - -- codeium - { - "Exafunction/codeium.nvim", - cmd = "Codeium", - build = ":Codeium Auth", - opts = {}, - }, - }, - ---@param opts cmp.ConfigSchema + optional = true, + dependencies = { "codeium.nvim" }, opts = function(_, opts) table.insert(opts.sources, 1, { name = "codeium", @@ -30,4 +54,18 @@ return { table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium")) end, }, + + { + "saghen/blink.cmp", + optional = true, + opts = { + sources = { + compat = vim.g.ai_cmp and { "codeium" } or nil, + }, + }, + dependencies = { + "codeium.nvim", + vim.g.ai_cmp and "saghen/blink.compat" or nil, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 22ba0c64..69429e33 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -5,8 +5,17 @@ return { "zbirenbaum/copilot.lua", cmd = "Copilot", build = ":Copilot auth", + event = "InsertEnter", opts = { - suggestion = { enabled = false }, + suggestion = { + enabled = not vim.g.ai_cmp, + auto_trigger = true, + keymap = { + accept = false, -- handled by nvim-cmp / blink.cmp + next = "", + prev = "", + }, + }, panel = { enabled = false }, filetypes = { markdown = true, @@ -14,6 +23,22 @@ return { }, }, }, + + -- add ai_accept action + { + "zbirenbaum/copilot.lua", + opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("copilot.suggestion").is_visible() then + LazyVim.create_undo() + require("copilot.suggestion").accept() + return true + end + end + end, + }, + + -- lualine { "nvim-lualine/lualine.nvim", optional = true, @@ -55,70 +80,50 @@ return { -- copilot cmp source { "nvim-cmp", - dependencies = { + optional = true, + dependencies = { -- this will only be evaluated if nvim-cmp is enabled { "zbirenbaum/copilot-cmp", - dependencies = "copilot.lua", + enabled = vim.g.ai_cmp, -- only enable if wanted opts = {}, config = function(_, opts) local copilot_cmp = require("copilot_cmp") copilot_cmp.setup(opts) -- attach cmp source whenever copilot attaches -- fixes lazy-loading issues with the copilot cmp source - LazyVim.lsp.on_attach(function(client) + LazyVim.lsp.on_attach(function() copilot_cmp._on_insert_enter({}) end, "copilot") end, - }, - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) - end, - }, - - { - "saghen/blink.cmp", - optional = true, - specs = { - { - "zbirenbaum/copilot.lua", - event = "InsertEnter", - opts = { - suggestion = { - enabled = true, - auto_trigger = true, - keymap = { accept = false }, + specs = { + { + "nvim-cmp", + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "copilot", + group_index = 1, + priority = 100, + }) + end, }, }, }, }, + }, + + -- blink.cmp + { + "saghen/blink.cmp", + optional = true, opts = { - windows = { - ghost_text = { - enabled = false, - }, - }, - keymap = { - [""] = { - function(cmp) - if cmp.is_in_snippet() then - return cmp.accept() - elseif require("copilot.suggestion").is_visible() then - LazyVim.create_undo() - require("copilot.suggestion").accept() - return true - else - return cmp.select_and_accept() - end - end, - "snippet_forward", - "fallback", - }, + windows = { ghost_text = { enabled = false } }, + }, + specs = { + -- blink has no copilot source, so force enable suggestions + { + "zbirenbaum/copilot.lua", + opts = { suggestion = { enabled = true } }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index eb5d5471..9542db8d 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -1,3 +1,10 @@ +if lazyvim_docs then + -- set to `true` to follow the main branch + -- you need to have a working rust toolchain to build the plugin + -- in this case. + vim.g.lazyvim_blink_main = false +end + return { { "hrsh7th/nvim-cmp", @@ -5,8 +12,12 @@ return { }, { "saghen/blink.cmp", - version = "*", - opts_extend = { "sources.completion.enabled_providers" }, + version = not vim.g.lazyvim_blink_main and "*", + build = vim.g.lazyvim_blink_main and "cargo build --release", + opts_extend = { + "sources.completion.enabled_providers", + "sources.compat", + }, dependencies = { "rafamadriz/friendly-snippets", -- add blink.compat to dependencies @@ -35,7 +46,7 @@ return { auto_show = true, }, ghost_text = { - enabled = true, + enabled = vim.g.ai_cmp, }, }, @@ -45,6 +56,9 @@ return { -- experimental signature help support -- trigger = { signature_help = { enabled = true } } sources = { + -- adding any nvim-cmp sources here will enable them + -- with blink.compat + compat = {}, completion = { -- remember to enable your providers here enabled_providers = { "lsp", "path", "snippets", "buffer" }, @@ -53,8 +67,28 @@ return { keymap = { preset = "enter", + [""] = { + LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), + "fallback", + }, }, }, + ---@param opts blink.cmp.Config | { sources: { compat: string[] } } + config = function(_, opts) + -- setup compat sources + local enabled = opts.sources.completion.enabled_providers + for _, source in ipairs(opts.sources.compat or {}) do + opts.sources.providers[source] = vim.tbl_deep_extend( + "force", + { name = source, module = "blink.compat.source" }, + opts.sources.providers[source] or {} + ) + if type(enabled) == "table" and not vim.tbl_contains(enabled, source) then + table.insert(enabled, source) + end + end + require("blink.cmp").setup(opts) + end, }, -- add icons diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua index 47bd80c4..178cdd0a 100644 --- a/lua/lazyvim/plugins/extras/coding/luasnip.lua +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -1,4 +1,8 @@ return { + -- disable builtin snippet support + { "garymjr/nvim-snippets", enabled = false }, + + -- add luasnip { "L3MON4D3/LuaSnip", lazy = true, @@ -12,43 +16,56 @@ return { require("luasnip.loaders.from_vscode").lazy_load() end, }, - { - "nvim-cmp", - dependencies = { - "saadparwaiz1/cmp_luasnip", - }, - opts = function(_, opts) - opts.snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - } - table.insert(opts.sources, { name = "luasnip" }) - end, - }, }, opts = { history = true, delete_check_events = "TextChanged", }, }, + + -- add snippet_forward action + { + "L3MON4D3/LuaSnip", + opts = function() + LazyVim.cmp.actions.snippet_forward = function() + if require("luasnip").jumpable(1) then + require("luasnip").jump(1) + return true + end + end + end, + }, + + -- nvim-cmp integration { "nvim-cmp", + optional = true, + dependencies = { "saadparwaiz1/cmp_luasnip" }, + opts = function(_, opts) + opts.snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + } + table.insert(opts.sources, { name = "luasnip" }) + end, -- stylua: ignore keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, silent = true, mode = "i", - }, { "", function() require("luasnip").jump(1) end, mode = "s" }, { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, }, }, + + -- blink.cmp integration { - "garymjr/nvim-snippets", - enabled = false, + "saghen/blink.cmp", + optional = true, + opts = { + accept = { + expand_snippet = function(...) + return require("luasnip").lsp_expand(...) + end, + }, + }, }, } diff --git a/lua/lazyvim/util/cmp.lua b/lua/lazyvim/util/cmp.lua index 5eff81fa..ebe0209b 100644 --- a/lua/lazyvim/util/cmp.lua +++ b/lua/lazyvim/util/cmp.lua @@ -1,6 +1,36 @@ ---@class lazyvim.util.cmp local M = {} +---@alias lazyvim.util.cmp.Action fun():boolean? +---@type table +M.actions = { + -- Native Snippets + snippet_forward = function() + if vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) + return true + end + end, +} + +---@param actions string[] +---@param fallback? string|fun() +function M.map(actions, fallback) + return function() + for _, name in ipairs(actions) do + if M.actions[name] then + local ret = M.actions[name]() + if ret then + return true + end + end + end + return type(fallback) == "function" and fallback() or fallback + end +end + ---@alias Placeholder {n:number, text:string} ---@param snippet string diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index db8311c4..5df789fa 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -7,7 +7,7 @@ function M.cmp_source(name, icon) if not package.loaded["cmp"] then return end - for _, s in ipairs(require("cmp").core.sources) do + for _, s in ipairs(require("cmp").core.sources or {}) do if s.name == name then if s.source:is_available() then started = true From 0137a110c14e1d72b59dbb82ba804b568cdc5b18 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:09:35 +0100 Subject: [PATCH 71/77] chore(main): release 13.2.0 (#4745) :robot: I have created a release *beep* *boop* --- ## [13.2.0](https://github.com/LazyVim/LazyVim/compare/v13.1.0...v13.2.0) (2024-11-11) ### Features * **ai:** better completion/suggestions of AI engines ([#4752](https://github.com/LazyVim/LazyVim/issues/4752)) ([fbf881f](https://github.com/LazyVim/LazyVim/commit/fbf881f80b8f0fb2d9e4bc69d04f66323b25c4b9)) * **ai:** move ai related extras from `coding` to `ai` ([#4751](https://github.com/LazyVim/LazyVim/issues/4751)) ([86904d2](https://github.com/LazyVim/LazyVim/commit/86904d2fb1ef406386b2dad43f42756e09b28182)) * **keymaps:** leader-bo to close other buffers ([24665fc](https://github.com/LazyVim/LazyVim/commit/24665fc73651970e5a1e20a63d6031bd99b97637)) * **rest:** add more keymaps to util.rest ([#4467](https://github.com/LazyVim/LazyVim/issues/4467)) ([c22db72](https://github.com/LazyVim/LazyVim/commit/c22db724351bc7a05c56046c48d23a2be8efe71b)) ### Bug Fixes * **extras:** fix alpha-nvim non-string keycodes ([#4735](https://github.com/LazyVim/LazyVim/issues/4735)) ([9c9e650](https://github.com/LazyVim/LazyVim/commit/9c9e650530dcd211afd5a8b7f5e3e33e44abd11b)) * **snacks:** allow overriding `statuscolumn` through `options.lua` ([17a1b84](https://github.com/LazyVim/LazyVim/commit/17a1b846f08db62e3a93c76426db4017ad3cc2eb)) * **vscode:** added snacks.nvim to allowed plugins for vscode. Fixes [#4757](https://github.com/LazyVim/LazyVim/issues/4757) ([06071dd](https://github.com/LazyVim/LazyVim/commit/06071dd452baf1e9b8b5aab140553c4f51fa522e)) ### Performance Improvements * **ui:** only enable treesitter folds if the buffer has treesitter highlighting ([b9dae57](https://github.com/LazyVim/LazyVim/commit/b9dae579612ccf1cd749150ff1603ff6dffc2610)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/.release-please-manifest.json | 2 +- CHANGELOG.md | 22 ++++++++++++++++++++++ lua/lazyvim/config/init.lua | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index f045d1cc..70cd2de9 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "13.1.0" + ".": "13.2.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a33475c..8045be7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [13.2.0](https://github.com/LazyVim/LazyVim/compare/v13.1.0...v13.2.0) (2024-11-11) + + +### Features + +* **ai:** better completion/suggestions of AI engines ([#4752](https://github.com/LazyVim/LazyVim/issues/4752)) ([fbf881f](https://github.com/LazyVim/LazyVim/commit/fbf881f80b8f0fb2d9e4bc69d04f66323b25c4b9)) +* **ai:** move ai related extras from `coding` to `ai` ([#4751](https://github.com/LazyVim/LazyVim/issues/4751)) ([86904d2](https://github.com/LazyVim/LazyVim/commit/86904d2fb1ef406386b2dad43f42756e09b28182)) +* **keymaps:** leader-bo to close other buffers ([24665fc](https://github.com/LazyVim/LazyVim/commit/24665fc73651970e5a1e20a63d6031bd99b97637)) +* **rest:** add more keymaps to util.rest ([#4467](https://github.com/LazyVim/LazyVim/issues/4467)) ([c22db72](https://github.com/LazyVim/LazyVim/commit/c22db724351bc7a05c56046c48d23a2be8efe71b)) + + +### Bug Fixes + +* **extras:** fix alpha-nvim non-string keycodes ([#4735](https://github.com/LazyVim/LazyVim/issues/4735)) ([9c9e650](https://github.com/LazyVim/LazyVim/commit/9c9e650530dcd211afd5a8b7f5e3e33e44abd11b)) +* **snacks:** allow overriding `statuscolumn` through `options.lua` ([17a1b84](https://github.com/LazyVim/LazyVim/commit/17a1b846f08db62e3a93c76426db4017ad3cc2eb)) +* **vscode:** added snacks.nvim to allowed plugins for vscode. Fixes [#4757](https://github.com/LazyVim/LazyVim/issues/4757) ([06071dd](https://github.com/LazyVim/LazyVim/commit/06071dd452baf1e9b8b5aab140553c4f51fa522e)) + + +### Performance Improvements + +* **ui:** only enable treesitter folds if the buffer has treesitter highlighting ([b9dae57](https://github.com/LazyVim/LazyVim/commit/b9dae579612ccf1cd749150ff1603ff6dffc2610)) + ## [13.1.0](https://github.com/LazyVim/LazyVim/compare/v13.0.0...v13.1.0) (2024-11-09) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 5c148a92..3bccdba1 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 = "13.1.0" -- x-release-please-version +M.version = "13.2.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions From ea266e73265e32183acbec0bd39f8108e213770f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 11 Nov 2024 15:44:06 +0100 Subject: [PATCH 72/77] fix(lualine): normalize paths before calculating pretty path. Fixes #4763 --- lua/lazyvim/util/lualine.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 5df789fa..08308c56 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -91,6 +91,7 @@ function M.pretty_path(opts) return "" end + path = LazyVim.norm(path) local root = LazyVim.root.get({ normalize = true }) local cwd = LazyVim.root.cwd() From 5df382765b2bbeb5f3168b3597f33c419f31a2a7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 13 Nov 2024 17:20:50 +0100 Subject: [PATCH 73/77] refactor(lualine): status component --- lua/lazyvim/plugins/extras/ai/copilot.lua | 39 +++++-------------- lua/lazyvim/util/lualine.lua | 46 +++++++++++++---------- 2 files changed, 36 insertions(+), 49 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 69429e33..30d05ca1 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -44,36 +44,17 @@ return { optional = true, event = "VeryLazy", opts = function(_, opts) - local colors = { - [""] = LazyVim.ui.fg("Special"), - ["Normal"] = LazyVim.ui.fg("Special"), - ["Warning"] = LazyVim.ui.fg("DiagnosticError"), - ["InProgress"] = LazyVim.ui.fg("DiagnosticWarn"), - } - table.insert(opts.sections.lualine_x, 2, { - function() - local icon = LazyVim.config.icons.kinds.Copilot - local status = require("copilot.api").status.data - return icon .. (status.message or "") - end, - cond = function() - if not package.loaded["copilot"] then - return + table.insert( + opts.sections.lualine_x, + 2, + LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() + local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} + if #clients > 0 then + local status = require("copilot.api").status.data.status + return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" end - local ok, clients = pcall(LazyVim.lsp.get_clients, { name = "copilot", bufnr = 0 }) - if not ok then - return false - end - return ok and #clients > 0 - end, - color = function() - if not package.loaded["copilot"] then - return - end - local status = require("copilot.api").status.data - return colors[status.status] or colors[""] - end, - }) + end) + ) end, }, diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 08308c56..c759e6dc 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -1,9 +1,33 @@ ---@class lazyvim.util.lualine local M = {} +---@param icon string +---@param status fun(): nil|"ok"|"error"|"pending" +function M.status(icon, status) + local colors = { + ok = LazyVim.ui.fg("Special"), + error = LazyVim.ui.fg("DiagnosticError"), + pending = LazyVim.ui.fg("DiagnosticWarn"), + } + return { + function() + return icon + end, + cond = function() + return status() ~= nil + end, + color = function() + return colors[status()] or colors.ok + end, + } +end + +---@param name string +---@param icon? string function M.cmp_source(name, icon) + icon = icon or LazyVim.config.icons.kinds[name:sub(1, 1):upper() .. name:sub(2)] local started = false - local function status() + return M.status(icon, function() if not package.loaded["cmp"] then return end @@ -20,25 +44,7 @@ function M.cmp_source(name, icon) return "ok" end end - end - - local colors = { - ok = LazyVim.ui.fg("Special"), - error = LazyVim.ui.fg("DiagnosticError"), - pending = LazyVim.ui.fg("DiagnosticWarn"), - } - - return { - function() - return icon or 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) end ---@param component any From b98b048ec61b263f1d764fe5e4baba2913240597 Mon Sep 17 00:00:00 2001 From: folke Date: Wed, 13 Nov 2024 16:22:02 +0000 Subject: [PATCH 74/77] chore(build): auto-generate docs --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index f0ae8f04..449401af 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 11 +*LazyVim.txt* For Neovim Last change: 2024 November 13 ============================================================================== Table of Contents *LazyVim-table-of-contents* From c1e8e3c80d1d9d44e3795022b3f7d2703abccec6 Mon Sep 17 00:00:00 2001 From: Nybkox Date: Wed, 13 Nov 2024 17:49:47 +0100 Subject: [PATCH 75/77] feat(extras): add supermaven (#3491) Add fast copilot alternative --------- Co-authored-by: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Co-authored-by: Folke Lemaitre --- lua/lazyvim/config/init.lua | 1 + lua/lazyvim/plugins/extras/ai/supermaven.lua | 107 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/ai/supermaven.lua diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 3bccdba1..c6817a86 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -88,6 +88,7 @@ local defaults = { Snippet = " ", String = " ", Struct = "󰆼 ", + Supermaven = " ", TabNine = "󰏚 ", Text = " ", TypeParameter = " ", diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua new file mode 100644 index 00000000..57734ac4 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -0,0 +1,107 @@ +return { + { + "supermaven-inc/supermaven-nvim", + opts = { + keymaps = { + accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp + }, + disable_inline_completion = vim.g.ai_cmp, + }, + }, + + -- add ai_accept action + { + "supermaven-inc/supermaven-nvim", + opts = function() + require("supermaven-nvim.completion_preview").suggestion_group = "SupermavenSuggestion" + LazyVim.cmp.actions.ai_accept = function() + local suggestion = require("supermaven-nvim.completion_preview") + if suggestion.has_suggestion() then + LazyVim.create_undo() + vim.schedule(function() + suggestion.on_accept_suggestion() + end) + return true + end + end + end, + }, + + -- cmp integration + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "supermaven-nvim" }, + opts = function(_, opts) + if vim.g.ai_cmp then + table.insert(opts.sources, 1, { + name = "supermaven", + group_index = 1, + priority = 100, + }) + end + end, + }, + + -- blink.cmp integration + -- + -- FIXME: this currently doesn't work properly + -- { + -- "saghen/blink.cmp", + -- optional = true, + -- opts = { + -- sources = { + -- compat = vim.g.ai_cmp and { "supermaven" } or nil, + -- }, + -- }, + -- dependencies = { + -- "supermaven-nvim", + -- vim.g.ai_cmp and "saghen/blink.compat" or nil, + -- }, + -- }, + -- + -- Disabble cmp integration for now + { + "saghen/blink.cmp", + optional = true, + opts = { + windows = { ghost_text = { enabled = false } }, + }, + dependencies = { + { + "supermaven-nvim", + opts = { + disable_inline_completion = false, + }, + }, + }, + }, + + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("supermaven")) + end, + }, + + { + "folke/noice.nvim", + optional = true, + opts = function(_, opts) + vim.list_extend(opts.routes, { + { + filter = { + event = "msg_show", + any = { + { find = "Starting Supermaven" }, + { find = "Supermaven Free Tier" }, + }, + }, + skip = true, + }, + }) + end, + }, +} From a7eca056096486b20ce37b20979c0d712e49fe76 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 13 Nov 2024 18:28:58 +0100 Subject: [PATCH 76/77] feat(copilot): added support for blink.cmp source --- lua/lazyvim/plugins/extras/ai/copilot.lua | 25 ++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 30d05ca1..d78e654d 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -97,14 +97,25 @@ return { { "saghen/blink.cmp", optional = true, - opts = { - windows = { ghost_text = { enabled = false } }, - }, - specs = { - -- blink has no copilot source, so force enable suggestions + dependencies = { { - "zbirenbaum/copilot.lua", - opts = { suggestion = { enabled = true } }, + "giuxtaposition/blink-cmp-copilot", + enabled = vim.g.ai_cmp, -- only enable if needed + specs = { + { + "blink.cmp", + opts = { + sources = { + providers = { + copilot = { name = "copilot", module = "blink-cmp-copilot" }, + }, + completion = { + enabled_providers = { "copilot" }, + }, + }, + }, + }, + }, }, }, }, From 5e485d39b4cc5aca1aedae4d441fb2bfb3bfbf67 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 13 Nov 2024 19:00:07 +0100 Subject: [PATCH 77/77] fix(dial.nvim): added boolean and logical toggles to default group. Fixes #4515 --- lua/lazyvim/plugins/extras/editor/dial.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 4bfb285d..1fdfcd95 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -118,6 +118,9 @@ return { ordinal_numbers, weekdays, months, + capitalized_boolean, + augend.constant.alias.bool, -- boolean value (true <-> false) + logical_alias, }, typescript = { augend.integer.alias.decimal_int, -- nonnegative and negative decimal number