diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index a2c4b235..e2b3ecea 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.42.0" + ".": "12.44.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d3f2dcf8..5e0dd3b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,42 @@ # 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) + + +### Features + +* **catppuccin:** bufferline integration. Closes [#4583](https://github.com/LazyVim/LazyVim/issues/4583). Closes [#4581](https://github.com/LazyVim/LazyVim/issues/4581) ([917c685](https://github.com/LazyVim/LazyVim/commit/917c685c1fb3774375ea2236e5e7aaa3d951fdda)) +* **extras:** expose `prios` to users for customization ([#4587](https://github.com/LazyVim/LazyVim/issues/4587)) ([e46cb62](https://github.com/LazyVim/LazyVim/commit/e46cb62a17e1f4b7f163f4e0fdd13593c4af3abd)) +* **keymaps:** allow `v:count1` when moving lines ([#4618](https://github.com/LazyVim/LazyVim/issues/4618)) ([b4eb4e1](https://github.com/LazyVim/LazyVim/commit/b4eb4e1f4a4024229fe40782fdb12683c1c69634)) + + +### Bug Fixes + +* **folds:** enable folds when treesitter available. Fixes [#4563](https://github.com/LazyVim/LazyVim/issues/4563) ([fe7003d](https://github.com/LazyVim/LazyVim/commit/fe7003de506ef7022a6c5f623476630d7bc30944)) + ## [12.42.0](https://github.com/LazyVim/LazyVim/compare/v12.41.0...v12.42.0) (2024-10-04) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index b0c811f3..301c542c 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 October 04 +*LazyVim.txt* For Neovim Last change: 2024 November 03 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 7839950b..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, }) @@ -72,11 +72,16 @@ vim.api.nvim_create_autocmd("FileType", { }, callback = function(event) vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "q", "close", { - buffer = event.buf, - silent = true, - desc = "Quit buffer", - }) + vim.schedule(function() + vim.keymap.set("n", "q", function() + vim.cmd("close") + pcall(vim.api.nvim_buf_delete, event.buf, { force = true }) + end, { + buffer = event.buf, + silent = true, + desc = "Quit buffer", + }) + end) end, }) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 6472fe9f..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.42.0" -- x-release-please-version +M.version = "12.44.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index a6f1c574..cc226964 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -23,12 +23,12 @@ map("n", "", "vertical resize -2", { desc = "Decrease Window Wi map("n", "", "vertical resize +2", { desc = "Increase Window Width" }) -- Move Lines -map("n", "", "m .+1==", { desc = "Move Down" }) -map("n", "", "m .-2==", { desc = "Move Up" }) +map("n", "", "execute 'move .+' . v:count1==", { desc = "Move Down" }) +map("n", "", "execute 'move .-' . (v:count1 + 1)==", { desc = "Move Up" }) map("i", "", "m .+1==gi", { desc = "Move Down" }) map("i", "", "m .-2==gi", { desc = "Move Up" }) -map("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) -map("v", "", ":m '<-2gv=gv", { desc = "Move Up" }) +map("v", "", ":execute \"'<,'>move '>+\" . v:count1gv=gv", { desc = "Move Down" }) +map("v", "", ":execute \"'<,'>move '<-\" . (v:count1 + 1)gv=gv", { desc = "Move Up" }) -- buffers map("n", "", "bprevious", { desc = "Prev Buffer" }) @@ -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() diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 8529ab20..18ce7407 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -85,6 +85,7 @@ return { -- snippets { "nvim-cmp", + optional = true, dependencies = { { "garymjr/nvim-snippets", @@ -209,6 +210,7 @@ return { -- Add lazydev source to cmp { "hrsh7th/nvim-cmp", + optional = true, opts = function(_, opts) table.insert(opts.sources, { name = "lazydev", group_index = 0 }) end, diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index c6376e1b..9087c3ad 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -50,5 +50,16 @@ return { which_key = true, }, }, + specs = { + { + "akinsho/bufferline.nvim", + optional = true, + opts = function(_, opts) + if (vim.g.colors_name or ""):find("catppuccin") then + opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + end + end, + }, + }, }, } diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua new file mode 100644 index 00000000..e6d4e29b --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -0,0 +1,90 @@ +return { + { + "hrsh7th/nvim-cmp", + enabled = false, + }, + { + "saghen/blink.cmp", + 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 = { + 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", + winblend = vim.o.pumblend, + }, + 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..22ba0c64 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -80,4 +80,46 @@ 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 + LazyVim.create_undo() + require("copilot.suggestion").accept() + return true + else + return cmp.select_and_accept() + end + end, + "snippet_forward", + "fallback", + }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/coding/tabnine.lua index f02fccc9..1c92a25d 100644 --- a/lua/lazyvim/plugins/extras/coding/tabnine.lua +++ b/lua/lazyvim/plugins/extras/coding/tabnine.lua @@ -2,6 +2,7 @@ return { -- Tabnine cmp source { "nvim-cmp", + optional = true, dependencies = { { "tzachar/cmp-tabnine", diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 67a3d71b..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 @@ -69,11 +75,6 @@ return { vscode.json_decode = function(str) return vim.json.decode(json.json_strip_comments(str)) end - - -- Extends dap.configurations with entries read from .vscode/launch.json - if vim.fn.filereadable(".vscode/launch.json") then - vscode.load_launchjs() - end end, }, diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index f85b23be..4c098452 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -133,6 +133,7 @@ return { { "hrsh7th/nvim-cmp", + optional = true, opts = function(_, opts) opts.auto_brackets = opts.auto_brackets or {} table.insert(opts.auto_brackets, "python") diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 4caeaef8..583981d4 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -6,25 +6,23 @@ return { }) end, - -- Extend auto completion + -- LSP for Cargo.toml { - "hrsh7th/nvim-cmp", - 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 @@ -94,21 +92,7 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - 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", - }, - }, - }, + rust_analyzer = { enabled = false }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index 8f43d25b..cbdd612e 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -59,6 +59,7 @@ return { }, { "hrsh7th/nvim-cmp", + optional = true, dependencies = { { "roobert/tailwindcss-colorizer-cmp.nvim", opts = {} }, }, 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 761569c5..c2b52cb6 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -4,12 +4,17 @@ 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, ["lazyvim.plugins.extras.editor.outline"] = 100, } +if vim.g.xtras_prios then + prios = vim.tbl_deep_extend("force", prios, vim.g.xtras_prios or {}) +end + ---@type string[] local extras = LazyVim.dedup(LazyVim.config.json.data.extras) 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`: diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 28537bce..7c6780ea 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -197,8 +197,8 @@ function M.foldexpr() return "0" end - -- don't use treesitter folds for non-file buffers - if vim.bo[buf].buftype ~= "" then + -- don't use treesitter folds for terminal + if vim.bo[buf].buftype == "terminal" then return "0" end