diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 5f6e5685..b0e2e610 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "14.15.0" + ".": "15.3.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 873ac748..5b8c6724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,152 @@ # Changelog +## [15.3.0](https://github.com/LazyVim/LazyVim/compare/v15.2.0...v15.3.0) (2025-09-23) + + +### Features + +* **copilot:** use `blink-copilot` as blink.cmp copilot source ([#5551](https://github.com/LazyVim/LazyVim/issues/5551)) ([13069f2](https://github.com/LazyVim/LazyVim/commit/13069f20183655d8a02f3acbd21d0ac4c9ce811c)) +* **treesitter:** show an error if the user tries to set a custom treesitter compiler ([89ff1fd](https://github.com/LazyVim/LazyVim/commit/89ff1fd600bb6ff4cf2c9edbc2217a40ecb8d160)) + + +### Bug Fixes + +* **jdtls:** allow mason jdtls installation ([#6498](https://github.com/LazyVim/LazyVim/issues/6498)) ([80990ec](https://github.com/LazyVim/LazyVim/commit/80990ec62fd36fc4b6b921a9041f55858e33e030)) +* **jdtls:** bundle configuration bug fix ([#6499](https://github.com/LazyVim/LazyVim/issues/6499)) ([c423765](https://github.com/LazyVim/LazyVim/commit/c4237659621e406089f4d13d32192954d52c4924)) +* **keymaps:** enable snacks git keybindings ([#6323](https://github.com/LazyVim/LazyVim/issues/6323)) ([720e06a](https://github.com/LazyVim/LazyVim/commit/720e06a908cbf6e3afb4eccc049d58df9ace770a)) +* **lsp:** fix mason install/exclude. Closes [#6504](https://github.com/LazyVim/LazyVim/issues/6504) ([37b1ec4](https://github.com/LazyVim/LazyVim/commit/37b1ec41ae57e8396d5c923a4bfdf7050215b4d6)) +* **lsp:** fixup for when not using mason ([a90b565](https://github.com/LazyVim/LazyVim/commit/a90b56518f4f2291985952d79472d4f935c0bad0)) +* **luasnip:** add missing optional tag to garymjr/nvim-snippets ([#5733](https://github.com/LazyVim/LazyVim/issues/5733)) ([37a1c1a](https://github.com/LazyVim/LazyVim/commit/37a1c1af5dbbcf069bb94a71b4dda3626fbda77a)) +* **vtsls:** fix and move denols/vtsls disambigutaion to typescript extra. Fixes [#6476](https://github.com/LazyVim/LazyVim/issues/6476) ([775621a](https://github.com/LazyVim/LazyVim/commit/775621ac0af42486ef1cd4254d1a6625a190040b)) + +## [15.2.0](https://github.com/LazyVim/LazyVim/compare/v15.1.1...v15.2.0) (2025-09-20) + + +### Features + +* **clojure:** use 'nvim-paredit' instead 'nvim-treesitter-sexp' as clojure S-exp Plugin ([#5876](https://github.com/LazyVim/LazyVim/issues/5876)) ([2659028](https://github.com/LazyVim/LazyVim/commit/26590285ead7a89bb45f309714f7f40136c89267)) +* **core:** relax hard requirement for `vim.lsp.is_enabled`. Show warning instead ([3ca7b47](https://github.com/LazyVim/LazyVim/commit/3ca7b47365c85a07047e48cad450feff66c8bdd6)) +* **options:** don't overwrite indentexpr/foldexpr/foldmethod when set by plugins. Fixes [#6464](https://github.com/LazyVim/LazyVim/issues/6464) ([ccbaf55](https://github.com/LazyVim/LazyVim/commit/ccbaf55c2f8bc691f8f64fe40ce00a1abda4fbac)) +* **yanky:** use snacks picker for improved yank history navigation ([#5802](https://github.com/LazyVim/LazyVim/issues/5802)) ([55e762a](https://github.com/LazyVim/LazyVim/commit/55e762a8888cd5f336e4e2d4b2cc6b8b1b950663)) + + +### Bug Fixes + +* **editor:** calculate the height passed to the prompt of fzf-lua properly ([#6481](https://github.com/LazyVim/LazyVim/issues/6481)) ([65e38d3](https://github.com/LazyVim/LazyVim/commit/65e38d3b34cab653a05318c1a9014df3c89fdb53)) +* **lang.clojure:** correct cmp-conjure source name ([#6208](https://github.com/LazyVim/LazyVim/issues/6208)) ([55b5c1f](https://github.com/LazyVim/LazyVim/commit/55b5c1fecb0b7e71c5eb40555b17d1e4820690f0)) +* **options:** set_default option ([2401d5f](https://github.com/LazyVim/LazyVim/commit/2401d5fca6f2a2fcaca4f9c4c84c4b713c602352)) +* **options:** track some initial options right after loading `options.lua`. See [#6463](https://github.com/LazyVim/LazyVim/issues/6463) ([9c611b0](https://github.com/LazyVim/LazyVim/commit/9c611b0c5758d0d659e7fdb29119b7083a56f989)) +* **treesitter:** check if queries for indent/fold exists before enabling it. Fixes [#6474](https://github.com/LazyVim/LazyVim/issues/6474) ([5ce7cd6](https://github.com/LazyVim/LazyVim/commit/5ce7cd650a5fffc257e0312b82fffd26abe2a1fa)) + +## [15.1.1](https://github.com/LazyVim/LazyVim/compare/v15.1.0...v15.1.1) (2025-09-18) + + +### Bug Fixes + +* **core:** check for outdated nightly. See [#6458](https://github.com/LazyVim/LazyVim/issues/6458) ([cfac3c9](https://github.com/LazyVim/LazyVim/commit/cfac3c9a85526ad7406f9b246097a1ec4fa1a2c3)) +* **lspconfig:** remove all usage of `lspconfig` ([36b4191](https://github.com/LazyVim/LazyVim/commit/36b41911ab90fe19505af306a31a5a699342d3c3)) +* **lsp:** schedule_wrap setting up LSPs to work around root cause of [#6456](https://github.com/LazyVim/LazyVim/issues/6456). Fixes [#6456](https://github.com/LazyVim/LazyVim/issues/6456) ([75a3809](https://github.com/LazyVim/LazyVim/commit/75a3809e15a0ecff9adc46c6cd3aaac51d99b561)) + +## [15.1.0](https://github.com/LazyVim/LazyVim/compare/v15.0.3...v15.1.0) (2025-09-18) + + +### Features + +* **treesitter:** automatically install and use mason's tree-sitter-cli if not installed on system ([725d048](https://github.com/LazyVim/LazyVim/commit/725d048e009b866425b2a0cc620ba2c413e8b65f)) +* **treesitter:** refactored setting up treesitter indent/highlight/folds ([b93303d](https://github.com/LazyVim/LazyVim/commit/b93303d2339b1117171780cebed1d710fd3805d5)) + + +### Bug Fixes + +* **snacks:** safe wrapper around snacks statuscolumn to prevent errors when LazyVim is still installing ([5bf2378](https://github.com/LazyVim/LazyVim/commit/5bf237820d7938b1b6490164fbd75e4117d341c1)) + +## [15.0.3](https://github.com/LazyVim/LazyVim/compare/v15.0.2...v15.0.3) (2025-09-17) + + +### Bug Fixes + +* **treesitter:** properly update installedd languages after setup ([c28f599](https://github.com/LazyVim/LazyVim/commit/c28f599d4f5d175f3d259a621c4e7b5d0b2a0759)) + +## [15.0.2](https://github.com/LazyVim/LazyVim/compare/v15.0.1...v15.0.2) (2025-09-17) + + +### Bug Fixes + +* **python:** remove the wrapping `settings` key from `setup()` options ([#6069](https://github.com/LazyVim/LazyVim/issues/6069)) ([ed3aa74](https://github.com/LazyVim/LazyVim/commit/ed3aa74c107de7dc3e06367ce4afb20056710441)) +* **treesitter:** indentexpr/foldexpr now work as intended and override ftplugin settings. Fixes [#6447](https://github.com/LazyVim/LazyVim/issues/6447) ([a6b38de](https://github.com/LazyVim/LazyVim/commit/a6b38de763addf2d22e8a43a1e679cc855dc376d)) + +## [15.0.1](https://github.com/LazyVim/LazyVim/compare/v15.0.0...v15.0.1) (2025-09-17) + + +### Bug Fixes + +* **treesitter:** TS update during inital build ([2d56d3b](https://github.com/LazyVim/LazyVim/commit/2d56d3b37c275890a403845c00b5c8d38cb387e6)) + +## [15.0.0](https://github.com/LazyVim/LazyVim/compare/v14.15.1...v15.0.0) (2025-09-17) + + +### ⚠ BREAKING CHANGES + +* **treesitter:** migrate to `nvim-treesitter` **main** branch +* bump Neovim requirement to 0.11.2 +* LazyVim now requires Neovim >= 0.11 See #6421 for more info + +### Features + +* **blink:** enable blink cmdline completions ([011a35c](https://github.com/LazyVim/LazyVim/commit/011a35ccb810cbe5d25def9cc92271e8423feb74)) +* **blink:** enable cmdline completions ([ff7c12c](https://github.com/LazyVim/LazyVim/commit/ff7c12c48e23941ffd9a7bbe61857624929ae9da)) +* bump Neovim requirement to 0.11.2 ([cccfe70](https://github.com/LazyVim/LazyVim/commit/cccfe70ea4390c1915f67ab7d2893971fba3f3fa)) +* **extras:** added an experimental extra for the treesitter `main` branch ([5668ad7](https://github.com/LazyVim/LazyVim/commit/5668ad72ca806b3a7915bb7b35dcc5cccfe774f7)) +* LazyVim now requires Neovim >= 0.11 See [#6421](https://github.com/LazyVim/LazyVim/issues/6421) for more info ([e7ce65e](https://github.com/LazyVim/LazyVim/commit/e7ce65e1bb814f79ecb45bfeca934e997e0ee42c)) +* **lsp:** enable LSP folds when available ([5e2c4e6](https://github.com/LazyVim/LazyVim/commit/5e2c4e62f28a85e0b27d5c97ea92af8c1ab74cef)) +* **treesitter:** migrate to `nvim-treesitter` **main** branch ([5eac460](https://github.com/LazyVim/LazyVim/commit/5eac460c092103e5516bec345236853b9f35ec7c)) + + +### Bug Fixes + +* **blink:** make blink completions in cmdline behave more like regular cmdline ([f54fd7f](https://github.com/LazyVim/LazyVim/commit/f54fd7f751e902e824c3a4c9d212a0d18387d0b6)) +* **catppuccin:** follow renamed integration ([#6354](https://github.com/LazyVim/LazyVim/issues/6354)) ([02d0c9a](https://github.com/LazyVim/LazyVim/commit/02d0c9aebddb902d9c974a38bb44db9bae4eac6d)) +* **clangd:** file detection improvements ([#6436](https://github.com/LazyVim/LazyVim/issues/6436)) ([aab503f](https://github.com/LazyVim/LazyVim/commit/aab503fda63f34cff6bce229f73ea5209e8afaf0)) +* **clangd:** rewrite the root_dir function ([#6060](https://github.com/LazyVim/LazyVim/issues/6060)) ([167d39b](https://github.com/LazyVim/LazyVim/commit/167d39b2bef24024be1a48267e14cc6c82146462)) +* **eslint:** remove old 0.10 code ([919c9e5](https://github.com/LazyVim/LazyVim/commit/919c9e5d091f11b2892c56825249fc4a495d3e8f)) +* **extras:** disable blink path source in CopilotChat ([#5666](https://github.com/LazyVim/LazyVim/issues/5666)) ([#5754](https://github.com/LazyVim/LazyVim/issues/5754)) ([3aa2916](https://github.com/LazyVim/LazyVim/commit/3aa2916569df2664cb68e1c7c38882868f36f8d0)) +* **gitsigns:** use silent for gitsigns keymaps ([#5841](https://github.com/LazyVim/LazyVim/issues/5841)) ([6eed178](https://github.com/LazyVim/LazyVim/commit/6eed1781c185ea6d1f313aee60a7097448f473cb)) +* **grug-far:** add support for GrugFarWithin so it gets loaded by default ([#5772](https://github.com/LazyVim/LazyVim/issues/5772)) ([fd1b02a](https://github.com/LazyVim/LazyVim/commit/fd1b02ae5740dc651cc43291391084dbe7b1b3c4)) +* **harpoon:** keymaps for 1-9. Fixes [#6319](https://github.com/LazyVim/LazyVim/issues/6319) ([e2ba6bb](https://github.com/LazyVim/LazyVim/commit/e2ba6bb51107cbd076b53b49ed7be99fc2fa3991)) +* **jdtls:** root_dir ([271fecb](https://github.com/LazyVim/LazyVim/commit/271fecb067ec223a8eab90c1abd1162e9ebae5df)) +* **jdtls:** root_dir ([#6429](https://github.com/LazyVim/LazyVim/issues/6429)) ([c053921](https://github.com/LazyVim/LazyVim/commit/c05392186e9e540d4af169922c333b5baa583cbe)) +* **lang.haskell:** prevent Haskell extras from installing telescope.nvim ([#6419](https://github.com/LazyVim/LazyVim/issues/6419)) ([cc4a3e5](https://github.com/LazyVim/LazyVim/commit/cc4a3e556424dba784b41ec3bd92eeb7b62746bc)) +* **lsp:** buffer should be second arg for supports_method ([44ade7f](https://github.com/LazyVim/LazyVim/commit/44ade7fdea98a0356c64ff9edaf2534547b958bc)) +* **lspconfig:** remove all references to lspconfig. Closes [#6426](https://github.com/LazyVim/LazyVim/issues/6426) ([23b9cde](https://github.com/LazyVim/LazyVim/commit/23b9cdeb3471b655532e9884fa2dd36ee83062d5)) +* **lsp:** properly ambiguate denols vs vtsls ([2f75d9a](https://github.com/LazyVim/LazyVim/commit/2f75d9a90fc9cf43f7ba2365dbb745e5595fc02e)) +* **lsp:** properly register capabilities with new vim.lsp.config. Not needed for blink ([9fa832d](https://github.com/LazyVim/LazyVim/commit/9fa832dc95cb77a5551bbeff12b4520d8b7bdc2a)) +* **mason:** migrate to mason v2 ([#6053](https://github.com/LazyVim/LazyVim/issues/6053)) ([773f28b](https://github.com/LazyVim/LazyVim/commit/773f28b4912d5505a21da9686d56ab7cf41a9be7)) +* **mini:** update mini plugin references from echasnovski to nvim-mini ([#6374](https://github.com/LazyVim/LazyVim/issues/6374)) ([ae3aaf2](https://github.com/LazyVim/LazyVim/commit/ae3aaf2dd3a04eb5dbc5b1e34843558c85e45ac2)) +* **neo-tree:** import neo-tree Extra before edgy Extra ([#5763](https://github.com/LazyVim/LazyVim/issues/5763)) ([848dd31](https://github.com/LazyVim/LazyVim/commit/848dd3132af50f6d211d0c07166ea7c1a4259088)) +* **ocaml:** use `root_dir` instead of `root_markers` for globs support ([#6428](https://github.com/LazyVim/LazyVim/issues/6428)) ([44cc063](https://github.com/LazyVim/LazyVim/commit/44cc0635bc3d2ccc55eb76bc7668092befcf0536)) +* **refactoring:** update funcs to return, add `expr=true`, operator mode ([#5882](https://github.com/LazyVim/LazyVim/issues/5882)) ([6e1de74](https://github.com/LazyVim/LazyVim/commit/6e1de74597fa07ea805920da370f9d998740bc5e)) +* remove 0.9 compat ([3516ae7](https://github.com/LazyVim/LazyVim/commit/3516ae736a333185f6f17b70af20b088d04cbbb6)) +* **schemastore:** use `before_init` instead of `on_new_config` to load schema store ([#6427](https://github.com/LazyVim/LazyVim/issues/6427)) ([14d2a9b](https://github.com/LazyVim/LazyVim/commit/14d2a9baa1306bd0969112fcf8f69a11840cc5e6)) +* **treesitter-main:** move exe check to config ([96316e5](https://github.com/LazyVim/LazyVim/commit/96316e5a69b4cc45311f5b7225e7d7bea1f977ee)) +* **treesitter-main:** set vim.bo.indentexpr in FileType autocmd ([#6430](https://github.com/LazyVim/LazyVim/issues/6430)) ([b926e7d](https://github.com/LazyVim/LazyVim/commit/b926e7db417bc7b0e80feb778bed7924ffe8e85d)) +* **vue:** `volar` -> `vua_ls`. Fixes [#6236](https://github.com/LazyVim/LazyVim/issues/6236). Closes [#6238](https://github.com/LazyVim/LazyVim/issues/6238). Closes [#6174](https://github.com/LazyVim/LazyVim/issues/6174) ([4a3b4a8](https://github.com/LazyVim/LazyVim/commit/4a3b4a80a89fe5a52d30fbe4afe85c152878ab1b)) + + +### Performance Improvements + +* **blink:** only enable lazydev in lua files ([4961b3d](https://github.com/LazyVim/LazyVim/commit/4961b3d4d4b2999816e978c3ea4ef7c320e4206d)) +* **treesitter-main:** only enable highlighting for installed treesitter langs ([2f309fc](https://github.com/LazyVim/LazyVim/commit/2f309fc8b5bf93af25293c1e4688d409de718a36)) + +## [14.15.1](https://github.com/LazyVim/LazyVim/compare/v14.15.0...v14.15.1) (2025-09-15) + + +### Bug Fixes + +* **blink:** use .get method to access presets ([#6183](https://github.com/LazyVim/LazyVim/issues/6183)) ([1a729e2](https://github.com/LazyVim/LazyVim/commit/1a729e2d4c4162501fe13224d669a654849deb36)) +* **extras.ai.copilot:** update status retrieval for lualine ([#5900](https://github.com/LazyVim/LazyVim/issues/5900)) ([55e9944](https://github.com/LazyVim/LazyVim/commit/55e9944e2b1e152b5acdc9cc015978a905fc2966)) +* **lang.python:** enable venv-selector even when telescope is not available ([#5829](https://github.com/LazyVim/LazyVim/issues/5829)) ([10e5bf5](https://github.com/LazyVim/LazyVim/commit/10e5bf5c5b5fb4da0afbb2d4d2b75595502c9690)) +* **lsp:** fixed deprecated warnings ([bed725a](https://github.com/LazyVim/LazyVim/commit/bed725a054ed3e8c8c56dce7e2100335e567cf01)) + ## [14.15.0](https://github.com/LazyVim/LazyVim/compare/v14.14.0...v14.15.0) (2025-05-12) diff --git a/NEWS.md b/NEWS.md index 9d00ddd6..9342acb2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,23 @@ # What's new? +## 15.x + +**Neovim** `>= 0.11.2` includes a lot of changes to the underlying LSP implementation. + +Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support for older versions. + +### Changes + +- removed compatibility code for Neovim `< 0.11.2` +- configure **LSP** with the native `vim.lsp.config` +- migrated **mason.nvim** and **mason-lspconfig.nvim** to `v2.x` +- migrated to [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter/tree/main) **main** branch + - with the new version, the `tree-sitter` cli is **required** to install parsers + - best to run `:checkhealth nvim-treesitter` after updating +- replace `nvim-treesitter` incremental selection with `flash.nvim`, since it is no longer supported +- enabled [blink.cmp](https://github.com/saghen/blink.cmp) **cmdline** completions +- use **LSP** based folding when available (disable with `nvim-lspconfig.folds.enabled = false`) + ## 14.x Big new release with a lot of changes and improvements! @@ -110,7 +128,6 @@ vim.g.snacks_animate = false ## 11.x - **Keymaps:** - - `gB` to open the current repo in the browser - `gco` and `gcO` to add a comment below or above the current line - `wm` to toggle window maximize @@ -123,7 +140,6 @@ vim.g.snacks_animate = false It's a great plugin that enhances the native text objects. - `:LazyExtras` now has multiple new sections: - - **Enabled**: extras that are currently enabled - **Recommended Languages**: language extras recommended for the current buffer / directory - **Recommended Plugins**: extras that are recommended for most users @@ -161,7 +177,6 @@ Additionally, some core plugins have been moved to extras. ``` - plugins moved to extras: - - `mini.surround` - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` @@ -179,7 +194,6 @@ Additionally, some core plugins have been moved to extras. You can find the updated docs [here](https://github.com/folke/trouble.nvim/tree/dev) - The **lazygit** integration now configures: - - the theme based on the colorscheme - nerd font icons (v3) - editor preset is set to `nvim-remote` for better interop with Neovim @@ -220,9 +234,7 @@ Additionally, some core plugins have been moved to extras. - New `:LazyExtras` command for managing **LazyVim** extras - Improved **formatting**: - - **LazyVim** can now work with multiple formatters. Types: - - **primary**: only one primary formatter can be active at a time. _(conform, none-ls, LSP)_ - **secondary**: multiple secondary formatters can be active _(eslint, ...)_ @@ -241,18 +253,15 @@ Additionally, some core plugins have been moved to extras. ``` - `none-ls.nvim` is no longer installed by default - - `conform.nvim` is now the default formatter - `nvim-lint` is now the default linter - If you want to keep using `none-ls.nvim`, you can enable the **lsp.none-ls** extra - `dashboard.nvim` is the new default dashboard plugin - - If you want to keep using `alpha.nvim`, you can enable the **ui.alpha** extra - Improved **root detection**: - - New `:LazyRoot` command that shows info about the root dir detection - Configurable with `vim.g.root_spec` diff --git a/README.md b/README.md index 4d379504..1e7bb70d 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ to tweak your config as needed, along with the convenience of a pre-configured s ## ⚡️ Requirements -- Neovim >= **0.9.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.11.2** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_** - a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 0e41c7bf..dbeb4819 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2025 May 12 +*LazyVim.txt* For Neovim Last change: 2025 September 23 ============================================================================== Table of Contents *LazyVim-table-of-contents* @@ -53,7 +53,7 @@ FEATURES *LazyVim-features* REQUIREMENTS *LazyVim-requirements* -- Neovim >= **0.9.0** (needs to be built with **LuaJIT**) +- Neovim >= **0.11.2** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a Nerd Font **(optional)** - a **C** compiler for `nvim-treesitter`. See here diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 73c35f1f..1d288cd2 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "14.15.0" -- x-release-please-version +M.version = "15.3.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions @@ -304,6 +304,8 @@ function M.load(name) end M.did_init = false +M._options = {} ---@type vim.wo|vim.bo + function M.init() if M.did_init then return @@ -326,6 +328,12 @@ function M.init() -- this is needed to make sure options will be correctly applied -- after installing missing plugins M.load("options") + + -- save some options to track defaults + M._options.indentexpr = vim.o.indentexpr + M._options.foldmethod = vim.o.foldmethod + M._options.foldexpr = vim.o.foldexpr + -- defer built-in clipboard handling: "xsel" and "pbcopy" can be slow lazy_clipboard = vim.opt.clipboard vim.opt.clipboard = "" @@ -353,7 +361,7 @@ function M.get_defaults() { name = "telescope", extra = "editor.telescope" }, }, cmp = { - { name = "blink.cmp", extra = "coding.blink", enabled = vim.fn.has("nvim-0.10") == 1 }, + { name = "blink.cmp", extra = "coding.blink" }, { name = "nvim-cmp", extra = "coding.nvim-cmp" }, }, explorer = { diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index fbc7f5d1..938a2333 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -163,12 +163,12 @@ end if vim.fn.executable("lazygit") == 1 then map("n", "gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) map("n", "gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" }) - map("n", "gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" }) - map("n", "gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" }) - map("n", "gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" }) end +map("n", "gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" }) map("n", "gb", function() Snacks.picker.git_log_line() end, { desc = "Git Blame Line" }) +map("n", "gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" }) +map("n", "gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" }) map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" }) map({"n", "x" }, "gY", function() Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false }) @@ -209,13 +209,3 @@ 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 0bbaacba..2ae1b38d 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -53,7 +53,7 @@ local opt = vim.opt opt.autowrite = true -- Enable auto write -- only set clipboard if not in ssh, to make sure the OSC 52 --- integration works automatically. Requires Neovim >= 0.10.0 +-- integration works automatically. opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions @@ -69,7 +69,9 @@ opt.fillchars = { eob = " ", } opt.foldlevel = 99 -opt.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()" +opt.foldmethod = "indent" +opt.foldtext = "" +opt.formatexpr = "v:lua.LazyVim.format.formatexpr()" opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" @@ -95,11 +97,12 @@ opt.sidescrolloff = 8 -- Columns of context opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.smartcase = true -- Don't ignore case with capitals opt.smartindent = true -- Insert indents automatically +opt.smoothscroll = true 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.statuscolumn = [[%!v:lua.LazyVim.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 @@ -111,15 +114,5 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -if vim.fn.has("nvim-0.10") == 1 then - opt.smoothscroll = true - opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" - opt.foldmethod = "expr" - opt.foldtext = "" -else - opt.foldmethod = "indent" - opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()" -end - -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 diff --git a/lua/lazyvim/health.lua b/lua/lazyvim/health.lua index 9fdc5a56..d1632e75 100644 --- a/lua/lazyvim/health.lua +++ b/lua/lazyvim/health.lua @@ -8,13 +8,10 @@ local error = vim.health.error or vim.health.report_error function M.check() start("LazyVim") - if vim.fn.has("nvim-0.9.0") == 1 then - ok("Using Neovim >= 0.9.0") - if vim.fn.has("nvim-0.10.0") == 0 then - warn("Use Neovim >= 0.10.0 for the best experience") - end + if vim.fn.has("nvim-0.11.2") == 1 then + ok("Using Neovim >= 0.11.2") else - error("Neovim >= 0.9.0 is required") + error("Neovim >= 0.11.2 is required") end for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit", "fzf", "curl" }) do diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 0e614e48..7f6bb550 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -1,7 +1,9 @@ return { - -- auto pairs + -- Auto pairs + -- Automatically inserts a matching closing character + -- when you type an opening character like `"`, `[`, or `(`. { - "echasnovski/mini.pairs", + "nvim-mini/mini.pairs", event = "VeryLazy", opts = { modes = { insert = true, command = true, terminal = false }, @@ -20,16 +22,20 @@ return { end, }, - -- comments + -- Improves comment syntax, lets Neovim handle multiple + -- types of comments for a single language, and relaxes rules + -- for uncommenting. { "folke/ts-comments.nvim", event = "VeryLazy", opts = {}, }, - -- Better text-objects + -- Extends the a & i text objects, this adds the ability to select + -- arguments, function calls, text within quotes and brackets, and to + -- repeat those selections to select an outer text object. { - "echasnovski/mini.ai", + "nvim-mini/mini.ai", event = "VeryLazy", opts = function() local ai = require("mini.ai") @@ -64,6 +70,8 @@ return { end, }, + -- Configures LuaLS to support auto-completion and type checking + -- while editing your Neovim configuration. { "folke/lazydev.nvim", ft = "lua", diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index fa611bf4..4c41d492 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -58,7 +58,7 @@ return { optional = true, opts = function(_, opts) if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + opts.highlights = require("catppuccin.groups.integrations.bufferline").get_theme() end end, }, diff --git a/lua/lazyvim/plugins/compat/nvim-0_9.lua b/lua/lazyvim/plugins/compat/nvim-0_9.lua deleted file mode 100644 index 81514ef8..00000000 --- a/lua/lazyvim/plugins/compat/nvim-0_9.lua +++ /dev/null @@ -1,41 +0,0 @@ --- Compatibility with Neovim 0.9 -return { - -- Use LuaSnip instead of native snippets - { "garymjr/nvim-snippets", enabled = false }, - { import = "lazyvim.plugins.extras.coding.luasnip" }, - - -- Use nvim-cmp instead of blink.cmp - { import = "lazyvim.plugins.extras.coding.nvim-cmp" }, - - -- Use mini.comment instead of ts-comments - { "folke/ts-comments.nvim", enabled = false }, - { import = "lazyvim.plugins.extras.coding.mini-comment" }, - - -- Use neodev-types with lazydev - { "folke/neodev.nvim", config = function() end }, - { - "folke/lazydev.nvim", - opts = function(_, opts) - opts.library = opts.library or {} - table.insert(opts.library, { "neodev.nvim/types/stable" }) - end, - config = function(_, opts) - -- force lazydev to load on Neovim 0.9 - require("lazydev.config").have_0_10 = true - require("lazydev").setup(opts) - end, - }, - { - "neovim/nvim-lspconfig", - dependencies = {}, - }, - - -- dummy import to save core imports - { - import = "foobar", - enabled = function() - LazyVim.plugin.save_core() - return false - end, - }, -} diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 4aaf3d1f..6e2c894e 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -4,7 +4,7 @@ return { { "MagicDuck/grug-far.nvim", opts = { headerMaxWidth = 80 }, - cmd = "GrugFar", + cmd = { "GrugFar", "GrugFarWithin" }, keys = { { "sr", @@ -40,6 +40,16 @@ return { { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + -- Simulate nvim-treesitter incremental selection + { "", mode = { "n", "o", "x" }, + function() + require("flash").treesitter({ + actions = { + [""] = "next", + [""] = "prev" + } + }) + end, desc = "Treesitter Incremental Selection" }, }, }, @@ -64,8 +74,8 @@ return { { "gh", group = "hunks" }, { "q", group = "quit/session" }, { "s", group = "search" }, - { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, - { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, + { "u", group = "ui" }, + { "x", group = "diagnostics/quickfix" }, { "[", group = "prev" }, { "]", group = "next" }, { "g", group = "goto" }, @@ -143,7 +153,7 @@ return { local gs = package.loaded.gitsigns local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc, silent = true }) end -- stylua: ignore start diff --git a/lua/lazyvim/plugins/extras/ai/copilot-chat.lua b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua index 58169b1e..fbf4ee39 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua @@ -85,4 +85,24 @@ return { }) end, }, + + -- Blink integration + { + "saghen/blink.cmp", + optional = true, + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + sources = { + providers = { + path = { + -- Path sources triggered by "/" interfere with CopilotChat commands + enabled = function() + return vim.bo.filetype ~= "copilot-chat" + end, + }, + }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 4f1d54f2..7c326499 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -49,9 +49,9 @@ return { 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 {} + local clients = package.loaded["copilot"] and vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} if #clients > 0 then - local status = require("copilot.api").status.data.status + local status = require("copilot.status").data.status return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" end end) @@ -98,15 +98,14 @@ return { { "saghen/blink.cmp", optional = true, - dependencies = { "giuxtaposition/blink-cmp-copilot" }, + dependencies = { "fang2hou/blink-copilot" }, opts = { sources = { default = { "copilot" }, providers = { copilot = { name = "copilot", - module = "blink-cmp-copilot", - kind = "Copilot", + module = "blink-copilot", score_offset = 100, async = true, }, diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 10b2ee62..207b1940 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -31,7 +31,7 @@ return { version = not vim.g.lazyvim_blink_main and "*", }, }, - event = "InsertEnter", + event = { "InsertEnter", "CmdlineEnter" }, ---@module 'blink.cmp' ---@type blink.cmp.Config @@ -41,6 +41,7 @@ return { return LazyVim.cmp.expand(snippet) end, }, + appearance = { -- sets the fallback highlight groups to nvim-cmp's highlight groups -- useful for when your theme doesn't support blink.cmp @@ -50,6 +51,7 @@ return { -- adjusts spacing to ensure icons are aligned nerd_font_variant = "mono", }, + completion = { accept = { -- experimental auto-brackets support @@ -82,7 +84,17 @@ return { }, cmdline = { - enabled = false, + enabled = true, + keymap = { preset = "cmdline" }, + completion = { + list = { selection = { preselect = false } }, + menu = { + auto_show = function(ctx) + return vim.fn.getcmdtype() == ":" + end, + }, + ghost_text = { enabled = true }, + }, }, keymap = { @@ -109,7 +121,7 @@ return { if not opts.keymap[""] then if opts.keymap.preset == "super-tab" then -- super-tab opts.keymap[""] = { - require("blink.cmp.keymap.presets")["super-tab"][""][1], + require("blink.cmp.keymap.presets").get("super-tab")[""][1], LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), "fallback", } @@ -171,8 +183,9 @@ return { "saghen/blink.cmp", opts = { sources = { - -- add lazydev to your completion providers - default = { "lazydev" }, + per_filetype = { + lua = { inherit_defaults = true, "lazydev" }, + }, providers = { lazydev = { name = "LazyDev", diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua index 85ed2fd5..5b62113e 100644 --- a/lua/lazyvim/plugins/extras/coding/luasnip.lua +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -1,6 +1,6 @@ return { -- disable builtin snippet support - { "garymjr/nvim-snippets", enabled = false }, + { "garymjr/nvim-snippets", optional = true, enabled = false }, -- add luasnip { diff --git a/lua/lazyvim/plugins/extras/coding/mini-comment.lua b/lua/lazyvim/plugins/extras/coding/mini-comment.lua index 457787ef..19113d67 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-comment.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-comment.lua @@ -1,6 +1,6 @@ return { { - "echasnovski/mini.comment", + "nvim-mini/mini.comment", event = "VeryLazy", opts = { options = { diff --git a/lua/lazyvim/plugins/extras/coding/mini-snippets.lua b/lua/lazyvim/plugins/extras/coding/mini-snippets.lua index d0a747a8..714d867d 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-snippets.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-snippets.lua @@ -4,14 +4,14 @@ if lazyvim_docs then vim.g.lazyvim_mini_snippets_in_completion = true -- NOTE: Please also read: - -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-snippets.md#expand + -- https://github.com/nvim-mini/mini.nvim/blob/main/readmes/mini-snippets.md#expand -- :h MiniSnippets-session -- Example override for your own config: --[[ return { { - "echasnovski/mini.snippets", + "nvim-mini/mini.snippets", opts = function(_, opts) -- By default, for opts.snippets, the extra for mini.snippets only adds gen_loader.from_lang() -- This provides a sensible quickstart, integrating with friendly-snippets @@ -63,7 +63,7 @@ return { -- add mini.snippets desc = "Manage and expand snippets (alternative to Luasnip)", { - "echasnovski/mini.snippets", + "nvim-mini/mini.snippets", event = "InsertEnter", -- don't depend on other plugins to load... dependencies = "rafamadriz/friendly-snippets", opts = function() diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua index d8ff25c5..19c5de8f 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-surround.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -3,7 +3,7 @@ -- to select the text inside, change or modify the surrounding characters, -- and more. return { - "echasnovski/mini.surround", + "nvim-mini/mini.surround", keys = function(_, keys) -- Populate the keys based on the user's options local opts = LazyVim.opts("mini.surround") diff --git a/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua b/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua index cdada25a..54bfbf7c 100644 --- a/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua +++ b/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua @@ -25,6 +25,9 @@ return { -- } -- ``` opts = function() + -- Register nvim-cmp lsp capabilities + vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() }) + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") local defaults = require("cmp.config.default")() diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index c880aceb..6285796d 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -13,6 +13,8 @@ return { function() if LazyVim.pick.picker.name == "telescope" then require("telescope").extensions.yank_history.yank_history({}) + elseif LazyVim.pick.picker.name == "snacks" then + Snacks.picker.yanky() else vim.cmd([[YankyRingHistory]]) end diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index e9177457..9e7ef671 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -120,9 +120,9 @@ return { winopts = { layout = "vertical", -- height is number of items minus 15 lines for the preview, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16, + height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 4) + 0.5) + 16, width = 0.5, - preview = not vim.tbl_isempty(LazyVim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { + preview = not vim.tbl_isempty(vim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { layout = "vertical", vertical = "down:15,border-top", hidden = "hidden", @@ -135,7 +135,7 @@ return { winopts = { width = 0.5, -- height is number of items, with a max of 80% screen height - height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5), + height = math.floor(math.min(vim.o.lines * 0.8, #items + 4) + 0.5), }, }) end, diff --git a/lua/lazyvim/plugins/extras/editor/harpoon2.lua b/lua/lazyvim/plugins/extras/editor/harpoon2.lua index 760d805a..699c2546 100644 --- a/lua/lazyvim/plugins/extras/editor/harpoon2.lua +++ b/lua/lazyvim/plugins/extras/editor/harpoon2.lua @@ -28,7 +28,7 @@ return { }, } - for i = 1, 5 do + for i = 1, 9 do table.insert(keys, { "" .. i, function() diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua index 19c8b331..3fe4c5e7 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -37,7 +37,7 @@ return { -- rename surround mappings from gs to gz to prevent conflict with leap { - "echasnovski/mini.surround", + "nvim-mini/mini.surround", optional = true, opts = { mappings = { diff --git a/lua/lazyvim/plugins/extras/editor/mini-diff.lua b/lua/lazyvim/plugins/extras/editor/mini-diff.lua index fe25c11e..ea2e216d 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-diff.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-diff.lua @@ -7,7 +7,7 @@ return { -- setup mini.diff { - "echasnovski/mini.diff", + "nvim-mini/mini.diff", event = "VeryLazy", keys = { { diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index 70a42940..30cc14fc 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -1,5 +1,5 @@ return { - "echasnovski/mini.files", + "nvim-mini/mini.files", opts = { windows = { preview = true, diff --git a/lua/lazyvim/plugins/extras/editor/mini-move.lua b/lua/lazyvim/plugins/extras/editor/mini-move.lua index aa8823ef..26e977fd 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-move.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-move.lua @@ -1,6 +1,6 @@ return { { - "echasnovski/mini.move", + "nvim-mini/mini.move", event = "VeryLazy", opts = {}, }, diff --git a/lua/lazyvim/plugins/extras/editor/navic.lua b/lua/lazyvim/plugins/extras/editor/navic.lua index e25d1b51..91ec203c 100644 --- a/lua/lazyvim/plugins/extras/editor/navic.lua +++ b/lua/lazyvim/plugins/extras/editor/navic.lua @@ -8,7 +8,7 @@ return { init = function() vim.g.navic_silence = true LazyVim.lsp.on_attach(function(client, buffer) - if client.supports_method("textDocument/documentSymbol") then + if client:supports_method("textDocument/documentSymbol") then require("nvim-navic").attach(client, buffer) end end) diff --git a/lua/lazyvim/plugins/extras/editor/refactoring.lua b/lua/lazyvim/plugins/extras/editor/refactoring.lua index 832940e9..11ab3786 100644 --- a/lua/lazyvim/plugins/extras/editor/refactoring.lua +++ b/lua/lazyvim/plugins/extras/editor/refactoring.lua @@ -30,34 +30,39 @@ return { "nvim-treesitter/nvim-treesitter", }, keys = { - { "r", "", desc = "+refactor", mode = { "n", "v" } }, + { "r", "", desc = "+refactor", mode = { "n", "x" } }, { "rs", pick, - mode = "v", + mode = { "n", "x" }, desc = "Refactor", }, { "ri", function() - require("refactoring").refactor("Inline Variable") + return require("refactoring").refactor("Inline Variable") end, - mode = { "n", "v" }, + mode = { "n", "x" }, desc = "Inline Variable", + expr = true, }, { "rb", function() - require("refactoring").refactor("Extract Block") + return require("refactoring").refactor("Extract Block") end, + mode = { "n", "x" }, desc = "Extract Block", + expr = true, }, { "rf", function() - require("refactoring").refactor("Extract Block To File") + return require("refactoring").refactor("Extract Block To File") end, + mode = { "n", "x" }, desc = "Extract Block To File", + expr = true, }, { "rP", @@ -71,6 +76,7 @@ return { function() require("refactoring").debug.print_var({ normal = true }) end, + mode = { "n", "x" }, desc = "Debug Print Variable", }, { @@ -83,33 +89,36 @@ return { { "rf", function() - require("refactoring").refactor("Extract Function") + return require("refactoring").refactor("Extract Function") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Function", + expr = true, }, { "rF", function() - require("refactoring").refactor("Extract Function To File") + return require("refactoring").refactor("Extract Function To File") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Function To File", + expr = true, }, { "rx", function() - require("refactoring").refactor("Extract Variable") + return require("refactoring").refactor("Extract Variable") end, - mode = "v", + mode = { "n", "x" }, desc = "Extract Variable", + expr = true, }, { "rp", function() require("refactoring").debug.print_var() end, - mode = "v", + mode = { "n", "x" }, desc = "Debug Print Variable", }, }, diff --git a/lua/lazyvim/plugins/extras/editor/snacks_picker.lua b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua index 93f32fab..591da5ea 100644 --- a/lua/lazyvim/plugins/extras/editor/snacks_picker.lua +++ b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua @@ -178,7 +178,7 @@ return { end, }, { - "echasnovski/mini.starter", + "nvim-mini/mini.starter", optional = true, opts = function(_, opts) local items = { diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 33dc4ed4..0ba58aca 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -9,6 +9,8 @@ return { "compile_commands.json", "compile_flags.txt", "configure.ac", -- AutoTools + "meson.build", + "build.ninja", }, }) end, @@ -60,19 +62,19 @@ return { keys = { { "ch", "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "Makefile", - "configure.ac", - "configure.in", - "config.h.in", - "meson.build", - "meson_options.txt", - "build.ninja" - )(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")( - fname - ) or require("lspconfig.util").find_git_ancestor(fname) - end, + root_markers = { + "compile_commands.json", + "compile_flags.txt", + "configure.ac", -- AutoTools + "Makefile", + "configure.ac", + "configure.in", + "config.h.in", + "meson.build", + "meson_options.txt", + "build.ninja", + ".git", + }, capabilities = { offsetEncoding = { "utf-16" }, }, diff --git a/lua/lazyvim/plugins/extras/lang/clojure.lua b/lua/lazyvim/plugins/extras/lang/clojure.lua index 7197aabd..c7af0b55 100644 --- a/lua/lazyvim/plugins/extras/lang/clojure.lua +++ b/lua/lazyvim/plugins/extras/lang/clojure.lua @@ -21,13 +21,13 @@ return { }, opts = function(_, opts) if type(opts.sources) == "table" then - vim.list_extend(opts.sources, { name = "clojure" }) + vim.list_extend(opts.sources, { name = "conjure" }) end end, }, -- Add s-exp mappings - { "PaterJason/nvim-treesitter-sexp", opts = {}, event = "LazyFile" }, + { "julienvincent/nvim-paredit", opts = {}, event = "LazyFile" }, -- Colorize the output of the log buffer { diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index ff8def2e..77536fea 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -139,7 +139,7 @@ return { -- Filetype icons { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".go-version"] = { glyph = "", hl = "MiniIconsBlue" }, diff --git a/lua/lazyvim/plugins/extras/lang/haskell.lua b/lua/lazyvim/plugins/extras/lang/haskell.lua index a599d310..48634f2d 100644 --- a/lua/lazyvim/plugins/extras/lang/haskell.lua +++ b/lua/lazyvim/plugins/extras/lang/haskell.lua @@ -70,7 +70,7 @@ return { "luc-tielen/telescope_hoogle", ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, dependencies = { - { "nvim-telescope/telescope.nvim" }, + { "nvim-telescope/telescope.nvim", optional = true }, }, config = function() local ok, telescope = pcall(require, "telescope") diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 6bcc7802..3525f910 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -87,14 +87,13 @@ return { opts = function() local cmd = { vim.fn.exepath("jdtls") } if LazyVim.has("mason.nvim") then - local mason_registry = require("mason-registry") - local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar" + local lombok_jar = vim.fn.expand("$MASON/share/jdtls/lombok.jar") table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar)) end return { - -- How to find the root dir for a given filename. The default comes from - -- lspconfig which provides a function specifically for java projects. - root_dir = LazyVim.lsp.get_raw_config("jdtls").default_config.root_dir, + root_dir = function(path) + return vim.fs.root(path, vim.lsp.config.jdtls.root_markers) + end, -- How to find the project name for a given root dir. project_name = function(root_dir) @@ -157,23 +156,10 @@ return { if LazyVim.has("mason.nvim") then local mason_registry = require("mason-registry") if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then - local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") - local java_dbg_path = java_dbg_pkg:get_install_path() - local jar_patterns = { - java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", - } + bundles = vim.fn.glob("$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin-*jar", false, true) -- java-test also depends on java-debug-adapter. if opts.test and mason_registry.is_installed("java-test") then - local java_test_pkg = mason_registry.get_package("java-test") - local java_test_path = java_test_pkg:get_install_path() - vim.list_extend(jar_patterns, { - java_test_path .. "/extension/server/*.jar", - }) - end - for _, jar_pattern in ipairs(jar_patterns) do - for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do - table.insert(bundles, bundle) - end + vim.list_extend(bundles, vim.fn.glob("$MASON/share/java-test/*.jar", false, true)) end end end diff --git a/lua/lazyvim/plugins/extras/lang/json.lua b/lua/lazyvim/plugins/extras/lang/json.lua index d51a6b19..453a6a77 100644 --- a/lua/lazyvim/plugins/extras/lang/json.lua +++ b/lua/lazyvim/plugins/extras/lang/json.lua @@ -27,7 +27,7 @@ return { servers = { jsonls = { -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.json.schemas = new_config.settings.json.schemas or {} vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) end, diff --git a/lua/lazyvim/plugins/extras/lang/ocaml.lua b/lua/lazyvim/plugins/extras/lang/ocaml.lua index 83f72a72..631223d4 100644 --- a/lua/lazyvim/plugins/extras/lang/ocaml.lua +++ b/lua/lazyvim/plugins/extras/lang/ocaml.lua @@ -26,17 +26,19 @@ return { "reason", "dune", }, - root_dir = function(fname) - return require("lspconfig.util").root_pattern( - "*.opam", - "esy.json", - "package.json", - ".git", - "dune-project", - "dune-workspace", - "*.ml" - )(fname) - end, + root_markers = { + function(name) + return name:match(".*%.opam$") + end, + "esy.json", + "package.json", + ".git", + "dune-project", + "dune-workspace", + function(name) + return name:match(".*%.ml$") + end, + }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/php.lua b/lua/lazyvim/plugins/extras/lang/php.lua index 5a2835aa..04469223 100644 --- a/lua/lazyvim/plugins/extras/lang/php.lua +++ b/lua/lazyvim/plugins/extras/lang/php.lua @@ -48,11 +48,10 @@ return { optional = true, opts = function() local dap = require("dap") - local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path() dap.adapters.php = { type = "executable", - command = "node", - args = { path .. "/extension/out/phpDebug.js" }, + command = "php-debug-adapter", + args = {}, } end, }, diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 4c098452..a02ded1f 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -114,19 +114,13 @@ return { { "linux-cultist/venv-selector.nvim", - branch = "regexp", -- Use this branch for the new version cmd = "VenvSelect", - enabled = function() - return LazyVim.has("telescope.nvim") - end, opts = { - settings = { - options = { - notify_user_on_venv_activation = true, - }, + options = { + notify_user_on_venv_activation = true, }, }, - -- Call config for python files and load the cached venv automatically + -- Call config for Python files and load the cached venv automatically ft = "python", keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, }, diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index 6320f624..f8feb0ea 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -65,11 +65,7 @@ return { opts = { servers = { r_language_server = { - root_dir = function(fname) - return require("lspconfig.util").root_pattern("DESCRIPTION", "NAMESPACE", ".Rbuildignore")(fname) - or require("lspconfig.util").find_git_ancestor(fname) - or vim.loop.os_homedir() - end, + root_markers = { "DESCRIPTION", "NAMESPACE", ".Rbuildignore" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index 4224e6d8..e9c68d11 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -6,10 +6,6 @@ if lazyvim_docs then end local lsp = vim.g.lazyvim_ruby_lsp or "ruby_lsp" -if vim.fn.has("nvim-0.10") == 0 then - -- ruby_lsp does not work well with Neovim < 0.10 - lsp = vim.g.lazyvim_ruby_lsp or "solargraph" -end local formatter = vim.g.lazyvim_ruby_formatter or "rubocop" return { @@ -25,9 +21,8 @@ return { }, { "neovim/nvim-lspconfig", - ---@class PluginLspOpts + ---@type PluginLspOpts opts = { - ---@type lspconfig.options servers = { ruby_lsp = { enabled = lsp == "ruby_lsp", diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 0adddf18..b66dde9b 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -56,7 +56,6 @@ return { { "mrcjkb/rustaceanvim", - version = vim.fn.has("nvim-0.10.0") == 0 and "^4" or false, ft = { "rust" }, opts = { server = { @@ -111,13 +110,9 @@ return { }, config = function(_, opts) if LazyVim.has("mason.nvim") then - local package_path = require("mason-registry").get_package("codelldb"):get_install_path() - local codelldb = package_path .. "/extension/adapter/codelldb" - local library_path = package_path .. "/extension/lldb/lib/liblldb.dylib" - local uname = io.popen("uname"):read("*l") - if uname == "Linux" then - library_path = package_path .. "/extension/lldb/lib/liblldb.so" - end + local codelldb = vim.fn.exepath("codelldb") + local codelldb_lib_ext = io.popen("uname"):read("*l") == "Linux" and ".so" or ".dylib" + local library_path = vim.fn.expand("$MASON/opt/lldb/lib/liblldb" .. codelldb_lib_ext) opts.dap = { adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb, library_path), } diff --git a/lua/lazyvim/plugins/extras/lang/svelte.lua b/lua/lazyvim/plugins/extras/lang/svelte.lua index 565e50e5..4060e2f3 100644 --- a/lua/lazyvim/plugins/extras/lang/svelte.lua +++ b/lua/lazyvim/plugins/extras/lang/svelte.lua @@ -31,11 +31,6 @@ return { desc = "Organize Imports", }, }, - capabilities = { - workspace = { - didChangeWatchedFiles = vim.fn.has("nvim-0.10") == 0 and { dynamicRegistration = true }, - }, - }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index cbdd612e..3c7b3fac 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -28,11 +28,10 @@ return { }, setup = { tailwindcss = function(_, opts) - local tw = LazyVim.lsp.get_raw_config("tailwindcss") opts.filetypes = opts.filetypes or {} -- Add default filetypes - vim.list_extend(opts.filetypes, tw.default_config.filetypes) + vim.list_extend(opts.filetypes, vim.lsp.config.tailwindcss.filetypes) -- Remove excluded filetypes --- @param ft string diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index f7cc3231..64dcd394 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -131,20 +131,42 @@ return { return true end, vtsls = function(_, opts) + if vim.lsp.config.denols and vim.lsp.config.vtsls then + ---@param server string + local resolve = function(server) + local markers, root_dir = vim.lsp.config[server].root_markers, vim.lsp.config[server].root_dir + vim.lsp.config(server, { + root_dir = function(bufnr, on_dir) + local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil + if is_deno == (server == "denols") then + if root_dir then + return root_dir(bufnr, on_dir) + elseif type(markers) == "table" then + local root = vim.fs.root(bufnr, markers) + return root and on_dir(root) + end + end + end, + }) + end + resolve("denols") + resolve("vtsls") + end + LazyVim.lsp.on_attach(function(client, buffer) client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx) ---@type string, string, lsp.Range local action, uri, range = unpack(command.arguments) local function move(newf) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = command.command, arguments = { action, uri, range, newf }, }) end local fname = vim.uri_to_fname(uri) - client.request("workspace/executeCommand", { + client:request("workspace/executeCommand", { command = "typescript.tsserverRequest", arguments = { "getMoveToRefactoringFileSuggestions", @@ -263,7 +285,7 @@ return { -- Filetype icons { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".eslintrc.js"] = { glyph = "󰱺", hl = "MiniIconsYellow" }, diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index 85f47772..a45caee7 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -19,13 +19,7 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - volar = { - init_options = { - vue = { - hybridMode = true, - }, - }, - }, + vue_ls = {}, vtsls = {}, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 9a3aadb8..9d8135e7 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -29,7 +29,7 @@ return { }, }, -- lazy-load schemastore when needed - on_new_config = function(new_config) + before_init = function(_, new_config) new_config.settings.yaml.schemas = vim.tbl_deep_extend( "force", new_config.settings.yaml.schemas or {}, @@ -55,16 +55,6 @@ return { }, }, }, - setup = { - yamlls = function() - -- Neovim < 0.10 does not have dynamic registration for formatting - if vim.fn.has("nvim-0.10") == 0 then - LazyVim.lsp.on_attach(function(client, _) - client.server_capabilities.documentFormattingProvider = true - end, "yamlls") - end - end, - }, }, }, } diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 01f134e2..fd860f9b 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -10,7 +10,7 @@ return { "neovim/nvim-lspconfig", -- other settings removed for brevity opts = { - ---@type lspconfig.options + ---@type table servers = { eslint = { settings = { @@ -26,10 +26,6 @@ return { return end - local function get_client(buf) - return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] - end - local formatter = LazyVim.lsp.formatter({ name = "eslint: lsp", primary = false, @@ -37,24 +33,6 @@ return { filter = "eslint", }) - -- Use EslintFixAll on Neovim < 0.10.0 - if not pcall(require, "vim.lsp._dynamic") then - formatter.name = "eslint: EslintFixAll" - formatter.sources = function(buf) - local client = get_client(buf) - return client and { "eslint" } or {} - end - formatter.format = function(buf) - local client = get_client(buf) - if client then - local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) }) - if #diag > 0 then - vim.cmd("EslintFixAll") - end - end - end - end - -- register the formatter with LazyVim LazyVim.format.register(formatter) end, diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index dbe76d1b..bf522270 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -1,5 +1,5 @@ return { - -- edgy + -- Create and display predefined window layouts. { "folke/edgy.nvim", event = "VeryLazy", diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index bbd3e587..b71c19a9 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -8,9 +8,10 @@ return { }, }, - -- setup animate + -- Animates many common Neovim actions, like scrolling, + -- moving the cursor, and resizing windows. { - "echasnovski/mini.animate", + "nvim-mini/mini.animate", event = "VeryLazy", cond = vim.g.neovide == nil, opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua index 91ec1d45..ea266b24 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua @@ -3,7 +3,7 @@ return { -- code, this highlights the current level of indentation, and animates -- the highlighting. { - "echasnovski/mini.indentscope", + "nvim-mini/mini.indentscope", version = false, -- wait till new 0.7.0 release to put it back on semver event = "LazyFile", opts = { diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index c1bd7bc1..51444df5 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -5,7 +5,7 @@ return { -- enable mini.starter { - "echasnovski/mini.starter", + "nvim-mini/mini.starter", version = false, -- wait till new 0.7.0 release to put it back on semver event = "VimEnter", opts = function() @@ -67,7 +67,7 @@ return { local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) local pad_footer = string.rep(" ", 8) starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" - -- INFO: based on @echasnovski's recommendation (thanks a lot!!!) + -- INFO: based on @nvim-mini's recommendation (thanks a lot!!!) if vim.bo[ev.buf].filetype == "ministarter" then pcall(starter.refresh) end diff --git a/lua/lazyvim/plugins/extras/ui/smear-cursor.lua b/lua/lazyvim/plugins/extras/ui/smear-cursor.lua index 070d2623..4ab6f03e 100644 --- a/lua/lazyvim/plugins/extras/ui/smear-cursor.lua +++ b/lua/lazyvim/plugins/extras/ui/smear-cursor.lua @@ -1,3 +1,4 @@ +-- Animates cursor movement with a smear effect. return { "sphamba/smear-cursor.nvim", event = "VeryLazy", @@ -9,7 +10,7 @@ return { specs = { -- disable mini.animate cursor { - "echasnovski/mini.animate", + "nvim-mini/mini.animate", optional = true, opts = { cursor = { enable = false }, diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 6c88fc45..2c1b2f31 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -135,7 +135,7 @@ return { -- Filetype icons { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", opts = { file = { [".chezmoiignore"] = { glyph = "", hl = "MiniIconsGrey" }, diff --git a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua index 287c0d77..b8fa4d1a 100644 --- a/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua +++ b/lua/lazyvim/plugins/extras/util/mini-hipatterns.lua @@ -4,7 +4,7 @@ local M = {} M.hl = {} M.plugin = { - "echasnovski/mini.hipatterns", + "nvim-mini/mini.hipatterns", recommended = true, desc = "Highlight colors in your code. Also includes Tailwind CSS support.", event = "LazyFile", diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 01a25bc2..dafaa594 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -134,7 +134,7 @@ return { }, { - "echasnovski/mini.starter", + "nvim-mini/mini.starter", optional = true, opts = function(_, opts) local items = { diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index c06fa9bc..80394371 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -1,11 +1,20 @@ -if vim.fn.has("nvim-0.9.0") == 0 then +if vim.fn.has("nvim-0.11.2") == 0 then vim.api.nvim_echo({ - { "LazyVim requires Neovim >= 0.9.0\n", "ErrorMsg" }, + { "LazyVim requires Neovim >= 0.11.2\n", "ErrorMsg" }, + { "For more info, see: https://github.com/LazyVim/LazyVim/issues/6421\n", "Comment" }, { "Press any key to exit", "MoreMsg" }, }, true, {}) vim.fn.getchar() vim.cmd([[quit]]) return {} +elseif not vim.lsp.is_enabled then + vim.schedule(function() + LazyVim.warn({ + "You're using an **old** `nightly` version of **Neovim**", + "Please update to a recent `nightly`,", + "or a stable version (`>= 0.11.2`).", + }) + end) end require("lazyvim.config").init() diff --git a/lua/lazyvim/plugins/linting.lua b/lua/lazyvim/plugins/linting.lua index 46cf2898..9b1bed29 100644 --- a/lua/lazyvim/plugins/linting.lua +++ b/lua/lazyvim/plugins/linting.lua @@ -1,4 +1,6 @@ return { + -- Asynchronously calls language-specific linter tools and reports + -- their results via the `vim.diagnostic` module. { "mfussenegger/nvim-lint", event = "LazyFile", diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index b5cba5f1..2fe3ae97 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -20,7 +20,6 @@ return { source = "if_many", prefix = "●", -- this will set set the prefix to a function that returns the diagnostics icon based on the severity - -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported -- prefix = "icons", }, severity_sort = true, @@ -33,19 +32,25 @@ return { }, }, }, - -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP inlay hints on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the inlay hints. inlay_hints = { enabled = true, exclude = { "vue" }, -- filetypes for which you don't want to enable inlay hints }, - -- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0 + -- Enable this to enable the builtin LSP code lenses on Neovim. -- Be aware that you also will need to properly configure your LSP server to -- provide the code lenses. codelens = { enabled = false, }, + -- Enable this to enable the builtin LSP folding on Neovim. + -- Be aware that you also will need to properly configure your LSP server to + -- provide the folds. + folds = { + enabled = true, + }, -- add any global capabilities here capabilities = { workspace = { @@ -63,7 +68,8 @@ return { timeout_ms = nil, }, -- LSP Server Settings - ---@type lspconfig.options + ---@alias lazyvim.lsp.Config vim.lsp.Config|{mason?:boolean, enabled?:boolean} + ---@type table servers = { lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason @@ -99,7 +105,7 @@ return { }, -- you can do any additional lsp server setup here -- return true if you don't want this server to be setup with lspconfig - ---@type table + ---@type table setup = { -- example to setup with typescript.nvim -- tsserver = function(_, opts) @@ -113,7 +119,7 @@ return { return ret end, ---@param opts PluginLspOpts - config = function(_, opts) + config = vim.schedule_wrap(function(_, opts) -- setup autoformat LazyVim.format.register(LazyVim.lsp.formatter()) @@ -125,133 +131,95 @@ return { LazyVim.lsp.setup() LazyVim.lsp.on_dynamic_capability(require("lazyvim.plugins.lsp.keymaps").on_attach) - -- diagnostics signs - if vim.fn.has("nvim-0.10.0") == 0 then - if type(opts.diagnostics.signs) ~= "boolean" then - for severity, icon in pairs(opts.diagnostics.signs.text) do - local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper) - name = "DiagnosticSign" .. name - vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + -- inlay hints + if opts.inlay_hints.enabled then + LazyVim.lsp.on_supports_method("textDocument/inlayHint", function(client, buffer) + if + vim.api.nvim_buf_is_valid(buffer) + and vim.bo[buffer].buftype == "" + and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) + then + vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) end - end + end) end - if vim.fn.has("nvim-0.10") == 1 then - -- inlay hints - if opts.inlay_hints.enabled then - LazyVim.lsp.on_supports_method("textDocument/inlayHint", function(client, buffer) - if - vim.api.nvim_buf_is_valid(buffer) - and vim.bo[buffer].buftype == "" - and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) - then - vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) - end - end) - end - - -- code lens - if opts.codelens.enabled and vim.lsp.codelens then - LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer) - vim.lsp.codelens.refresh() - vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { - buffer = buffer, - callback = vim.lsp.codelens.refresh, - }) - end) - end + -- folds + if opts.folds.enabled then + LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer) + if LazyVim.set_default("foldmethod", "expr") then + LazyVim.set_default("foldexpr", "v:lua.vim.lsp.foldexpr()") + end + end) end + -- code lens + if opts.codelens.enabled and vim.lsp.codelens then + LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer) + vim.lsp.codelens.refresh() + vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { + buffer = buffer, + callback = vim.lsp.codelens.refresh, + }) + end) + end + + -- diagnostics if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then - opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●" - or function(diagnostic) - local icons = LazyVim.config.icons.diagnostics - for d, icon in pairs(icons) do - if diagnostic.severity == vim.diagnostic.severity[d:upper()] then - return icon - end + opts.diagnostics.virtual_text.prefix = function(diagnostic) + local icons = LazyVim.config.icons.diagnostics + for d, icon in pairs(icons) do + if diagnostic.severity == vim.diagnostic.severity[d:upper()] then + return icon end end + return "●" + end end - vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) - 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 {} - ) - - local function setup(server) - local server_opts = vim.tbl_deep_extend("force", { - capabilities = vim.deepcopy(capabilities), - }, servers[server] or {}) - if server_opts.enabled == false then - return - end - - if opts.setup[server] then - if opts.setup[server](server, server_opts) then - return - end - elseif opts.setup["*"] then - if opts.setup["*"](server, server_opts) then - return - end - end - require("lspconfig")[server].setup(server_opts) + if opts.capabilities then + vim.lsp.config("*", { capabilities = opts.capabilities }) end -- get all the servers that are available through mason-lspconfig - local have_mason, mlsp = pcall(require, "mason-lspconfig") - local all_mslp_servers = {} - if have_mason then - all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) - end + local have_mason = LazyVim.has("mason-lspconfig.nvim") + local mason_all = have_mason + and vim.tbl_keys(require("mason-lspconfig.mappings").get_mason_map().lspconfig_to_package) + or {} --[[ @as string[] ]] + local mason_exclude = {} ---@type string[] - local ensure_installed = {} ---@type string[] - for server, server_opts in pairs(servers) do - if server_opts then - server_opts = server_opts == true and {} or server_opts - if server_opts.enabled ~= false then - -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig - if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then - setup(server) - else - ensure_installed[#ensure_installed + 1] = server - end + ---@return boolean? exclude automatic setup + local function configure(server) + local sopts = opts.servers[server] + sopts = sopts == true and {} or (not sopts) and { enabled = false } or sopts --[[@as lazyvim.lsp.Config]] + + if sopts.enabled == false then + mason_exclude[#mason_exclude + 1] = server + return + end + + local use_mason = sopts.mason ~= false and vim.tbl_contains(mason_all, server) + local setup = opts.setup[server] or opts.setup["*"] + if setup and setup(server, sopts) then + mason_exclude[#mason_exclude + 1] = server + else + vim.lsp.config(server, sopts) -- configure the server + if not use_mason then + vim.lsp.enable(server) end end + return use_mason end + local install = vim.tbl_filter(configure, vim.tbl_keys(opts.servers)) if have_mason then - mlsp.setup({ - ensure_installed = vim.tbl_deep_extend( - "force", - ensure_installed, - LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {} - ), - handlers = { setup }, + require("mason-lspconfig").setup({ + ensure_installed = vim.list_extend(install, LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {}), + automatic_enable = { exclude = mason_exclude }, }) end - - if LazyVim.lsp.is_enabled("denols") and LazyVim.lsp.is_enabled("vtsls") then - local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc") - LazyVim.lsp.disable("vtsls", is_deno) - LazyVim.lsp.disable("denols", function(root_dir, config) - if not is_deno(root_dir) then - config.settings.deno.enable = false - end - return false - end) - end - end, + end), }, -- cmdline tools and lsp servers @@ -292,8 +260,4 @@ return { end) end, }, - - -- pin to v1 for now - { "mason-org/mason.nvim", version = "^1.0.0" }, - { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" }, } diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 318ec911..9cde08c1 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -52,9 +52,9 @@ function M.has(buffer, method) return false end method = method:find("/") and method or "textDocument/" .. method - local clients = LazyVim.lsp.get_clients({ bufnr = buffer }) + local clients = vim.lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do - if client.supports_method(method) then + if client:supports_method(method) then return true end end @@ -69,7 +69,7 @@ function M.resolve(buffer) end local spec = vim.tbl_extend("force", {}, M.get()) local opts = LazyVim.opts("nvim-lspconfig") - local clients = LazyVim.lsp.get_clients({ bufnr = buffer }) + local clients = vim.lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} vim.list_extend(spec, maps) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 0f0c8fe8..8ad15924 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -1,43 +1,32 @@ return { - { - "folke/which-key.nvim", - opts = { - spec = { - { "", desc = "Decrement Selection", mode = "x" }, - { "", desc = "Increment Selection", mode = { "x", "n" } }, - }, - }, - }, -- Treesitter is a new parser generator tool that we can -- use in Neovim to power faster and more accurate -- syntax highlighting. { "nvim-treesitter/nvim-treesitter", + branch = "main", version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "LazyFile", "VeryLazy" }, - lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline - init = function(plugin) - -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early - -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which - -- no longer trigger the **nvim-treesitter** module to be loaded in time. - -- Luckily, the only things that those plugins need are the custom queries, which we make available - -- during startup. - require("lazy.core.loader").add_to_rtp(plugin) - require("nvim-treesitter.query_predicates") + build = function() + local TS = require("nvim-treesitter") + if not TS.get_installed then + LazyVim.error("Please restart Neovim and run `:TSUpdate` to use the `nvim-treesitter` **main** branch.") + return + end + LazyVim.treesitter.ensure_treesitter_cli(function() + TS.update(nil, { summary = true }) + end) end, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, - keys = { - { "", desc = "Increment Selection" }, - { "", desc = "Decrement Selection", mode = "x" }, - }, + lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline + event = { "LazyFile", "VeryLazy" }, + cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" }, opts_extend = { "ensure_installed" }, - ---@type TSConfig - ---@diagnostic disable-next-line: missing-fields + ---@class lazyvim.TSConfig: TSConfig opts = { - highlight = { enable = true }, + -- LazyVim config for treesitter indent = { enable = true }, + highlight = { enable = true }, + folds = { enable = true }, ensure_installed = { "bash", "c", @@ -64,65 +53,120 @@ return { "xml", "yaml", }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, - }, - }, }, - ---@param opts TSConfig + ---@param opts lazyvim.TSConfig config = function(_, opts) - if type(opts.ensure_installed) == "table" then - opts.ensure_installed = LazyVim.dedup(opts.ensure_installed) + local TS = require("nvim-treesitter") + + setmetatable(require("nvim-treesitter.install"), { + __newindex = function(_, k) + if k == "compilers" then + vim.schedule(function() + LazyVim.error({ + "Setting custom compilers for `nvim-treesitter` is no longer supported.", + "", + "For more info, see:", + "- [compilers](https://docs.rs/cc/latest/cc/#compile-time-requirements)", + }) + end) + end + end, + }) + + -- some quick sanity checks + if not TS.get_installed then + return LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + elseif type(opts.ensure_installed) ~= "table" then + return LazyVim.error("`nvim-treesitter` opts.ensure_installed must be a table") end - require("nvim-treesitter.configs").setup(opts) + + -- setup treesitter + TS.setup(opts) + LazyVim.treesitter.get_installed(true) -- initialize the installed langs + + -- install missing parsers + local install = vim.tbl_filter(function(lang) + return not LazyVim.treesitter.have(lang) + end, opts.ensure_installed or {}) + if #install > 0 then + LazyVim.treesitter.ensure_treesitter_cli(function() + TS.install(install, { summary = true }):await(function() + LazyVim.treesitter.get_installed(true) -- refresh the installed langs + end) + end) + end + + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("lazyvim_treesitter", { clear = true }), + callback = function(ev) + if not LazyVim.treesitter.have(ev.match) then + return + end + + -- highlighting + if vim.tbl_get(opts, "highlight", "enable") ~= false then + pcall(vim.treesitter.start) + end + + -- indents + if vim.tbl_get(opts, "indent", "enable") ~= false and LazyVim.treesitter.have(ev.match, "indents") then + LazyVim.set_default("indentexpr", "v:lua.LazyVim.treesitter.indentexpr()") + end + + -- folds + if vim.tbl_get(opts, "folds", "enable") ~= false and LazyVim.treesitter.have(ev.match, "folds") then + if LazyVim.set_default("foldmethod", "expr") then + LazyVim.set_default("foldexpr", "v:lua.LazyVim.treesitter.foldexpr()") + end + end + end, + }) end, }, { "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", event = "VeryLazy", - enabled = true, - config = function() - -- If treesitter is already loaded, we need to run config again for textobjects - if LazyVim.is_loaded("nvim-treesitter") then - local opts = LazyVim.opts("nvim-treesitter") - require("nvim-treesitter.configs").setup({ textobjects = opts.textobjects }) - end - - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - local configs = require("nvim-treesitter.configs") - for name, fn in pairs(move) do - if name:find("goto") == 1 then - move[name] = function(q, ...) - if vim.wo.diff then - local config = configs.get_module("textobjects.move")[name] ---@type table - for key, query in pairs(config or {}) do - if q == query and key:find("[%]%[][cC]") then - vim.cmd("normal! " .. key) - return - end + opts = {}, + keys = function() + local moves = { + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + } + local ret = {} ---@type LazyKeysSpec[] + for method, keymaps in pairs(moves) do + for key, query in pairs(keymaps) do + local desc = query:gsub("@", ""):gsub("%..*", "") + desc = desc:sub(1, 1):upper() .. desc:sub(2) + desc = (key:sub(1, 1) == "[" and "Prev " or "Next ") .. desc + desc = desc .. (key:sub(2, 2) == key:sub(2, 2):upper() and " End" or " Start") + ret[#ret + 1] = { + key, + function() + -- don't use treesitter if in diff mode and the key is one of the c/C keys + if vim.wo.diff and key:find("[cC]") then + return vim.cmd("normal! " .. key) end - end - return fn(q, ...) - end + require("nvim-treesitter-textobjects.move")[method](query, "textobjects") + end, + desc = desc, + mode = { "n", "x", "o" }, + silent = true, + } end end + return ret + end, + config = function(_, opts) + local TS = require("nvim-treesitter-textobjects") + if not TS.setup then + LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`") + return + end + TS.setup(opts) end, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 7985825a..23afdc39 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -60,7 +60,8 @@ return { end, }, - -- statusline + -- Displays a fancy status line with git status, + -- LSP diagnostics, filetype information, and more. { "nvim-lualine/lualine.nvim", event = "VeryLazy", @@ -245,7 +246,7 @@ return { -- icons { - "echasnovski/mini.icons", + "nvim-mini/mini.icons", lazy = true, opts = { file = { diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index bb061d80..19a5c6da 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -3,7 +3,8 @@ local prios = { ["lazyvim.plugins.extras.test.core"] = 1, ["lazyvim.plugins.extras.dap.core"] = 1, ["lazyvim.plugins.extras.coding.nvim-cmp"] = 2, - ["lazyvim.plugins.extras.ui.edgy"] = 2, + ["lazyvim.plugins.extras.editor.neo-tree"] = 2, + ["lazyvim.plugins.extras.ui.edgy"] = 3, ["lazyvim.plugins.extras.lang.typescript"] = 5, ["lazyvim.plugins.extras.coding.blink"] = 5, ["lazyvim.plugins.extras.formatting.prettier"] = 10, @@ -42,15 +43,7 @@ end ---@type string[] extras = LazyVim.dedup(extras) -local version = vim.version() -local v = version.major .. "_" .. version.minor - -local compat = { "0_9" } - LazyVim.plugin.save_core() -if vim.tbl_contains(compat, v) then - table.insert(extras, 1, "lazyvim.plugins.compat.nvim-" .. v) -end if vim.g.vscode then table.insert(extras, 1, "lazyvim.plugins.extras.vscode") end diff --git a/lua/lazyvim/util/deprecated.lua b/lua/lazyvim/util/deprecated.lua index 375bc9ca..3aad7318 100644 --- a/lua/lazyvim/util/deprecated.lua +++ b/lua/lazyvim/util/deprecated.lua @@ -1,3 +1,4 @@ +---@class lazyvim.util.deprecated local M = {} M.moved = { @@ -13,6 +14,7 @@ M.moved = { ui = { statuscolumn = { "Snacks.statuscolumn" }, bufremove = { "Snacks.bufdelete" }, + foldexpr = { "LazyVim.treesitter.foldexpr", stacktrace = false }, fg = { "{ fg = Snacks.util.color(...) }", fn = function(...) @@ -28,7 +30,7 @@ function M.decorate(name, mod) if not M.moved[name] then return mod end - setmetatable(mod, { + return setmetatable(mod, { __call = function(_, ...) local to = M.moved[name].__call[1] LazyVim.deprecate("LazyVim." .. name, to) @@ -38,7 +40,9 @@ function M.decorate(name, mod) __index = function(_, k) if M.moved[name][k] then local to = M.moved[name][k][1] - LazyVim.deprecate("LazyVim." .. name .. "." .. k, to) + LazyVim.deprecate("LazyVim." .. name .. "." .. k, to, { + stacktrace = M.moved[name][k].stacktrace, + }) if M.moved[name][k].fn then return M.moved[name][k].fn end @@ -55,6 +59,10 @@ function M.lazygit() return Snacks.lazygit end +function M.ui() + return M.decorate("ui", {}) +end + function M.toggle() LazyVim.deprecate("LazyVim.toggle", "Snacks.toggle") return { diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 4b49f539..812e6f22 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -2,7 +2,7 @@ local LazyUtil = require("lazy.core.util") ---@class lazyvim.util: LazyUtilCore ---@field config LazyVimConfig ----@field ui lazyvim.util.ui +---@field treesitter lazyvim.util.treesitter ---@field lsp lazyvim.util.lsp ---@field root lazyvim.util.root ---@field terminal lazyvim.util.terminal @@ -16,14 +16,16 @@ local LazyUtil = require("lazy.core.util") ---@field mini lazyvim.util.mini ---@field pick lazyvim.util.pick ---@field cmp lazyvim.util.cmp +---@field deprecated lazyvim.util.deprecated local M = {} +M.deprecated = require("lazyvim.util.deprecated") setmetatable(M, { __index = function(t, k) if LazyUtil[k] then return LazyUtil[k] end - if k == "lazygit" or k == "toggle" then -- HACK: special case for lazygit + if M.deprecated[k] then return M.deprecated[k]() end ---@diagnostic disable-next-line: no-unknown @@ -125,13 +127,17 @@ function M.opts(name) return Plugin.values(plugin, "opts", false) end -function M.deprecate(old, new) - M.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), { - title = "LazyVim", - once = true, - stacktrace = true, - stacklevel = 6, - }) +---@param opts? LazyNotifyOpts +function M.deprecate(old, new, opts) + M.warn( + ("`%s` is deprecated. Please use `%s` instead"):format(old, new), + vim.tbl_extend("force", { + title = "LazyVim", + once = true, + stacktrace = true, + stacklevel = 6, + }, opts or {}) + ) end -- delay notifications till vim.notify was replaced or after 500ms @@ -253,11 +259,18 @@ function M.get_pkg_path(pkg, path, opts) opts = opts or {} opts.warn = opts.warn == nil and true or opts.warn path = path or "" - local ret = root .. "/packages/" .. pkg .. "/" .. path - if opts.warn and not vim.loop.fs_stat(ret) and not require("lazy.core.config").headless() then - M.warn( - ("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(pkg, path) - ) + local ret = vim.fs.normalize(root .. "/packages/" .. pkg .. "/" .. path) + if opts.warn then + vim.schedule(function() + if not require("lazy.core.config").headless() and not vim.loop.fs_stat(ret) then + M.warn( + ("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format( + pkg, + path + ) + ) + end + end) end return ret end @@ -286,4 +299,63 @@ function M.memoize(fn) end end +-- Safe wrapper around snacks to prevent errors when LazyVim is still installing +function M.statuscolumn() + return package.loaded.snacks and require("snacks.statuscolumn").get() or "" +end + +local _defaults = {} ---@type table + +-- Determines whether it's safe to set an option to a default value. +-- +-- It will only set the option if: +-- * it is the same as the global value +-- * it's current value is a default value +-- * it was last set by a script in $VIMRUNTIME +---@param option string +---@param value string|number|boolean +---@return boolean was_set +function M.set_default(option, value) + local l = vim.api.nvim_get_option_value(option, { scope = "local" }) + local g = LazyVim.config._options[option] or vim.api.nvim_get_option_value(option, { scope = "global" }) + + _defaults[("%s=%s"):format(option, value)] = true + local key = ("%s=%s"):format(option, l) + + local source = "" + if l ~= g and not _defaults[key] then + -- Option does not match global and is not a default value + -- Check if it was set by a script in $VIMRUNTIME + local info = vim.api.nvim_get_option_info2(option, { scope = "local" }) + ---@param e vim.fn.getscriptinfo.ret + local scriptinfo = vim.tbl_filter(function(e) + return e.sid == info.last_set_sid + end, vim.fn.getscriptinfo()) + source = scriptinfo[1] and scriptinfo[1].name or "" + local by_rtp = #scriptinfo == 1 and vim.startswith(scriptinfo[1].name, vim.fn.expand("$VIMRUNTIME")) + if not by_rtp then + if vim.g.lazyvim_debug_set_default then + LazyVim.warn( + ("Not setting option `%s` to `%q` because it was changed by a plugin."):format(option, value), + { title = "LazyVim", once = true } + ) + end + return false + end + end + + if vim.g.lazyvim_debug_set_default then + LazyVim.info({ + ("Setting option `%s` to `%q`"):format(option, value), + ("Was: %q"):format(l), + ("Global: %q"):format(g), + source ~= "" and ("Last set by: %s"):format(source) or "", + "buf: " .. vim.api.nvim_buf_get_name(0), + }, { title = "LazyVim", once = true }) + end + + vim.api.nvim_set_option_value(option, value, { scope = "local" }) + return true +end + return M diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index e868dcf0..a857422f 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -1,26 +1,6 @@ ---@class lazyvim.util.lsp local M = {} ----@alias lsp.Client.filter {id?: number, bufnr?: number, name?: string, method?: string, filter?:fun(client: lsp.Client):boolean} - ----@param opts? lsp.Client.filter -function M.get_clients(opts) - local ret = {} ---@type vim.lsp.Client[] - if vim.lsp.get_clients then - ret = vim.lsp.get_clients(opts) - else - ---@diagnostic disable-next-line: deprecated - ret = vim.lsp.get_active_clients(opts) - if opts and opts.method then - ---@param client vim.lsp.Client - ret = vim.tbl_filter(function(client) - return client.supports_method(opts.method, { bufnr = opts.bufnr }) - end, ret) - end - end - return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret -end - ---@param on_attach fun(client:vim.lsp.Client, buffer) ---@param name? string function M.on_attach(on_attach, name) @@ -75,7 +55,7 @@ function M._check_methods(client, buffer) for method, clients in pairs(M._supports_method) do clients[client] = clients[client] or {} if not clients[client][buffer] then - if client.supports_method and client.supports_method(method, { bufnr = buffer }) then + if client.supports_method and client:supports_method(method, buffer) then clients[client][buffer] = true vim.api.nvim_exec_autocmds("User", { pattern = "LspSupportsMethod", @@ -118,45 +98,12 @@ function M.on_supports_method(method, fn) }) end ----@return _.lspconfig.options -function M.get_config(server) - local configs = require("lspconfig.configs") - return rawget(configs, server) -end - ----@return {default_config:lspconfig.Config} -function M.get_raw_config(server) - local ok, ret = pcall(require, "lspconfig.configs." .. server) - if ok then - return ret - end - return require("lspconfig.server_configurations." .. server) -end - -function M.is_enabled(server) - local c = M.get_config(server) - return c and c.enabled ~= false -end - ----@param server string ----@param cond fun( root_dir, config): boolean -function M.disable(server, cond) - local util = require("lspconfig.util") - local def = M.get_config(server) - ---@diagnostic disable-next-line: undefined-field - def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir) - if cond(root_dir, config) then - config.enabled = false - end - end) -end - ----@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter)} +---@param opts? LazyFormatter| {filter?: (string|vim.lsp.get_clients.Filter)} function M.formatter(opts) opts = opts or {} local filter = opts.filter or {} filter = type(filter) == "string" and { name = filter } or filter - ---@cast filter lsp.Client.filter + ---@cast filter vim.lsp.get_clients.Filter ---@type LazyFormatter local ret = { name = "LSP", @@ -166,11 +113,11 @@ function M.formatter(opts) M.format(LazyVim.merge({}, filter, { bufnr = buf })) end, sources = function(buf) - local clients = M.get_clients(LazyVim.merge({}, filter, { bufnr = buf })) + local clients = vim.lsp.get_clients(LazyVim.merge({}, filter, { bufnr = buf })) ---@param client vim.lsp.Client local ret = vim.tbl_filter(function(client) - return client.supports_method("textDocument/formatting") - or client.supports_method("textDocument/rangeFormatting") + return client:supports_method("textDocument/formatting") + or client:supports_method("textDocument/rangeFormatting") end, clients) ---@param client vim.lsp.Client return vim.tbl_map(function(client) @@ -181,7 +128,7 @@ function M.formatter(opts) return LazyVim.merge(ret, opts) --[[@as LazyFormatter]] end ----@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter +---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | vim.lsp.get_clients.Filter ---@param opts? lsp.Client.format function M.format(opts) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 5f4f1885..a6aa24f3 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -101,9 +101,20 @@ function M.pretty_path(opts) local root = LazyVim.root.get({ normalize = true }) local cwd = LazyVim.root.cwd() - if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then + -- original path is preserved to provide user with expected result of pretty_path, not a normalized one, + -- which might be confusing + local norm_path = path + + if LazyVim.is_win() then + -- in case any of the provided paths involved mixed case, an additional normalization step for windows + norm_path = norm_path:lower() + root = root:lower() + cwd = cwd:lower() + end + + if opts.relative == "cwd" and norm_path:find(cwd, 1, true) == 1 then path = path:sub(#cwd + 2) - elseif path:find(root, 1, true) == 1 then + elseif norm_path:find(root, 1, true) == 1 then path = path:sub(#root + 2) end diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 9fede549..58063385 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -1,3 +1,4 @@ +local Meta = require("lazy.core.meta") local Plugin = require("lazy.core.plugin") ---@class lazyvim.util.plugin @@ -16,6 +17,7 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.", ["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**", ["lazyvim.plugins.extras.ui.treesitter-rewrite"] = "Disabled `treesitter-rewrite` extra for now. Not ready yet.", + ["lazyvim.plugins.extras.ui.treesitter-main"] = "the `nvim-treesitter` main branch is now used by default", ["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a core LazyVim plugin (again)", ["lazyvim.plugins.extras.lazyrc"] = "local spec files are now a lazy.nvim feature", ["lazyvim.plugins.extras.editor.trouble-v3"] = "Trouble v3 has been merged in main", @@ -102,9 +104,17 @@ function M.fix_imports() end function M.fix_renames() - Plugin.Spec.add = LazyVim.inject.args(Plugin.Spec.add, function(self, plugin) + ---@param plugin LazyPluginSpec + Meta.add = LazyVim.inject.args(Meta.add, function(self, plugin) if type(plugin) == "table" then - if M.renames[plugin[1]] then + local name = plugin[1] + if not name then + return + end + if name:find("echasnovski") then + M.renames[name] = name:gsub("echasnovski", "nvim-mini") + end + if M.renames[name] then LazyVim.warn( ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( plugin[1], @@ -113,7 +123,7 @@ function M.fix_renames() ), { title = "LazyVim" } ) - plugin[1] = M.renames[plugin[1]] + plugin[1] = M.renames[name] end end end) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index fc6d6d7d..b3d68721 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -29,10 +29,10 @@ function M.detectors.lsp(buf) return {} end local roots = {} ---@type string[] - local clients = LazyVim.lsp.get_clients({ bufnr = buf }) + local clients = vim.lsp.get_clients({ bufnr = buf }) clients = vim.tbl_filter(function(client) return not vim.tbl_contains(vim.g.root_lsp_ignore or {}, client.name) - end, clients) + end, clients) --[[@as vim.lsp.Client[] ]] for _, client in pairs(clients) do local workspace = client.config.workspace_folders for _, ws in pairs(workspace or {}) do diff --git a/lua/lazyvim/util/treesitter.lua b/lua/lazyvim/util/treesitter.lua new file mode 100644 index 00000000..b1d647e8 --- /dev/null +++ b/lua/lazyvim/util/treesitter.lua @@ -0,0 +1,101 @@ +---@class lazyvim.util.treesitter +local M = {} + +M._installed = nil ---@type table? +M._queries = {} ---@type table + +---@param update boolean? +function M.get_installed(update) + if update then + M._installed, M._queries = {}, {} + for _, lang in ipairs(require("nvim-treesitter").get_installed("parsers")) do + M._installed[lang] = true + end + end + return M._installed or {} +end + +---@param lang string +---@param query string +function M.have_query(lang, query) + local key = lang .. ":" .. query + if M._queries[key] == nil then + M._queries[key] = vim.treesitter.query.get(lang, query) ~= nil + end + return M._queries[key] +end + +---@param what string|number|nil +---@param query? string +---@overload fun(buf?:number):boolean +---@overload fun(ft:string):boolean +---@return boolean +function M.have(what, query) + what = what or vim.api.nvim_get_current_buf() + what = type(what) == "number" and vim.bo[what].filetype or what --[[@as string]] + local lang = vim.treesitter.language.get_lang(what) + if lang == nil or M.get_installed()[lang] == nil then + return false + end + if query and not M.have_query(lang, query) then + return false + end + return true +end + +function M.foldexpr() + return M.have(nil, "folds") and vim.treesitter.foldexpr() or "0" +end + +function M.indentexpr() + return M.have(nil, "indents") and require("nvim-treesitter").indentexpr() or -1 +end + +---@param cb fun() +function M.ensure_treesitter_cli(cb) + if vim.fn.executable("tree-sitter") == 1 then + return cb() + end + + ---@param msg? string + local function fail(msg) + return LazyVim.error({ + "**treesitter-nvim** `main` requires the `tree-sitter` CLI executable to be installed.", + "Please install it manually from https://github.com/tree-sitter/tree-sitter/tree/master/crates/cli or", + "use your system package manager.", + "Run `:checkhealth nvim-treesitter` for more information.", + msg, + }) + end + + -- try installing with mason + if not pcall(require, "mason") then + return fail("`mason.nvim` is disabled in your config, so we cannot install it automatically.") + end + + -- check again since we might have installed it already + if vim.fn.executable("tree-sitter") == 1 then + return cb() + end + + local mr = require("mason-registry") + mr.refresh(function() + local p = mr.get_package("tree-sitter-cli") + if not p:is_installed() then + LazyVim.info("Installing `tree-sitter-cli` with `mason.nvim`...") + p:install( + nil, + vim.schedule_wrap(function(success) + if success then + LazyVim.info("Installed `tree-sitter-cli` with `mason.nvim`.") + cb() + else + fail("Failed to install `tree-sitter-cli` with `mason.nvim`.") + end + end) + ) + end + end) +end + +return M diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua deleted file mode 100644 index 3460b0ab..00000000 --- a/lua/lazyvim/util/ui.lua +++ /dev/null @@ -1,27 +0,0 @@ ----@class lazyvim.util.ui -local M = {} - --- foldtext for Neovim < 0.10.0 -function M.foldtext() - return vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1] -end - --- optimized treesitter foldexpr for Neovim >= 0.10.0 -function M.foldexpr() - local buf = vim.api.nvim_get_current_buf() - if vim.b[buf].ts_folds == nil then - -- as long as we don't have a filetype, don't bother - -- checking if treesitter is available (it won't) - if vim.bo[buf].filetype == "" then - return "0" - end - if vim.bo[buf].filetype:find("dashboard") then - vim.b[buf].ts_folds = false - else - vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf) - end - end - return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0" -end - -return M diff --git a/tests/extras/extra_spec.lua b/tests/extras/extra_spec.lua index 2afb6b94..2a4a9bc8 100644 --- a/tests/extras/extra_spec.lua +++ b/tests/extras/extra_spec.lua @@ -26,7 +26,8 @@ describe("Extra", function() return not vim.tbl_contains(ignore, extra.modname) end, extras) - local lsp_to_pkg = require("mason-lspconfig.mappings.server").lspconfig_to_package + local lsp_to_pkg = {} + lsp_to_pkg = require("mason-lspconfig.mappings").get_mason_map().lspconfig_to_package local tsspec = Plugin.Spec.new({ import = "lazyvim.plugins.treesitter", diff --git a/tests/minit.lua b/tests/minit.lua index 807a2ac5..41907e75 100644 --- a/tests/minit.lua +++ b/tests/minit.lua @@ -9,8 +9,8 @@ require("lazy.minit").setup({ { dir = vim.uv.cwd() }, { "LazyVim/starter" }, { "nvim-treesitter/nvim-treesitter" }, - { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" }, - { "mason-org/mason.nvim", version = "^1.0.0" }, - { "echasnovski/mini.icons", opts = {} }, + { "mason-org/mason-lspconfig.nvim" }, + { "mason-org/mason.nvim" }, + { "nvim-mini/mini.icons", opts = {} }, }, })