diff --git a/CHANGELOG.md b/CHANGELOG.md index 85059243..ba1a334d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## [10.24.0](https://github.com/LazyVim/LazyVim/compare/v10.23.0...v10.24.0) (2024-05-12) + + +### Features + +* **mason-lspconfig:** allow `opts.ensure_installed` to be taken into account ([#3134](https://github.com/LazyVim/LazyVim/issues/3134)) ([8968c9e](https://github.com/LazyVim/LazyVim/commit/8968c9e9ea76f3a7616d9e249a3c9307a75fffad)) + + +### Bug Fixes + +* **neo-tree:** correctly set up `cwd` ([#3097](https://github.com/LazyVim/LazyVim/issues/3097)) ([30ce84f](https://github.com/LazyVim/LazyVim/commit/30ce84f7a7fb4e88b47ddf2f569b2ea9b7d56717)) +* **ui:** don't lazy-load dashboard-nvim ([#3107](https://github.com/LazyVim/LazyVim/issues/3107)) ([30c9e47](https://github.com/LazyVim/LazyVim/commit/30c9e4718a127f7d5a32f11c4d8dbba6b01f9858)) + +## [10.23.0](https://github.com/LazyVim/LazyVim/compare/v10.22.0...v10.23.0) (2024-05-03) + + +### Features + +* **lualine:** make path trimming configurable by user ([#3062](https://github.com/LazyVim/LazyVim/issues/3062)) ([b8475f5](https://github.com/LazyVim/LazyVim/commit/b8475f51949acf195729a1c4d057a06208a9add9)) + + +### Bug Fixes + +* **dot:** can't match kitty conf file ([#3042](https://github.com/LazyVim/LazyVim/issues/3042)) ([5fb4cf0](https://github.com/LazyVim/LazyVim/commit/5fb4cf0d365b65cb9b7afa8be047973b5fc1747a)) +* **dot:** install when list is empty ([#3052](https://github.com/LazyVim/LazyVim/issues/3052)) ([3086bf0](https://github.com/LazyVim/LazyVim/commit/3086bf03e96bfc0048e5b27f8d65a9170bca3f67)) +* **extras:** Rust-Analyzer cargo option ([#3061](https://github.com/LazyVim/LazyVim/issues/3061)) ([a96348d](https://github.com/LazyVim/LazyVim/commit/a96348d7b076819f7580ea0c0ce467630bfc7cc5)) +* **native_snippets:** Fix native_snippets for `vim.snippet api` changes ([#3083](https://github.com/LazyVim/LazyVim/issues/3083)) ([6004e8d](https://github.com/LazyVim/LazyVim/commit/6004e8d4f60549bd2c5d6f3187a28d72b21e3261)) +* **python:** make both `ruff` and `ruff_lsp` available to user ([#3060](https://github.com/LazyVim/LazyVim/issues/3060)) ([34183a2](https://github.com/LazyVim/LazyVim/commit/34183a2759828001b08679659f7d5170d7ec367e)) + ## [10.22.0](https://github.com/LazyVim/LazyVim/compare/v10.21.1...v10.22.0) (2024-04-22) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 38e7d18d..6460b1fa 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 April 22 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 12 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 38c0ae4e..79ae665d 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -1,6 +1,6 @@ -- This file is automatically loaded by lazyvim.config.init --- DO NOT USE THIS IN YOU OWN CONFIG!! +-- DO NOT USE `LazyVim.safe_keymap_set` IN YOUR OWN CONFIG!! -- use `vim.keymap.set` instead local map = LazyVim.safe_keymap_set diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 37bcc9cb..c25537f4 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -41,12 +41,23 @@ return { vim.cmd([[Neotree close]]) end, init = function() - if vim.fn.argc(-1) == 1 then - local stat = vim.uv.fs_stat(vim.fn.argv(0)) - if stat and stat.type == "directory" then - require("neo-tree") - end - end + -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, + -- because `cwd` is not set up properly. + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), + desc = "Start Neo-tree with directory", + once = true, + callback = function() + if package.loaded["neo-tree"] then + return + else + local stats = vim.uv.fs_stat(vim.fn.argv(0)) + if stats and stats.type == "directory" then + require("neo-tree") + end + end + end, + }) end, opts = { sources = { "filesystem", "buffers", "git_status", "document_symbols" }, diff --git a/lua/lazyvim/plugins/extras/coding/native_snippets.lua b/lua/lazyvim/plugins/extras/coding/native_snippets.lua index 74b70784..cc501ff7 100644 --- a/lua/lazyvim/plugins/extras/coding/native_snippets.lua +++ b/lua/lazyvim/plugins/extras/coding/native_snippets.lua @@ -22,7 +22,7 @@ return { { "", function() - if vim.snippet.jumpable(1) then + if vim.snippet.active({ direction = 1 }) then vim.schedule(function() vim.snippet.jump(1) end) @@ -47,7 +47,7 @@ return { { "", function() - if vim.snippet.jumpable(-1) then + if vim.snippet.active({ direction = -1 }) then vim.schedule(function() vim.snippet.jump(-1) end) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index b36fd80c..3e7f5d59 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -2,9 +2,11 @@ if lazyvim_docs then -- LSP Server to use for Python. -- Set to "basedpyright" to use basedpyright instead of pyright. vim.g.lazyvim_python_lsp = "pyright" + vim.g.lazyvim_python_ruff = "ruff_lsp" end local lsp = vim.g.lazyvim_python_lsp or "pyright" +local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp" return { { @@ -28,7 +30,13 @@ return { [lsp] = { enabled = true, }, + ruff_lsp = { + enabled = ruff == "ruff_lsp", + }, ruff = { + enabled = ruff == "ruff", + }, + [ruff] = { keys = { { "co", @@ -47,9 +55,9 @@ return { }, }, setup = { - ruff = function() + [ruff] = function() LazyVim.lsp.on_attach(function(client, _) - if client.name == "ruff" then + if client.name == ruff then -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false end diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 613bc0f7..8a665c6c 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -60,7 +60,9 @@ return { cargo = { allFeatures = true, loadOutDirsFromCheck = true, - runBuildScripts = true, + buildScripts = { + enable = true, + }, }, -- Add clippy lints for Rust. checkOnSave = { diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index 26af6a9b..d12171f5 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -18,10 +18,8 @@ return { { "williamboman/mason.nvim", opts = function(_, opts) - vim.list_extend(opts.ensure_installed or {}, { - "shfmt", - "shellcheck", - }) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "shellcheck" }) end, }, -- add some stuff to treesitter @@ -37,15 +35,15 @@ return { vim.filetype.add({ extension = { rasi = "rasi", rofi = "rasi", wofi = "rasi" }, filename = { - [".env"] = "dotenv", + [".env"] = "sh", ["vifmrc"] = "vim", }, pattern = { [".*/waybar/config"] = "jsonc", [".*/mako/config"] = "dosini", - [".*/kitty/*.conf"] = "bash", - [".*/hypr/.*%.conf"] = "hyprlang", - ["%.env%.[%w_.-]+"] = "dotenv", + [".*/kitty/.+%.conf"] = "bash", + [".*/hypr/.+%.conf"] = "hyprlang", + ["%.env%.[%w_.-]+"] = "sh", }, }) diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index c2a74ef5..30ef5115 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -212,7 +212,14 @@ return { end if have_mason then - mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } }) + mlsp.setup({ + ensure_installed = vim.tbl_deep_extend( + "force", + ensure_installed, + LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {} + ), + handlers = { setup }, + }) end if LazyVim.lsp.get_config("denols") and LazyVim.lsp.get_config("tsserver") then diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 47fb4280..2cd9496c 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -346,9 +346,10 @@ return { return false end, }, + { "nvimdev/dashboard-nvim", - event = "VimEnter", + lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. opts = function() local logo = [[ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index db4600f4..757ddb01 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -79,6 +79,7 @@ function M.pretty_path(opts) directory_hl = "", filename_hl = "Bold", modified_sign = "", + length = 3, }, opts or {}) return function(self) @@ -100,8 +101,10 @@ function M.pretty_path(opts) local sep = package.config:sub(1, 1) local parts = vim.split(path, "[\\/]") - if #parts > 3 then - parts = { parts[1], "…", parts[#parts - 1], parts[#parts] } + 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) } end if opts.modified_hl and vim.bo.modified then diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 4143206c..c8de430d 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -142,7 +142,10 @@ function M.setup() LazyVim.root.info() end, { desc = "LazyVim roots for the current buffer" }) - vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost", "DirChanged" }, { + -- FIX: doesn't properly clear cache in neo-tree `set_root` (which should happen presumably on `DirChanged`), + -- probably because the event is triggered in the neo-tree buffer, therefore add `BufEnter` + -- Maybe this is too frequent on `BufEnter` and something else should be done instead?? + vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost", "DirChanged", "BufEnter" }, { group = vim.api.nvim_create_augroup("lazyvim_root_cache", { clear = true }), callback = function(event) M.cache[event.buf] = nil