diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 2af89238..1a2b85d2 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "13.0.0" + ".": "14.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9ffc6c..f9ffbf67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,365 @@ # Changelog +## [14.5.0](https://github.com/LazyVim/LazyVim/compare/v14.4.0...v14.5.0) (2024-12-17) + + +### Features + +* **blink:** increase lazydev scores ([22015e0](https://github.com/LazyVim/LazyVim/commit/22015e0b4835ae148c19b459bf494fe5f72b415b)) + + +### Bug Fixes + +* **blink:** add `vim.snippet` fixes to blink (was already added to cmp). Fixes [#5067](https://github.com/LazyVim/LazyVim/issues/5067) ([5ea3cfa](https://github.com/LazyVim/LazyVim/commit/5ea3cfa48e6ac88b90282da86dba7799f67b2e30)) +* **blink:** don't trigger automatically on insert ([2cf3d23](https://github.com/LazyVim/LazyVim/commit/2cf3d234bfc31a1a4eda282ddabc12987f762893)) +* **blink:** remove show_on_insert_on_trigger_character since this has been fixed for {} and others ([0f3a120](https://github.com/LazyVim/LazyVim/commit/0f3a1201861e6d6e8834aa8937dcf3e4a70a937a)) +* **illuminate:** disable snacks.words when illuminate extra is enabled. Fixes [#5125](https://github.com/LazyVim/LazyVim/issues/5125) ([d025115](https://github.com/LazyVim/LazyVim/commit/d0251155ab2a293136c933b4e925e1fa16d39a2d)) +* **supermaven:** don't attach to bigfile and some snacks ft. Fixes [#5139](https://github.com/LazyVim/LazyVim/issues/5139) ([25ee13c](https://github.com/LazyVim/LazyVim/commit/25ee13ce29ad8c4e10d677e641955cfd3c810fb5)) +* **vscode:** disable some snacks plugins in vscode. Closes [#5124](https://github.com/LazyVim/LazyVim/issues/5124) ([301135b](https://github.com/LazyVim/LazyVim/commit/301135b2749affe71645c610001c8253ae78c591)) + +## [14.4.0](https://github.com/LazyVim/LazyVim/compare/v14.3.0...v14.4.0) (2024-12-15) + + +### Features + +* **blink:** boost results from ai providers and enable async, to get much faster completions ([6bc56e4](https://github.com/LazyVim/LazyVim/commit/6bc56e4e8142e3d453f2fbfea8ace62fcfc3750f)) +* **keymaps:** unlink luasnip on `esc` ([ef91026](https://github.com/LazyVim/LazyVim/commit/ef9102677f9b7a31d0bb7cfcd76f24401a7385fc)) + + +### Bug Fixes + +* **blink:** allow overriding `<Tab>` key. Fixes [#5095](https://github.com/LazyVim/LazyVim/issues/5095). Closes [#5099](https://github.com/LazyVim/LazyVim/issues/5099) ([89314cb](https://github.com/LazyVim/LazyVim/commit/89314cb2aae76b434122592ac8da264fa689bdff)) +* **keymaps:** better escape ([8f113a5](https://github.com/LazyVim/LazyVim/commit/8f113a514c130cba8d0f79acdd091d18ef997829)) + +## [14.3.0](https://github.com/LazyVim/LazyVim/compare/v14.2.0...v14.3.0) (2024-12-15) + + +### Features + +* **config:** better icon for snippets ([195a6e6](https://github.com/LazyVim/LazyVim/commit/195a6e611495da9dbb1afef4b470926cc2535f19)) +* **keymaps:** stop native snippets on escape. Closes [#5083](https://github.com/LazyVim/LazyVim/issues/5083) ([15c81fd](https://github.com/LazyVim/LazyVim/commit/15c81fdbb839f0c657fe4c077114475e82f423fe)) + + +### Bug Fixes + +* **blink:** super-tab and ai completions ([413566a](https://github.com/LazyVim/LazyVim/commit/413566af591e9152f156944bff35c89d5d973148)) + +## [14.2.0](https://github.com/LazyVim/LazyVim/compare/v14.1.0...v14.2.0) (2024-12-14) + + +### Features + +* **blink:** add `<c-y>` to keymaps ([3866fbc](https://github.com/LazyVim/LazyVim/commit/3866fbcd40dfd52f4012dfbb434208a9f953cf05)) + + +### Bug Fixes + +* **blink:** `draw.treesitter` expects table ([#5044](https://github.com/LazyVim/LazyVim/issues/5044)) ([08a7f7e](https://github.com/LazyVim/LazyVim/commit/08a7f7e3f92aeced3092c5ec462d784f765e8654)) +* **blink:** compat with 0.7.6 ([63eab6d](https://github.com/LazyVim/LazyVim/commit/63eab6d9a54b6d9e93d3cc445d57014bbe8cc271)) +* **blink:** only override color symbol kind for blink ([b07378d](https://github.com/LazyVim/LazyVim/commit/b07378dde40f1fa98b099cbd496129f5ca376e2c)) +* **health:** added `fzf` to healthchecks ([380cea9](https://github.com/LazyVim/LazyVim/commit/380cea97bf92fda3ad4ae14d1d4d37acffe5019a)) +* **health:** added curl to health checks ([5de1532](https://github.com/LazyVim/LazyVim/commit/5de15329fb5f7a846140fca96f9c5587245d63c1)) + +## [14.1.0](https://github.com/LazyVim/LazyVim/compare/v14.0.2...v14.1.0) (2024-12-13) + + +### Features + +* **blink:** use block vs. icon for colors ([#5037](https://github.com/LazyVim/LazyVim/issues/5037)) ([4488cb2](https://github.com/LazyVim/LazyVim/commit/4488cb24f72e04dd5adb2e7c0388a51c2b36f4f0)) + + +### Bug Fixes + +* **blink:** add backward compat for config ([1517ec9](https://github.com/LazyVim/LazyVim/commit/1517ec9bb46b454d253186aff5e5abd41e96d723)) + +## [14.0.2](https://github.com/LazyVim/LazyVim/compare/v14.0.1...v14.0.2) (2024-12-13) + + +### Bug Fixes + +* **cmp:** disable nvim-cmp/blink.cmp when needed ([60b7704](https://github.com/LazyVim/LazyVim/commit/60b77045d57d5473e50042b9b879c9c1054e6a10)) +* **cmp:** wrong extras check for nvim-cmp ([009e358](https://github.com/LazyVim/LazyVim/commit/009e3587be1badc04c9a8b8b459e8555b405509c)) + +## [14.0.1](https://github.com/LazyVim/LazyVim/compare/v14.0.0...v14.0.1) (2024-12-13) + + +### Bug Fixes + +* **NEWS:** typo ([0fd7140](https://github.com/LazyVim/LazyVim/commit/0fd7140a6de936edb27a4ba4f4825153ae801c21)) + +## [14.0.0](https://github.com/LazyVim/LazyVim/compare/v13.9.1...v14.0.0) (2024-12-13) + + +### ⚠ BREAKING CHANGES + +* **cmp:** moved `nvim-cmp` to extras and prefer `blink.cmp` on Neovim >= `0.10` as default completion engine +* **cmp:** moved `nvim-cmp` to extras and prefer `blink.cmp` on Neovim >= `0.10` as default completion engine +* **snacks:** use `snacks.scope` indent objects in favor of custom `mini.ai` indent objects +* **snacks:** use `snacks.indent` and moved `indent-blankline` to extras +* **pick:** make fzf the default picker for LazyVim + +### Features + +* **cmp:** moved `nvim-cmp` to extras and prefer `blink.cmp` on Neovim >= `0.10` as default completion engine ([152f9d1](https://github.com/LazyVim/LazyVim/commit/152f9d113fa2b4fc2af72d2846c4dd68c31b7596)) +* **cmp:** moved `nvim-cmp` to extras and prefer `blink.cmp` on Neovim >= `0.10` as default completion engine ([2cbfb9b](https://github.com/LazyVim/LazyVim/commit/2cbfb9b6b7b9b4bb1c9ce94ad02ab0a851310fc0)) +* **keymaps:** added leader-uD to toggle dim mode ([9b97388](https://github.com/LazyVim/LazyVim/commit/9b973882b8bcbab32f850da7c553cdc6388af4ad)) +* **keymaps:** added leader-z to toggle zen mode ([e6d6a09](https://github.com/LazyVim/LazyVim/commit/e6d6a096b34ad887b9f954a3f43bcc3fd7833f73)) +* **keymaps:** added leader-Z to toggle zoom ([f2e1cac](https://github.com/LazyVim/LazyVim/commit/f2e1cac965e41d7761073856b11bea223cac1e4d)) +* **lualine:** add snacks profiler status ([7bc8490](https://github.com/LazyVim/LazyVim/commit/7bc8490d46e002d624f45037fc507e8dd10d4b70)) +* **pick:** make fzf the default picker for LazyVim ([ae2340f](https://github.com/LazyVim/LazyVim/commit/ae2340f60a012df125c87fe46e6d98d0be04bd10)) +* **rust:** exclude bad directories from rust-analyzer ([#5021](https://github.com/LazyVim/LazyVim/issues/5021)) ([94f6df0](https://github.com/LazyVim/LazyVim/commit/94f6df048fbecfdf2f65ab96156b713555df40dc)) +* **snacks:** added `snacks.input` ([54bece1](https://github.com/LazyVim/LazyVim/commit/54bece17b390453ea0beac41e419394d5e0d69ff)) +* **snacks:** added leader-ua to toggle global animations ([303980d](https://github.com/LazyVim/LazyVim/commit/303980d267577972bb12e34ef152a0e8b9a953e2)) +* **snacks:** added leader-ug to toggle indent guides ([b3ac642](https://github.com/LazyVim/LazyVim/commit/b3ac642317cd60e9b35869068dd74fe779a22146)) +* **snacks:** added leader-uS to toggle scroll ([cded8d4](https://github.com/LazyVim/LazyVim/commit/cded8d4d2808250db5ea864fb8e479fd8b5a4a2c)) +* **snacks:** added profiler keymaps ([a8332c6](https://github.com/LazyVim/LazyVim/commit/a8332c6d50106cf35e45953cdaa463cbb6c5b085)) +* **snacks:** enable `snacks.scroll` ([1a1a484](https://github.com/LazyVim/LazyVim/commit/1a1a48497c53e232b0f525baab87d5f23a2205b2)) +* **snacks:** use `snacks.indent` and moved `indent-blankline` to extras ([94fdc42](https://github.com/LazyVim/LazyVim/commit/94fdc421a11b960e116888658dd9b2b85c3b58fc)) +* **snacks:** use `snacks.scope` indent objects in favor of custom `mini.ai` indent objects ([d904a1e](https://github.com/LazyVim/LazyVim/commit/d904a1ef47638e4defede775a7f0966fb8e0a2b4)) +* **snacks:** use `Snacks.zen.zoom()` instead of custom **maximize** ([e389a5a](https://github.com/LazyVim/LazyVim/commit/e389a5ada955c253771ff5c9f8301e2f17c206d2)) +* **which-key:** make `helix` the default which-key preset ([44c712a](https://github.com/LazyVim/LazyVim/commit/44c712aa31e7e05971259841e1f87c9f3d9c6cd5)) +* **zen:** zoom with leader-wm and leader-uZ. zen with leader-uz ([2acedaa](https://github.com/LazyVim/LazyVim/commit/2acedaa3a8312e53d84a299bd82d616e1c26328a)) + + +### Bug Fixes + +* **blink:** disable cmdline integration for now since it doesn't work well with the enter keymap ([20eff4f](https://github.com/LazyVim/LazyVim/commit/20eff4fc3f55fbeb1e415f0cc5a2d1f3019e5da6)) +* **blink:** remove unneeded code ([d95e530](https://github.com/LazyVim/LazyVim/commit/d95e530c02cbb2bcf36da5bb3e235780bdf6d239)) +* **blink:** unset provider.kind ([#5024](https://github.com/LazyVim/LazyVim/issues/5024)) ([29c4dea](https://github.com/LazyVim/LazyVim/commit/29c4dea4e75b82ad4b06c21e360eefa3951a3fba)) +* **blink:** unset sources.compat. Fixes [#5016](https://github.com/LazyVim/LazyVim/issues/5016). Closes [#5017](https://github.com/LazyVim/LazyVim/issues/5017) ([2946031](https://github.com/LazyVim/LazyVim/commit/29460318f302b6dceaf16bd06c45cb3ed58d5fd8)) +* **clangd:** avoid nil-indexing the completion sorting comparators ([#5011](https://github.com/LazyVim/LazyVim/issues/5011)) ([c4b0d6d](https://github.com/LazyVim/LazyVim/commit/c4b0d6d0d1ee11c07c0ab4ed3f87f97b76a6f592)) +* **clangd:** nvim-cmp optional ([94be6fb](https://github.com/LazyVim/LazyVim/commit/94be6fb78786e9a53e914db9d5cfab09b13225ba)) +* **copliot:** restructure copilot-cmp spec ([34d2bdc](https://github.com/LazyVim/LazyVim/commit/34d2bdcac6fabe5d02e157bffa3475391ca1f7ec)) +* fqn for nvim-cmp ([a9a273d](https://github.com/LazyVim/LazyVim/commit/a9a273d041e2dd0e5654b5b492fd29138259fe68)) +* **git:** make nvim-cmp optional for the git extra ([ec92fa8](https://github.com/LazyVim/LazyVim/commit/ec92fa85586b4082f04b30ad94cb98b24463665e)) +* **java:** only setup debug adapter config if mason is installed ([#5013](https://github.com/LazyVim/LazyVim/issues/5013)) ([aad0edb](https://github.com/LazyVim/LazyVim/commit/aad0edbf749bcbe16e9ef8d2a65a19dd3fe2bd87)) +* **java:** only setup debug adapter config if mason is installed (for real this time) ([#5014](https://github.com/LazyVim/LazyVim/issues/5014)) ([5b1b6b2](https://github.com/LazyVim/LazyVim/commit/5b1b6b29d717adeffb0528cffef9f1a3972d3701)) +* **java:** only use mason-registry if mason installed ([#4991](https://github.com/LazyVim/LazyVim/issues/4991)) ([21b02f0](https://github.com/LazyVim/LazyVim/commit/21b02f056d924d0a3cb3513b163e3dbdfa9c15ec)) +* **mini.animate:** disable `snacks.scroll` when `mini.animate` is enabled ([9b07544](https://github.com/LazyVim/LazyVim/commit/9b07544e89ecead354ef0f17ebc3127f3fa5bbd8)) +* **mini.indentscope:** disable snacks and indent-blankline scope ([98c77f1](https://github.com/LazyVim/LazyVim/commit/98c77f1de479b12bc29dc8339fbfe694959d99ed)) +* **nvim-cmp:** set high prio for loading the nvim-cmp extra to prevent issues with opts ([adf8db6](https://github.com/LazyVim/LazyVim/commit/adf8db69ed91f8c15fe3cf37df9dc0801dbaeb39)) +* **nvim-cmp:** specs ([88e77b0](https://github.com/LazyVim/LazyVim/commit/88e77b0e2439a27d06e95e89839227f1e9446c74)) +* **ui:** use `Snacks.util.color` instead of `LazyVim.ui.fg` ([6d774ba](https://github.com/LazyVim/LazyVim/commit/6d774ba8f21f87aaa8bf9dbeb0a84b747541b349)) + +## [13.9.1](https://github.com/LazyVim/LazyVim/compare/v13.9.0...v13.9.1) (2024-12-12) + + +### Bug Fixes + +* **blink:** set kind to int, not string, if overriding ([#4999](https://github.com/LazyVim/LazyVim/issues/4999)) ([cee60a6](https://github.com/LazyVim/LazyVim/commit/cee60a6d3040181ac9c5b709d79e80e180b34d48)) + +## [13.9.0](https://github.com/LazyVim/LazyVim/compare/v13.8.0...v13.9.0) (2024-12-11) + + +### Features + +* **luasnip:** add default user snippet location ([#4987](https://github.com/LazyVim/LazyVim/issues/4987)) ([8c79ab6](https://github.com/LazyVim/LazyVim/commit/8c79ab601af19b5370d560aa619567371ac70d86)) +* **vscode:** add vscode-specific keymaps and sync undo/redo with vscode ([#4983](https://github.com/LazyVim/LazyVim/issues/4983)) ([9ad1c49](https://github.com/LazyVim/LazyVim/commit/9ad1c49b67a5c4330e366cde41ab11b156de03f2)) + + +### Bug Fixes + +* **autocmds:** remove snacks_win from close_with_q, since they have their own keymaps ([99c361f](https://github.com/LazyVim/LazyVim/commit/99c361f708924ddc63599115580bda537cc7f119)) +* **blink:** config breaking changes. Fixes [#4990](https://github.com/LazyVim/LazyVim/issues/4990) ([439340b](https://github.com/LazyVim/LazyVim/commit/439340bd8a970aa23d513aea96c93e84b3af42dc)) + +## [13.8.0](https://github.com/LazyVim/LazyVim/compare/v13.7.0...v13.8.0) (2024-12-07) + + +### Features + +* **git:** added toggles for gitsigns.nvim and mini.diff ([2ebba15](https://github.com/LazyVim/LazyVim/commit/2ebba15e1274f5437a418ddacfe9dbf342fd8a18)) + + +### Bug Fixes + +* **dot:** kitty ft with bash treesitter highlights ([7ef2dfd](https://github.com/LazyVim/LazyVim/commit/7ef2dfd3ba9a3dffaa8c57c1bb5e130b9aa74217)) +* **keymaps:** toggle name ([b2f7505](https://github.com/LazyVim/LazyVim/commit/b2f750558a3737879f8151e741e7a3988886e37f)) +* **mini.diff:** toggle ([3f4b1ff](https://github.com/LazyVim/LazyVim/commit/3f4b1ff00364d089e19f4b3c738fd5298243fadb)) +* **rust:** only use mason.nvim if it is present ([#4963](https://github.com/LazyVim/LazyVim/issues/4963)) ([5ddad99](https://github.com/LazyVim/LazyVim/commit/5ddad99bac203e87e6f78f3ab7567a49b0d1d8a6)) + +## [13.7.0](https://github.com/LazyVim/LazyVim/compare/v13.6.0...v13.7.0) (2024-12-05) + + +### Features + +* **blink:** enabled treesitter highlighting ([0a9447c](https://github.com/LazyVim/LazyVim/commit/0a9447c1b1776c2d8d7b7d495538ddfab7c6cd08)) +* **extras.ai:** blink.cmp integration and kind overrides for menu drawing ([#4942](https://github.com/LazyVim/LazyVim/issues/4942)) ([f841ecf](https://github.com/LazyVim/LazyVim/commit/f841ecf6bdde98a0983e44171b1ad8513e159e29)) +* **rust:** add bacon-ls and improve debugging ([#3212](https://github.com/LazyVim/LazyVim/issues/3212)) ([ea794ff](https://github.com/LazyVim/LazyVim/commit/ea794ffd94adeb2b1d2870ed97dbd3f000d911b3)) +* **snacks:** silence copy url keymap ([#4939](https://github.com/LazyVim/LazyVim/issues/4939)) ([03e203b](https://github.com/LazyVim/LazyVim/commit/03e203bfbe1e5de38cfc0082e5d1b720cab83c0e)) +* **toggle:** added leader-A to toggle tabline. Closes [#4951](https://github.com/LazyVim/LazyVim/issues/4951) ([8232651](https://github.com/LazyVim/LazyVim/commit/8232651c4a4a80da34f8b6c1742b04144ae4b959)) + + +### Bug Fixes + +* **blink:** update config for latest changes ([#4953](https://github.com/LazyVim/LazyVim/issues/4953)) ([090ca75](https://github.com/LazyVim/LazyVim/commit/090ca75d3b326280a67e727ef77e15920a90e3c9)) +* **copilot:** CopilotChat.nvim has moved to main ([#4931](https://github.com/LazyVim/LazyVim/issues/4931)) ([0d6026a](https://github.com/LazyVim/LazyVim/commit/0d6026a3e8a255cf825ad293de101bc1e1a667eb)) +* **extras.treesitter-context:** change event back to `LazyFile` ([#4940](https://github.com/LazyVim/LazyVim/issues/4940)) ([83017ff](https://github.com/LazyVim/LazyVim/commit/83017ff28afa8b8ddf9254564d8b4a9c96ec3f7d)) +* **supermaven:** blink.cmp integration ([#4941](https://github.com/LazyVim/LazyVim/issues/4941)) ([d714711](https://github.com/LazyVim/LazyVim/commit/d71471151b8906155e048ea3d3fe2fa7d651990e)) +* **tex:** specify filetype for <localleader>l ([#4905](https://github.com/LazyVim/LazyVim/issues/4905)) ([12e3752](https://github.com/LazyVim/LazyVim/commit/12e37529e718b926e7513d0397e32771aeb6e049)) +* **ui:** actually disable mini-indentscope on snacks_dashboard ([#4947](https://github.com/LazyVim/LazyVim/issues/4947)) ([bfe29fb](https://github.com/LazyVim/LazyVim/commit/bfe29fb01330d2bfdfe14582133907217f4b8192)) +* **ui:** disable mini.indentscope on `ft=snacks_dashboard` ([#4928](https://github.com/LazyVim/LazyVim/issues/4928)) ([4bf3a39](https://github.com/LazyVim/LazyVim/commit/4bf3a392234f4c4421af644683d95d8aab945382)) +* **ui:** properly clear maximize state on exit. See [#4934](https://github.com/LazyVim/LazyVim/issues/4934) ([9ec253b](https://github.com/LazyVim/LazyVim/commit/9ec253b9b6bf9673f610035d741a345d6be7a44f)) + +## [13.6.0](https://github.com/LazyVim/LazyVim/compare/v13.5.3...v13.6.0) (2024-12-01) + + +### Features + +* **colorscheme:** enable catppuccin snacks integration by default ([#4882](https://github.com/LazyVim/LazyVim/issues/4882)) ([5659786](https://github.com/LazyVim/LazyVim/commit/5659786893ead10782e2b603c0754d83a0ae78d6)) +* **extras:** added extra for `smear-cursor.nvim` ([40dba86](https://github.com/LazyVim/LazyVim/commit/40dba869254309865fcdabbc6d8c6b8e187c2444)) +* **lang:** add maxInlayHintLength for vtsls to resolve inlay hint to… ([#4902](https://github.com/LazyVim/LazyVim/issues/4902)) ([1847e3f](https://github.com/LazyVim/LazyVim/commit/1847e3fb25cb29a9bc1c662cabe6984509733595)) +* **smear-cursor:** enable `cursor_color = "none"`, to show trail using color of target text fg color ([275c786](https://github.com/LazyVim/LazyVim/commit/275c78665e0534dfb62de34fc1a47e2f0f87acdb)) +* **snacks:** add keymap to copy url from gitbrowse ([#4870](https://github.com/LazyVim/LazyVim/issues/4870)) ([cdf3f1f](https://github.com/LazyVim/LazyVim/commit/cdf3f1f2bdc4e57de506a9d7c55fa7e0131be692)) +* **snacks:** added leader-. to toggle a scratch buffer. Uses `count` for new scratch buffers ([6d42f10](https://github.com/LazyVim/LazyVim/commit/6d42f1084d14025d67accbbcbbe9686de505ed96)) +* **snacks:** added leader-n to show notification history ([be0cb96](https://github.com/LazyVim/LazyVim/commit/be0cb9622dd47a5f62fbb32ac6f485a33a253119)) +* **snacks:** added leader-S to select a previous scratch buffer ([e05379b](https://github.com/LazyVim/LazyVim/commit/e05379babc99b43e6c97743ba4800449c9c78f60)) + + +### Bug Fixes + +* **blink:** fixed luasnip completions for blink ([7bb954f](https://github.com/LazyVim/LazyVim/commit/7bb954fd1d096dc68217611e696fc02dbca7cf50)) +* **blink:** icons ([2263b94](https://github.com/LazyVim/LazyVim/commit/2263b94439a14c133358d1abe4c0d7eef914105e)) +* **blink:** make sure blink.compat is setup correctly when used in extras ([91a3c66](https://github.com/LazyVim/LazyVim/commit/91a3c663a7ab6c9ce782e1ff0fd6bc9315f2a670)) +* **blink:** updated to config to reflect breaking changes ([efcba66](https://github.com/LazyVim/LazyVim/commit/efcba66a2262b2c956a4203f522026f03af9c903)) +* **dial:** add and/or augend to python ft ([#4875](https://github.com/LazyVim/LazyVim/issues/4875)) ([ecfaed3](https://github.com/LazyVim/LazyVim/commit/ecfaed3cc1cbe3013f1201594adde2ea0022c455)) +* **java:** give java a default nvim-dap config ([#4261](https://github.com/LazyVim/LazyVim/issues/4261)) ([c9102bc](https://github.com/LazyVim/LazyVim/commit/c9102bc35185284ddce28eb216fd125fa0e0fa8b)) +* **java:** minisurround jdtls keybind conflict ([#4886](https://github.com/LazyVim/LazyVim/issues/4886)) ([30fac42](https://github.com/LazyVim/LazyVim/commit/30fac4206a393b05736199873bac87ecdfacd2a0)) +* **lazydev:** use luals' bundled luv library ([eb525c6](https://github.com/LazyVim/LazyVim/commit/eb525c680d0423f5addb12e10f87ce5b81fc0d9e)) +* **lsp:** don't leak keymaps from LSP server configs ([#4849](https://github.com/LazyVim/LazyVim/issues/4849)) ([85e4118](https://github.com/LazyVim/LazyVim/commit/85e41180654f6cd6c7975442b3a4877b4b4fd475)) +* **mini.animate:** disable when in Neovide ([66459f9](https://github.com/LazyVim/LazyVim/commit/66459f9361316fc4f723c8ac12f4fdc44f195b12)) +* **octo:** upstream changed mappings to `localleader` ([#4850](https://github.com/LazyVim/LazyVim/issues/4850)) ([c979225](https://github.com/LazyVim/LazyVim/commit/c979225c372f04c3ba4b2f74c3b9c102ddd5f364)) +* **snacks:** remove lazygit requirement for git browse/blame keymaps ([#4869](https://github.com/LazyVim/LazyVim/issues/4869)) ([2c37492](https://github.com/LazyVim/LazyVim/commit/2c37492461bf6af09a3e940f8b3ea0a123608bfd)) +* **sql:** fix autocomplete, it was using the wrong plugin name on the `LazyVim.has` check ([#4900](https://github.com/LazyVim/LazyVim/issues/4900)) ([ed10d3c](https://github.com/LazyVim/LazyVim/commit/ed10d3cf19dfb99d38bda0e09be3296571113670)) +* **sql:** only use cmp if it is available ([#4891](https://github.com/LazyVim/LazyVim/issues/4891)) ([9eccb5d](https://github.com/LazyVim/LazyVim/commit/9eccb5d2defef4c1fe63719528b20bb210e1ef0c)) +* **ui:** disable indent-blankline on `ft=snacks_dashboard` ([#4895](https://github.com/LazyVim/LazyVim/issues/4895)) ([c022759](https://github.com/LazyVim/LazyVim/commit/c02275919e8238f2a333bedb4eca8d138b4ea567)) + +## [13.5.3](https://github.com/LazyVim/LazyVim/compare/v13.5.2...v13.5.3) (2024-11-22) + + +### Bug Fixes + +* **copilot:** remove tmp nightly fix ([30f556d](https://github.com/LazyVim/LazyVim/commit/30f556d17aaf7ac74f0553faebed2cf298b65820)) +* **dial:** make sure defaults are part of every group. Fixes [#4868](https://github.com/LazyVim/LazyVim/issues/4868) ([2108028](https://github.com/LazyVim/LazyVim/commit/2108028cde19184bf8ea1a00065b5a099b1928e1)) + +## [13.5.2](https://github.com/LazyVim/LazyVim/compare/v13.5.1...v13.5.2) (2024-11-19) + + +### Bug Fixes + +* **keymaps:** `gitbrowse` also in Visual mode ([#4818](https://github.com/LazyVim/LazyVim/issues/4818)) ([86dc548](https://github.com/LazyVim/LazyVim/commit/86dc548ff9564a37524c2f9259eeb8603a70d5d5)) + +## [13.5.1](https://github.com/LazyVim/LazyVim/compare/v13.5.0...v13.5.1) (2024-11-19) + + +### Bug Fixes + +* **copilot:** work-around to get copilot working again on nightly ([5961528](https://github.com/LazyVim/LazyVim/commit/59615281f80f68fb91a9e428835c8164a6a6f99f)) +* **extras:** add blink.cmp integration for SQL extra ([#4833](https://github.com/LazyVim/LazyVim/issues/4833)) ([0bb1da6](https://github.com/LazyVim/LazyVim/commit/0bb1da6d57a32495ed4159f8933d074674066d20)) +* **snacks:** alignment of header ([4df9392](https://github.com/LazyVim/LazyVim/commit/4df9392cb8c597193411b668d49a3882941e816b)) +* **snacks:** cleaner way to adjust keys preset ([9c31004](https://github.com/LazyVim/LazyVim/commit/9c310043657fc11db0946ca4a328f29941b72b02)) +* **snacks:** make sure early notifications show up in noice ([b873f9a](https://github.com/LazyVim/LazyVim/commit/b873f9a7e7ca77f329b40b17741ee244520a1306)) + +## [13.5.0](https://github.com/LazyVim/LazyVim/compare/v13.4.0...v13.5.0) (2024-11-18) + + +### Features + +* **copilot-chat:** remove call to nvim-cmp integration ([#4822](https://github.com/LazyVim/LazyVim/issues/4822)) ([af95531](https://github.com/LazyVim/LazyVim/commit/af9553135da3c42ff83824db0f9dfaaa9ad5973f)) +* **snacks:** use `snacks.dashboard` as the default dashboard. moved `dashboard-nvim` to extras ([#4832](https://github.com/LazyVim/LazyVim/issues/4832)) ([a07db1a](https://github.com/LazyVim/LazyVim/commit/a07db1a72334bf6550683d5f9132d806febed1cd)) + + +### Bug Fixes + +* **lualine:** dont show statusline on snacks_dashboard ([33557ae](https://github.com/LazyVim/LazyVim/commit/33557ae68b76954df0288603f39b3f0181bada52)) +* **tabnine:** dont call CmpTabnineHub in build. Fixes [#4828](https://github.com/LazyVim/LazyVim/issues/4828) ([6dcf5d7](https://github.com/LazyVim/LazyVim/commit/6dcf5d7159d13a21d3148779b5b80048573fcdf1)) + + +### Performance Improvements + +* **ui:** never show folds on dashboards ([0352f94](https://github.com/LazyVim/LazyVim/commit/0352f944c34a3aa8a949102a2fe2ded7a1da3cd0)) + +## [13.4.0](https://github.com/LazyVim/LazyVim/compare/v13.3.1...v13.4.0) (2024-11-16) + + +### Features + +* **blink:** auto-enable catppuccin integration ([#4799](https://github.com/LazyVim/LazyVim/issues/4799)) ([ffce089](https://github.com/LazyVim/LazyVim/commit/ffce089a9f1268ff73c7de7c4f45e1a366dc4d34)) +* **copilot-chat:** remove deprecated options ([#4802](https://github.com/LazyVim/LazyVim/issues/4802)) ([7a1414b](https://github.com/LazyVim/LazyVim/commit/7a1414b5e5950bde34b9bdc0dbc3dd20109f2ac9)) +* **dial:** support vue filetype ([#4785](https://github.com/LazyVim/LazyVim/issues/4785)) ([8235126](https://github.com/LazyVim/LazyVim/commit/8235126a321eaae093f319398ffec5949f1ab8be)) +* **extras:** add biome formatter ([#4448](https://github.com/LazyVim/LazyVim/issues/4448)) ([b8407f4](https://github.com/LazyVim/LazyVim/commit/b8407f4b128891c3bdf35a2c403ba23d1e01f3ff)) +* **vscode:** automatically enable the vscode extra when running in vscode ([1c5a330](https://github.com/LazyVim/LazyVim/commit/1c5a330b6be8007088d84361fee5d2b08771598c)) + + +### Bug Fixes + +* **terminal:** set shellcmdflags for powershell to recommended values. Closes [#4805](https://github.com/LazyVim/LazyVim/issues/4805) ([1db2af2](https://github.com/LazyVim/LazyVim/commit/1db2af267eeb9046550ac29bd543f3b3021cdd7b)) + +## [13.3.1](https://github.com/LazyVim/LazyVim/compare/v13.3.0...v13.3.1) (2024-11-15) + + +### Bug Fixes + +* **copilot:** don't enable blink when using copilot when blink is not installed. Fixes [#4795](https://github.com/LazyVim/LazyVim/issues/4795) ([07a0468](https://github.com/LazyVim/LazyVim/commit/07a046867dc3407b30801e539ab026fb7c180e7b)) + +## [13.3.0](https://github.com/LazyVim/LazyVim/compare/v13.2.0...v13.3.0) (2024-11-14) + + +### Features + +* **copilot:** added support for blink.cmp source ([a7eca05](https://github.com/LazyVim/LazyVim/commit/a7eca056096486b20ce37b20979c0d712e49fe76)) +* **extras:** add supermaven ([#3491](https://github.com/LazyVim/LazyVim/issues/3491)) ([c1e8e3c](https://github.com/LazyVim/LazyVim/commit/c1e8e3c80d1d9d44e3795022b3f7d2703abccec6)) + + +### Bug Fixes + +* **dial.nvim:** added boolean and logical toggles to default group. Fixes [#4515](https://github.com/LazyVim/LazyVim/issues/4515) ([5e485d3](https://github.com/LazyVim/LazyVim/commit/5e485d39b4cc5aca1aedae4d441fb2bfb3bfbf67)) +* **fzf:** decouple `defaults` from `opts` to easy switch profiles ([#4190](https://github.com/LazyVim/LazyVim/issues/4190)) ([0819f93](https://github.com/LazyVim/LazyVim/commit/0819f9396e94a4188522b6739ade3d6024d2b8a7)) +* **lsp:** wrap signature_help ([#4791](https://github.com/LazyVim/LazyVim/issues/4791)) ([deb9fd8](https://github.com/LazyVim/LazyVim/commit/deb9fd85b150e50053e127f94f3df6273a9f5faf)) +* **lualine:** dynamically fetch the color used in lualine ([#4788](https://github.com/LazyVim/LazyVim/issues/4788)) ([e50b435](https://github.com/LazyVim/LazyVim/commit/e50b43544f1261d140bc391a9a1de6e3923b490d)) +* **lualine:** normalize paths before calculating pretty path. Fixes [#4763](https://github.com/LazyVim/LazyVim/issues/4763) ([ea266e7](https://github.com/LazyVim/LazyVim/commit/ea266e73265e32183acbec0bd39f8108e213770f)) +* **snacks:** explicitely enable snakcs plugins ([c0b623c](https://github.com/LazyVim/LazyVim/commit/c0b623c332b42b3d75e78e06fa1912417bfca71f)) + + +### Performance Improvements + +* **treesitter:** better foldtext and foldexpr ([1d7b9a1](https://github.com/LazyVim/LazyVim/commit/1d7b9a1a61596a61019d5d84be9ed679d90c4a38)) + +## [13.2.0](https://github.com/LazyVim/LazyVim/compare/v13.1.0...v13.2.0) (2024-11-11) + + +### Features + +* **ai:** better completion/suggestions of AI engines ([#4752](https://github.com/LazyVim/LazyVim/issues/4752)) ([fbf881f](https://github.com/LazyVim/LazyVim/commit/fbf881f80b8f0fb2d9e4bc69d04f66323b25c4b9)) +* **ai:** move ai related extras from `coding` to `ai` ([#4751](https://github.com/LazyVim/LazyVim/issues/4751)) ([86904d2](https://github.com/LazyVim/LazyVim/commit/86904d2fb1ef406386b2dad43f42756e09b28182)) +* **keymaps:** leader-bo to close other buffers ([24665fc](https://github.com/LazyVim/LazyVim/commit/24665fc73651970e5a1e20a63d6031bd99b97637)) +* **rest:** add more keymaps to util.rest ([#4467](https://github.com/LazyVim/LazyVim/issues/4467)) ([c22db72](https://github.com/LazyVim/LazyVim/commit/c22db724351bc7a05c56046c48d23a2be8efe71b)) + + +### Bug Fixes + +* **extras:** fix alpha-nvim non-string keycodes ([#4735](https://github.com/LazyVim/LazyVim/issues/4735)) ([9c9e650](https://github.com/LazyVim/LazyVim/commit/9c9e650530dcd211afd5a8b7f5e3e33e44abd11b)) +* **snacks:** allow overriding `statuscolumn` through `options.lua` ([17a1b84](https://github.com/LazyVim/LazyVim/commit/17a1b846f08db62e3a93c76426db4017ad3cc2eb)) +* **vscode:** added snacks.nvim to allowed plugins for vscode. Fixes [#4757](https://github.com/LazyVim/LazyVim/issues/4757) ([06071dd](https://github.com/LazyVim/LazyVim/commit/06071dd452baf1e9b8b5aab140553c4f51fa522e)) + + +### Performance Improvements + +* **ui:** only enable treesitter folds if the buffer has treesitter highlighting ([b9dae57](https://github.com/LazyVim/LazyVim/commit/b9dae579612ccf1cd749150ff1603ff6dffc2610)) + +## [13.1.0](https://github.com/LazyVim/LazyVim/compare/v13.0.0...v13.1.0) (2024-11-09) + + +### Features + +* **terraform:** add formatter for packer files ([#4591](https://github.com/LazyVim/LazyVim/issues/4591)) ([4876d11](https://github.com/LazyVim/LazyVim/commit/4876d1137d374af6f39661e402926220517ae4ab)) + + +### Bug Fixes + +* **extras:** lazy-load telescope-terraform plugins ([#4667](https://github.com/LazyVim/LazyVim/issues/4667)) ([94b4219](https://github.com/LazyVim/LazyVim/commit/94b42193272569f8005587069733f3ba0610bc9b)) +* **options:** make sure spelling works in regular text files ([548fddd](https://github.com/LazyVim/LazyVim/commit/548fddd1d5db65a80b11500e32cfe86e69bc8777)) +* **snacks:** noice now honors `Snacks.config.notifier.enabled = false` ([220148f](https://github.com/LazyVim/LazyVim/commit/220148f47f175229232eee31982577fbdd637663)) + ## [13.0.0](https://github.com/LazyVim/LazyVim/compare/v12.44.1...v13.0.0) (2024-11-08) diff --git a/NEWS.md b/NEWS.md index b2bb693b..9d00ddd6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,69 @@ # What's new? +## 14.x + +Big new release with a lot of changes and improvements! +Two new plugins have been added, and a lot of plugins have been replaced. +With these changes, default **LazyVim** is now just `34` plugins. + +### Added Plugins + +- [fzf-lua](https://github.com/ibhagwan/fzf-lua) as a replacement for [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) + - to use **telescope.nvim** instead, enable the `editor.telescope` extra +- [blink.cmp](https://github.com/saghen/blink.cmp) as a replacement for [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) + - to use **nvim-cmp** instead, enable the `coding.nvim-cmp` extra + +### Removed Plugins + +- [dressing.nvim](https://github.com/stevearc/dressing.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua) and [snacks.input](https://github.com/folke/snacks.nvim)) +- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua)) +- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (replaced with [fzf-lua](https://github.com/ibhagwan/fzf-lua)) +- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) (replaced with [snacks.indent](https://github.com/Folke/snacks.nvim)) + - to use **indent-blankline.nvim** instead, enable the `indent-blankline` extra +- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [nvim-snippets](https://github.com/hrsh7th/vim-vsnip) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) (replaced with [blink](https://github.com/Saghen/blink.cmp)) +- [cmp-path](https://github.com/hrsh7th/cmp-path) (replaced with [blink](https://github.com/Saghen/blink.cmp)) + +### Changes + +- added [`snacks.input`](https://github.com/folke/snacks.nvim/blob/main/docs/input.md) +- added [`snacks.scroll`](https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md) +- added [`snacks.indent`](https://github.com/folke/snacks.nvim/blob/main/docs/indent.md) +- added [`snacks.scope`](https://github.com/folke/snacks.nvim/blob/main/docs/scope.md) +- added [`snacks.dim`](https://github.com/folke/snacks.nvim/blob/main/docs/dim.md) +- added [`snacks.zen`](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- changed default [`which-key`](https://github.com/folke/which-key.nvim) preset to `helix` +- drop `LazyVim.ui.fg` in favor of [`Snacks.util.color`](https://github.com/folke/snacks.nvim/blob/main/docs/util.md) + +To disable **all animations**, add the following to your `options.lua`: + +```lua +vim.g.snacks_animate = false +``` + +### Keymaps + +- `uz` to toggle [zen mode](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- `uZ` & `wm` to toggle [zoom mode](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) +- `uD` to toggle [dimming](https://github.com/folke/snacks.nvim/blob/main/docs/dim.md) +- `ua` to toggle [animations](https://github.com/folke/snacks.nvim/blob/main/docs/animate.md) +- `uS` to toggle [scroll](https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md) +- `ug` to toggle [indent guides](https://github.com/folke/snacks.nvim/blob/main/docs/indent.md) +- [`snacks.profiler`](https://github.com/folke/snacks.nvim/blob/main/docs/profiler.md) keymaps under `dp` + +--- + ## 13.x +- **LazyVim** now uses `Snacks.dashboard` as the default dashboard. + Check the [docs](https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md), + for more information and examples. + +- A new [dashboard-nvim](https://github.com/nvimdev/dashboard-nvim) extra + is available for those who prefer the old dashboard. + - Big new release with a lot of changes and improvements! - The biggest change is the move of a bunch of core features to @@ -14,6 +76,8 @@ - `Snacks.terminal` is similar to `lazyterm`, but has more features and creates bottom splits by default (similar to the `edgy` integrating) +--- + ## 12.x - **Markdown Extra**: [headlines.nvim](https://github.com/lukas-reineke/headlines.nvim) has been removed in favor of [markdown.nvim](https://github.com/MeanderingProgrammer/markdown.nvim) @@ -41,6 +105,8 @@ - moved `neoconf.nvim` to extras. Project specific LSP settings can be done with a `.lazy.lua` file instead. +--- + ## 11.x - **Keymaps:** @@ -100,6 +166,8 @@ Additionally, some core plugins have been moved to extras. - `mini.indentscope` scopes are now also highlighted with `indent-blankline` - `nvim-treesitter-context` +--- + ## 10.x - added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md) diff --git a/README-CN.md b/README-CN.md index b78a398a..83e5abfd 100644 --- a/README-CN.md +++ b/README-CN.md @@ -36,9 +36,9 @@ -LazyVim 是由 [💤 lazy.nvim](https://github.com/folke/lazy.nvim) 驱动的一套 Neovim 配置,可以轻松自定义和扩展您的配置。 -不必在从头开始或使用预制发行版之间做选择, -LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性,以及默认预配置的便利性。 +LazyVim 是一个基于 [💤 lazy.nvim](https://github.com/folke/lazy.nvim) 的 Neovim 配置方案,让定制和扩展变得简单直观。 +您不必再在“从零配置”和“使用预制发行版”之间做选择,LazyVim +提供了一个两全其美的方式——既可以享受默认配置带来的便利,又能根据个人需求来灵活调整各项设置。 ![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) @@ -46,28 +46,28 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性, ## ✨ 特性 -- 🔥 将你的 Neovim 变成一个成熟的 IDE -- 💤 使用 [lazy.nvim](https://github.com/folke/lazy.nvim) 轻松自定义和扩展您的配置 +- 🔥 将你的 Neovim 打造为一个功能完备的 IDE +- 💤 使用 [lazy.nvim](https://github.com/folke/lazy.nvim) 轻松自定义和扩展您的设置 - 🚀 快如闪电 - 🧹 选项、自动命令和键盘映射的合理预设 -- 📦 预配置了大量插件,随时可用 +- 📦 内置大量精心优化的预配置插件,开箱即用 -## ⚡️ 要求 +## ⚡️ 环境要求 - Neovim >= **0.9.0** (需要用 **LuaJIT** 构建) - Git >= **2.19.0** (用于部分克隆支持) - 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_** - 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements) -## 🚀 入门 +## 🚀 开始使用 -您可以在 [此处](https://github.com/LazyVim/starter) 找到 **LazyVim** 的入门模板 +您可以在 [此处](https://github.com/LazyVim/starter) 找到 **LazyVim** 的初始模板 -
在 Docker 中尝试 +
在 Docker 中尝鲜 ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim @@ -91,7 +91,7 @@ docker run -w /root -it --rm alpine:edge sh -uelic ' git clone https://github.com/LazyVim/starter ~/.config/nvim ``` -- 删除 `.git` 文件夹,以便稍后将其添加到您自己的存储库 +- 删除 `.git` 文件夹,以便稍后将其添加到您自己的仓库 ```sh rm -rf ~/.config/nvim/.git @@ -109,22 +109,23 @@ docker run -w /root -it --rm alpine:edge sh -uelic ' --- -[@elijahmanor](https://github.com/elijahmanor) 制作了一段很棒的视频,其中包含入门演练。 +[@elijahmanor](https://github.com/elijahmanor) 制作了一个很棒的视频,可以带领你快速入门。 -[![Watch the video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) +[![查看这个视频](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) -[@dusty-phillips](https://github.com/dusty-phillips) 正在编写一本名为 -[LazyVim for Ambitious Developers](https://lazyvim-ambitious-devs.phillips.codes) -的书,该书可在线免费获得。 +[@dusty-phillips](https://github.com/dusty-phillips) 为 LazyVim 编写了一本全面的书籍 +[《LazyVim for Ambitious Developers》](https://lazyvim-ambitious-devs.phillips.codes) +,可在线上免费阅读。 ## 📂 文件结构 -config 下的文件会在适当的时候自动加载,所以你不需要手动引入这些文件。 -**LazyVim** 带有一组默认配置文件,这些文件将在您的配置**之前**加载。 -看[这里](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) +config 下的文件会在适当的时候被自动加载,所以你不需要手动引入这些文件。 -您可以在 `lua/plugins/` 下添加自定义插件配置(specs)。 -[lazy.nvim](https://github.com/folke/lazy.nvim) 会自动加载这些文件。 +**LazyVim** 带有一组默认配置文件,这些文件会在您的配置**之前**被加载。 +请看[这里](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) + +您可以在 `lua/plugins/` 下添加自定义插件配置。 +[lazy.nvim](https://github.com/folke/lazy.nvim) 会自动加载此目录中的全部文件。
 ~/.config/nvim
@@ -141,6 +142,6 @@ config 下的文件会在适当的时候自动加载,所以你不需要手动
 └── init.lua
 
-## ⚙️ Configuration +## ⚙️ 设置 -参考[文档](https://lazyvim.github.io/) +请参阅[官方文档](https://lazyvim.github.io/) diff --git a/README-DE.md b/README-DE.md index a9522c84..c087d7c6 100644 --- a/README-DE.md +++ b/README-DE.md @@ -68,7 +68,7 @@ Sie können eine Startvorlage für **LazyVim** [hier](https://github.com/LazyVim ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/README-ES.md b/README-ES.md new file mode 100644 index 00000000..06e64f96 --- /dev/null +++ b/README-ES.md @@ -0,0 +1,145 @@ +
+ +
+ +
+ +

+ Instalar + · + Configurar + · + Documentación +

+ + + +LazyVim es una configuración de Neovim impulsada por [💤 lazy.nvim](https://github.com/folke/lazy.nvim) que facilita la personalización y extensión de tu configuración. En lugar de tener que elegir entre comenzar desde cero o usar una distribución predefinida, LazyVim ofrece lo mejor de ambos mundos: la flexibilidad para ajustar tu configuración según sea necesario, junto con la conveniencia de una configuración preconfigurada. + +![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) + +![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png) + +## ✨ Características + +- 🔥 Convierte tu Neovim en un IDE completo +- 💤 Personaliza y extiende fácilmente tu configuración con [lazy.nvim](https://github.com/folke/lazy.nvim) +- 🚀 Extremadamente rápido +- 🧹 Ajustes predeterminados sensatos para opciones, autocmds y combinaciones de teclas +- 📦 Viene con una gran cantidad de plugins preconfigurados y listos para usar + +## ⚡️ Requisitos + +- Neovim >= **0.9.0** (debe ser compilado con **LuaJIT**) +- Git >= **2.19.0** (para soporte de clones parciales) +- una [Fuente Nerd](https://www.nerdfonts.com/) **_(opcional)_** +- un compilador **C** para `nvim-treesitter`. Consulta [aquí](https://github.com/nvim-treesitter/nvim-treesitter#requirements) + +## 🚀 Empezando + +Puedes encontrar una plantilla de inicio para **LazyVim** [aquí](https://github.com/LazyVim/starter) + +
Probarlo con Docker + +```sh +docker run -w /root -it --rm alpine:edge sh -uelic ' + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update + git clone https://github.com/LazyVim/starter ~/.config/nvim + cd ~/.config/nvim + nvim +' +``` + +
+ +
Instalar el LazyVim Starter + +- Haz una copia de seguridad de tus archivos actuales de Neovim: + + ```sh + mv ~/.config/nvim ~/.config/nvim.bak + mv ~/.local/share/nvim ~/.local/share/nvim.bak + ``` + +- Clona el starter + + ```sh + git clone https://github.com/LazyVim/starter ~/.config/nvim + ``` + +- Elimina la carpeta `.git`, para que puedas agregarla a tu propio repositorio más tarde + + ```sh + rm -rf ~/.config/nvim/.git + ``` + +- ¡Inicia Neovim! + + ```sh + nvim + ``` + + Consulta los comentarios en los archivos sobre cómo personalizar **LazyVim**. + +
+ +--- + +Hay un excelente video creado por [@elijahmanor](https://github.com/elijahmanor) con una guía para empezar. + +[![Ver el video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) + +[@dusty-phillips](https://github.com/dusty-phillips) escribió un libro completo llamado +[LazyVim para Desarrolladores Ambiciosos](https://lazyvim-ambitious-devs.phillips.codes) +disponible de forma gratuita en línea. + +## 📂 Estructura de Archivos + +Los archivos dentro de la configuración se cargarán automáticamente en el momento adecuado, +por lo que no necesitas requerir esos archivos manualmente. +**LazyVim** viene con un conjunto de archivos de configuración predeterminados que se cargarán +**_antes_** que los tuyos. Consulta [aquí](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) + +Puedes agregar tus especificaciones de plugins personalizadas en `lua/plugins/`. Todos los archivos allí +serán cargados automáticamente por [lazy.nvim](https://github.com/folke/lazy.nvim) + +
+~/.config/nvim
+├── lua
+│   ├── config
+│   │   ├── autocmds.lua
+│   │   ├── keymaps.lua
+│   │   ├── lazy.lua
+│   │   └── options.lua
+│   └── plugins
+│       ├── spec1.lua
+│       ├── **
+│       └── spec2.lua
+└── init.lua
+
+ +## ⚙️ Configuración + +Consulta la [documentación](https://lazyvim.github.io) diff --git a/README-IT.md b/README-IT.md new file mode 100644 index 00000000..3ab7419a --- /dev/null +++ b/README-IT.md @@ -0,0 +1,150 @@ +
+ +
+ +
+ +

+ Installazione + · + Configurazione + · + Documentazione +

+ + + +LazyVim è una configurazione di Neovim basata su [💤 lazy.nvim](https://github.com/folke/lazy.nvim) +che rende semplice personalizzare ed estendere la tua configurazione. +Piuttosto che dover scegliere tra partire da zero o utilizzare una +distribuzione preconfigurata, LazyVim offre il meglio di entrambi i mondi: +la flessibilità di modificare la tua configurazione come necessario, +insieme alla comodità di un setup preconfigurato. + +![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) + +![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png) + +## ✨ Caratteristiche + +- 🔥 Trasforma il tuo Neovim in un IDE completo +- 💤 Personalizza ed estendi facilmente la tua configurazione con [lazy.nvim](https://github.com/folke/lazy.nvim) +- 🚀 Estremamente veloce +- 🧹 Impostazioni di default ottimizzate per opzioni, AutoCmd e scorciatoie da tastiera +- 📦 Distribuito con una vasta gamma di plugin preconfigurati e pronti all'uso + +## ⚡️ Requisiti + +- Neovim >= **0.9.0** (deve essere compilato con **LuaJIT**) +- Git >= **2.19.0** (per supportare cloni parziali) +- a [Nerd Font](https://www.nerdfonts.com/) **_(opzionale)_** +- un compilatore **C** per `nvim-treesitter`. Leggi [qui](https://github.com/nvim-treesitter/nvim-treesitter#requirements) + +## 🚀 Per iniziare + +Puoi trovare un template per **LazyVim** [qui](https://github.com/LazyVim/starter) + +
Provalo con Docker + +```sh +docker run -w /root -it --rm alpine:edge sh -uelic ' + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update + git clone https://github.com/LazyVim/starter ~/.config/nvim + cd ~/.config/nvim + nvim +' +``` + +
+ +
Installa il LazyVim Starter + +- Fai un backup dei tuoi file di Neovim attuali: + + ```sh + mv ~/.config/nvim ~/.config/nvim.bak + mv ~/.local/share/nvim ~/.local/share/nvim.bak + ``` + +- Clona lo Starter + + ```sh + git clone https://github.com/LazyVim/starter ~/.config/nvim + ``` + +- Rimuovi la cartella `.git`, così puoi aggiungerla al tuo repo in seguito + + ```sh + rm -rf ~/.config/nvim/.git + ``` + +- Avvia Neovim! + + ```sh + nvim + ``` + + Consulta i commenti nei file su come personalizzare **LazyVim**. + +
+ +--- + +Qui un video creato da [@elijahmanor](https://github.com/elijahmanor) con una guida per iniziare. + +[![Guarda il video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) + +[@dusty-phillips](https://github.com/dusty-phillips) ha scritto un libro comprensivo chiamato +[LazyVim per Sviluppatori Ambiziosi](https://lazyvim-ambitious-devs.phillips.codes) +che è disponibile gratuitamente online. + +## 📂 Struttura dei file + +I file presenti nella configurazione verranno caricati automaticamente al momento +più opportuno, quindi non è necessario richiamare manualmente quei file. +**LazyVim** ha un set di configurazioni predefinite che verranno caricate +prima delle tue. Vedi [qui](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) + +Puoi aggiungere i tuoi plugin personalizzati sotto `lua/plugins/`. Tutti +i file presenti verranno automaticamente caricati da [lazy.nvim](https://github.com/folke/lazy.nvim) + +
+~/.config/nvim
+├── lua
+│   ├── config
+│   │   ├── autocmds.lua
+│   │   ├── keymaps.lua
+│   │   ├── lazy.lua
+│   │   └── options.lua
+│   └── plugins
+│       ├── spec1.lua
+│       ├── **
+│       └── spec2.lua
+└── init.lua
+
+ +## ⚙️ Configurazione + +Consulta la [documentazione](https://lazyvim.github.io) diff --git a/README-JP.md b/README-JP.md index 316ede80..d81f2cb9 100644 --- a/README-JP.md +++ b/README-JP.md @@ -67,7 +67,7 @@ LazyVimは、ゼロから始めるか、あらかじめ作成されたディス ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/README-KO.md b/README-KO.md index eb5cdb1d..84d28017 100644 --- a/README-KO.md +++ b/README-KO.md @@ -65,7 +65,7 @@ LazyVim은 [💤 lazy.nvim](https://github.com/folke/lazy.nvim)를 기반으로 ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/README-PT.md b/README-PT.md index 7fb8572e..65d8c625 100644 --- a/README-PT.md +++ b/README-PT.md @@ -70,7 +70,7 @@ Podes encontrar uma template **LazyVim** starter para começar, [aqui](https://g ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/README.md b/README.md index c9a9ead3..4d379504 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ You can find a starter template for **LazyVim** [here](https://github.com/LazyVi ```sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index ec46d7d2..4e391e96 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 November 08 +*LazyVim.txt* For Neovim Last change: 2024 December 17 ============================================================================== Table of Contents *LazyVim-table-of-contents* @@ -68,7 +68,7 @@ Try it with Docker ~ >sh docker run -w /root -it --rm alpine:edge sh -uelic ' - apk add git lazygit neovim ripgrep alpine-sdk --update + apk add git lazygit fzf curl neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 7e6018fa..a86594a3 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -66,7 +66,6 @@ vim.api.nvim_create_autocmd("FileType", { "neotest-summary", "notify", "qf", - "snacks_win", "spectre_panel", "startuptime", "tsplayground", diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index af389ff6..574e56af 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "13.0.0" -- x-release-please-version +M.version = "14.5.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions @@ -85,9 +85,10 @@ local defaults = { Package = " ", Property = " ", Reference = " ", - Snippet = " ", + Snippet = "󱄽 ", String = " ", Struct = "󰆼 ", + Supermaven = " ", TabNine = "󰏚 ", Text = " ", TypeParameter = " ", @@ -135,7 +136,7 @@ local defaults = { } M.json = { - version = 6, + version = 7, path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json", data = { version = nil, ---@type string? diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index c4160bef..c618578b 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -40,10 +40,17 @@ map("n", "`", "e #", { desc = "Switch to Other Buffer" }) map("n", "bd", function() Snacks.bufdelete() end, { desc = "Delete Buffer" }) +map("n", "bo", function() + Snacks.bufdelete.other() +end, { desc = "Delete Other Buffers" }) map("n", "bD", ":bd", { desc = "Delete Buffer and Window" }) --- Clear search with -map({ "i", "n" }, "", "noh", { desc = "Escape and Clear hlsearch" }) +-- Clear search and stop snippet on escape +map({ "i", "n", "s" }, "", function() + vim.cmd("noh") + LazyVim.cmp.actions.snippet_stop() + return "" +end, { expr = true, desc = "Escape and Clear hlsearch" }) -- Clear search, diff update and redraw -- taken from runtime/lua/_editor.lua @@ -119,14 +126,22 @@ map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) -- toggle options LazyVim.format.snacks_toggle():map("uf") LazyVim.format.snacks_toggle(true):map("uF") -Snacks.toggle.option("spell", { name = "Spelling"}):map("us") -Snacks.toggle.option("wrap", {name = "Wrap"}):map("uw") -Snacks.toggle.option("relativenumber", { name = "Relative Number"}):map("uL") +Snacks.toggle.option("spell", { name = "Spelling" }):map("us") +Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") +Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") Snacks.toggle.diagnostics():map("ud") Snacks.toggle.line_number():map("ul") -Snacks.toggle.option("conceallevel", {off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2}):map("uc") +Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2, name = "Conceal Level" }):map("uc") +Snacks.toggle.option("showtabline", { off = 0, on = vim.o.showtabline > 0 and vim.o.showtabline or 2, name = "Tabline" }):map("uA") Snacks.toggle.treesitter():map("uT") -Snacks.toggle.option("background", { off = "light", on = "dark" , name = "Dark Background"}):map("ub") +Snacks.toggle.option("background", { off = "light", on = "dark" , name = "Dark Background" }):map("ub") +Snacks.toggle.dim():map("uD") +Snacks.toggle.animate():map("ua") +Snacks.toggle.indent():map("ug") +Snacks.toggle.scroll():map("uS") +Snacks.toggle.profiler():map("dpp") +Snacks.toggle.profiler_highlights():map("dph") + if vim.lsp.inlay_hint then Snacks.toggle.inlay_hints():map("uh") end @@ -135,13 +150,17 @@ 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", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) - map("n", "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) map("n", "gf", function() Snacks.lazygit.log_file() end, { desc = "Lazygit Current File History" }) map("n", "gl", function() Snacks.lazygit.log({ cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" }) map("n", "gL", function() Snacks.lazygit.log() end, { desc = "Lazygit Log (cwd)" }) end +map("n", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) +map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" }) +map({"n", "x" }, "gY", function() + Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false }) +end, { desc = "Git Browse (copy)" }) + -- quit map("n", "qq", "qa", { desc = "Quit All" }) @@ -167,7 +186,8 @@ map("n", "w", "", { desc = "Windows", remap = true }) map("n", "-", "s", { desc = "Split Window Below", remap = true }) map("n", "|", "v", { desc = "Split Window Right", remap = true }) map("n", "wd", "c", { desc = "Delete Window", remap = true }) -LazyVim.ui.maximize():map("wm") +Snacks.toggle.zoom():map("wm"):map("uZ") +Snacks.toggle.zen():map("uz") -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) @@ -177,3 +197,13 @@ map("n", "", "tabnew", { desc = "New Tab" }) map("n", "]", "tabnext", { desc = "Next Tab" }) map("n", "d", "tabclose", { desc = "Close Tab" }) map("n", "[", "tabprevious", { desc = "Previous Tab" }) + +-- native snippets. only needed on < 0.11, as 0.11 creates these by default +if vim.fn.has("nvim-0.11") == 0 then + map("s", "", function() + return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" + end, { expr = true, desc = "Jump Next" }) + map({ "i", "s" }, "", function() + return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" + end, { expr = true, desc = "Jump Previous" }) +end diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 726f869d..0bbaacba 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -5,12 +5,26 @@ vim.g.maplocalleader = "\\" -- LazyVim auto format vim.g.autoformat = true +-- Snacks animations +-- Set to `false` to globally disable all snacks animations +vim.g.snacks_animate = true + -- LazyVim picker to use. -- Can be one of: telescope, fzf -- Leave it to "auto" to automatically use the picker -- enabled with `:LazyExtras` vim.g.lazyvim_picker = "auto" +-- LazyVim completion engine to use. +-- Can be one of: nvim-cmp, blink.cmp +-- Leave it to "auto" to automatically use the completion engine +-- enabled with `:LazyExtras` +vim.g.lazyvim_cmp = "auto" + +-- if the completion engine supports the AI source, +-- use that instead of inline suggestions +vim.g.ai_cmp = true + -- LazyVim root dir detection -- Each entry can be: -- * the name of a detector function like `lsp` or `cwd` @@ -85,6 +99,7 @@ opt.spelllang = { "en" } opt.splitbelow = true -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current +opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]] opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key diff --git a/lua/lazyvim/health.lua b/lua/lazyvim/health.lua index 4822de86..9fdc5a56 100644 --- a/lua/lazyvim/health.lua +++ b/lua/lazyvim/health.lua @@ -17,7 +17,7 @@ function M.check() error("Neovim >= 0.9.0 is required") end - for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do + for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit", "fzf", "curl" }) do local name = type(cmd) == "string" and cmd or vim.inspect(cmd) local commands = type(cmd) == "string" and { cmd } or cmd ---@cast commands string[] diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 8f1d7968..adc76177 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -1,120 +1,14 @@ return { - - -- auto completion { - "hrsh7th/nvim-cmp", - version = false, -- last release is way too old - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - }, - -- Not all LSP servers add brackets when completing a function. - -- To better deal with this, LazyVim adds a custom option to cmp, - -- that you can configure. For example: - -- - -- ```lua - -- opts = { - -- auto_brackets = { "python" } - -- } - -- ``` - opts = function() - vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) - local cmp = require("cmp") - local defaults = require("cmp.config.default")() - local auto_select = true - return { - auto_brackets = {}, -- configure any filetype to auto add brackets - completion = { - completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), - }, - preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.complete(), - [""] = LazyVim.cmp.confirm({ select = auto_select }), - [""] = LazyVim.cmp.confirm({ select = true }), - [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = function(fallback) - cmp.abort() - fallback() - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "path" }, - }, { - { name = "buffer" }, - }), - formatting = { - format = function(entry, item) - local icons = LazyVim.config.icons.kinds - if icons[item.kind] then - item.kind = icons[item.kind] .. item.kind - end - - local widths = { - abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, - menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, - } - - for key, width in pairs(widths) do - if item[key] and vim.fn.strdisplaywidth(item[key]) > width then - item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" - end - end - - return item - end, - }, - experimental = { - ghost_text = { - hl_group = "CmpGhostText", - }, - }, - sorting = defaults.sorting, - } + import = "lazyvim.plugins.extras.coding.nvim-cmp", + enabled = function() + return LazyVim.cmp_engine() == "nvim-cmp" end, - main = "lazyvim.util.cmp", }, - - -- snippets { - "nvim-cmp", - optional = true, - dependencies = { - { - "garymjr/nvim-snippets", - opts = { - friendly_snippets = true, - }, - dependencies = { "rafamadriz/friendly-snippets" }, - }, - }, - opts = function(_, opts) - opts.snippet = { - expand = function(item) - return LazyVim.cmp.expand(item.body) - end, - } - if LazyVim.has("nvim-snippets") then - table.insert(opts.sources, { name = "snippets" }) - end - end, - init = function() - -- Neovim enabled snippet navigation mappings by default in v0.11 - if vim.fn.has("nvim-0.11") == 0 then - vim.keymap.set({ "i", "s" }, "", function() - return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, { expr = true, silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, { expr = true, silent = true }) - end + import = "lazyvim.plugins.extras.coding.blink", + enabled = function() + return LazyVim.cmp_engine() == "blink.cmp" end, }, @@ -167,7 +61,6 @@ return { { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]", "%f[%P][%l%d]+%f[^%l%d]", "^[%l%d]+%f[^%l%d]" }, "^().*()$", }, - i = LazyVim.mini.ai_indent, -- indent g = LazyVim.mini.ai_buffer, -- buffer u = ai.gen_spec.function_call(), -- u for "Usage" U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name @@ -190,21 +83,11 @@ return { cmd = "LazyDev", opts = { library = { - { path = "luvit-meta/library", words = { "vim%.uv" } }, + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, { path = "LazyVim", words = { "LazyVim" } }, { path = "snacks.nvim", words = { "Snacks" } }, { path = "lazy.nvim", words = { "LazyVim" } }, }, }, }, - -- Manage libuv types with lazy. Plugin will never be loaded - { "Bilal2453/luvit-meta", lazy = true }, - -- Add lazydev source to cmp - { - "hrsh7th/nvim-cmp", - optional = true, - opts = function(_, opts) - table.insert(opts.sources, { name = "lazydev", group_index = 0 }) - end, - }, } diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index 9087c3ad..93a89668 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -44,6 +44,7 @@ return { noice = true, notify = true, semantic_tokens = true, + snacks = true, telescope = true, treesitter = true, treesitter_context = true, diff --git a/lua/lazyvim/plugins/compat/nvim-0_9.lua b/lua/lazyvim/plugins/compat/nvim-0_9.lua index 4f971b6f..81514ef8 100644 --- a/lua/lazyvim/plugins/compat/nvim-0_9.lua +++ b/lua/lazyvim/plugins/compat/nvim-0_9.lua @@ -4,6 +4,9 @@ return { { "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" }, diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index bac949fc..f6a98605 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -176,12 +176,15 @@ return { event = "VeryLazy", opts_extend = { "spec" }, opts = { + preset = "helix", defaults = {}, spec = { { mode = { "n", "v" }, { "", group = "tabs" }, { "c", group = "code" }, + { "d", group = "debug" }, + { "dp", group = "profiler" }, { "f", group = "file/find" }, { "g", group = "git" }, { "gh", group = "hunks" }, @@ -300,6 +303,20 @@ return { end, }, }, + { + "gitsigns.nvim", + opts = function() + Snacks.toggle({ + name = "Git Signs", + get = function() + return require("gitsigns.config").config.signcolumn + end, + set = function(state) + require("gitsigns").toggle_signs(state) + end, + }):map("uG") + end, + }, -- better diagnostics list and others { diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua new file mode 100644 index 00000000..d2d29a00 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -0,0 +1,75 @@ +return { + + -- codeium + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = { + enable_cmp_source = vim.g.ai_cmp, + virtual_text = { + enabled = not vim.g.ai_cmp, + key_bindings = { + accept = false, -- handled by nvim-cmp / blink.cmp + next = "", + prev = "", + }, + }, + }, + }, + + -- add ai_accept action + { + "Exafunction/codeium.nvim", + opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("codeium.virtual_text").get_current_completion_item() then + LazyVim.create_undo() + vim.api.nvim_input(require("codeium.virtual_text").accept()) + return true + end + end + end, + }, + + -- codeium cmp source + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "codeium.nvim" }, + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) + end, + }, + + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium")) + end, + }, + + vim.g.ai_cmp and { + "saghen/blink.cmp", + optional = true, + dependencies = { "codeium.nvim", "saghen/blink.compat" }, + opts = { + sources = { + compat = { "codeium" }, + providers = { + codeium = { + kind = "Codeium", + score_offset = 100, + async = true, + }, + }, + }, + }, + } or nil, +} diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua similarity index 83% rename from lua/lazyvim/plugins/extras/coding/copilot-chat.lua rename to lua/lazyvim/plugins/extras/ai/copilot-chat.lua index 042ab8ff..e71f4db1 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot-chat.lua @@ -17,23 +17,18 @@ end return { { "CopilotC-Nvim/CopilotChat.nvim", - branch = "canary", + branch = "main", cmd = "CopilotChat", opts = function() local user = vim.env.USER or "User" user = user:sub(1, 1):upper() .. user:sub(2) return { auto_insert_mode = true, - show_help = true, question_header = " " .. user .. " ", answer_header = " Copilot ", window = { width = 0.4, }, - selection = function(source) - local select = require("CopilotChat.select") - return select.visual(source) or select.buffer(source) - end, } end, keys = { @@ -66,16 +61,11 @@ return { desc = "Quick Chat (CopilotChat)", mode = { "n", "v" }, }, - -- Show help actions with telescope - { "ad", M.pick("help"), desc = "Diagnostic Help (CopilotChat)", mode = { "n", "v" } }, -- Show prompts actions with telescope { "ap", M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, }, config = function(_, opts) local chat = require("CopilotChat") - if pcall(require, "cmp") then - require("CopilotChat.integrations.cmp").setup() - end vim.api.nvim_create_autocmd("BufEnter", { pattern = "copilot-chat", diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua new file mode 100644 index 00000000..4651c689 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -0,0 +1,118 @@ +return { + recommended = true, + -- copilot + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + build = ":Copilot auth", + event = "InsertEnter", + opts = { + suggestion = { + enabled = not vim.g.ai_cmp, + auto_trigger = true, + keymap = { + accept = false, -- handled by nvim-cmp / blink.cmp + next = "", + prev = "", + }, + }, + panel = { enabled = false }, + filetypes = { + markdown = true, + help = true, + }, + }, + }, + + -- add ai_accept action + { + "zbirenbaum/copilot.lua", + opts = function() + LazyVim.cmp.actions.ai_accept = function() + if require("copilot.suggestion").is_visible() then + LazyVim.create_undo() + require("copilot.suggestion").accept() + return true + end + end + end, + }, + + -- lualine + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + table.insert( + opts.sections.lualine_x, + 2, + LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() + local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} + if #clients > 0 then + local status = require("copilot.api").status.data.status + return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" + end + end) + ) + end, + }, + + vim.g.ai_cmp + and { + -- copilot cmp source + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { -- this will only be evaluated if nvim-cmp is enabled + { + "zbirenbaum/copilot-cmp", + opts = {}, + config = function(_, opts) + local copilot_cmp = require("copilot_cmp") + copilot_cmp.setup(opts) + -- attach cmp source whenever copilot attaches + -- fixes lazy-loading issues with the copilot cmp source + LazyVim.lsp.on_attach(function() + copilot_cmp._on_insert_enter({}) + end, "copilot") + end, + specs = { + { + "hrsh7th/nvim-cmp", + optional = true, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "copilot", + group_index = 1, + priority = 100, + }) + end, + }, + }, + }, + }, + }, + { + "saghen/blink.cmp", + optional = true, + dependencies = { "giuxtaposition/blink-cmp-copilot" }, + opts = { + sources = { + default = { "copilot" }, + providers = { + copilot = { + name = "copilot", + module = "blink-cmp-copilot", + kind = "Copilot", + score_offset = 100, + async = true, + }, + }, + }, + }, + }, + } + or nil, +} diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua new file mode 100644 index 00000000..e491fd85 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -0,0 +1,92 @@ +return { + { + "supermaven-inc/supermaven-nvim", + opts = { + keymaps = { + accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp + }, + disable_inline_completion = vim.g.ai_cmp, + ignore_filetypes = { "bigfile", "snacks_input", "snacks_notif" }, + }, + }, + + -- add ai_accept action + { + "supermaven-inc/supermaven-nvim", + opts = function() + require("supermaven-nvim.completion_preview").suggestion_group = "SupermavenSuggestion" + LazyVim.cmp.actions.ai_accept = function() + local suggestion = require("supermaven-nvim.completion_preview") + if suggestion.has_suggestion() then + LazyVim.create_undo() + vim.schedule(function() + suggestion.on_accept_suggestion() + end) + return true + end + end + end, + }, + + -- cmp integration + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "supermaven-nvim" }, + opts = function(_, opts) + if vim.g.ai_cmp then + table.insert(opts.sources, 1, { + name = "supermaven", + group_index = 1, + priority = 100, + }) + end + end, + }, + + vim.g.ai_cmp and { + "saghen/blink.cmp", + optional = true, + dependencies = { "supermaven-nvim", "saghen/blink.compat" }, + opts = { + sources = { + compat = { "supermaven" }, + providers = { + supermaven = { + kind = "Supermaven", + score_offset = 100, + async = true, + }, + }, + }, + }, + } or nil, + + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("supermaven")) + end, + }, + + { + "folke/noice.nvim", + optional = true, + opts = function(_, opts) + vim.list_extend(opts.routes, { + { + filter = { + event = "msg_show", + any = { + { find = "Starting Supermaven" }, + { find = "Supermaven Free Tier" }, + }, + }, + skip = true, + }, + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/coding/tabnine.lua b/lua/lazyvim/plugins/extras/ai/tabnine.lua similarity index 54% rename from lua/lazyvim/plugins/extras/coding/tabnine.lua rename to lua/lazyvim/plugins/extras/ai/tabnine.lua index 1c92a25d..06d02dc2 100644 --- a/lua/lazyvim/plugins/extras/coding/tabnine.lua +++ b/lua/lazyvim/plugins/extras/ai/tabnine.lua @@ -1,26 +1,22 @@ return { -- Tabnine cmp source { - "nvim-cmp", - optional = true, - dependencies = { - { - "tzachar/cmp-tabnine", - build = { - LazyVim.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", - ":CmpTabnineHub", - }, - dependencies = "hrsh7th/nvim-cmp", - opts = { - max_lines = 1000, - max_num_results = 3, - sort = true, - }, - config = function(_, opts) - require("cmp_tabnine.config"):setup(opts) - end, - }, + "tzachar/cmp-tabnine", + build = LazyVim.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", + opts = { + max_lines = 1000, + max_num_results = 3, + sort = true, }, + config = function(_, opts) + require("cmp_tabnine.config"):setup(opts) + end, + }, + + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "tzachar/cmp-tabnine" }, ---@param opts cmp.ConfigSchema opts = function(_, opts) table.insert(opts.sources, 1, { @@ -37,6 +33,25 @@ return { end) end, }, + + { + "saghen/blink.cmp", + optional = true, + dependencies = { "tzachar/cmp-tabnine", "saghen/blink.compat" }, + opts = { + sources = { + compat = { "cmp_tabnine" }, + providers = { + cmp_tabnine = { + kind = "TabNine", + score_offset = 100, + async = true, + }, + }, + }, + }, + }, + -- Show TabNine status in lualine { "nvim-lualine/lualine.nvim", diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index eb5d5471..139bf6c4 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -1,67 +1,177 @@ +---@diagnostic disable: missing-fields +if lazyvim_docs then + -- set to `true` to follow the main branch + -- you need to have a working rust toolchain to build the plugin + -- in this case. + vim.g.lazyvim_blink_main = false +end + return { { "hrsh7th/nvim-cmp", + optional = true, enabled = false, }, { "saghen/blink.cmp", - version = "*", - opts_extend = { "sources.completion.enabled_providers" }, + version = not vim.g.lazyvim_blink_main and "*", + build = vim.g.lazyvim_blink_main and "cargo build --release", + opts_extend = { + "sources.completion.enabled_providers", + "sources.compat", + "sources.default", + }, dependencies = { "rafamadriz/friendly-snippets", -- add blink.compat to dependencies - -- { "saghen/blink.compat", opts = {} }, + { + "saghen/blink.compat", + optional = true, -- make optional so it's only enabled if any extras need it + opts = {}, + version = not vim.g.lazyvim_blink_main and "*", + }, }, event = "InsertEnter", ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - highlight = { + snippets = { + expand = function(snippet, _) + 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 -- will be removed in a future release, assuming themes add support use_nvim_cmp_as_default = false, + -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", }, - -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- adjusts spacing to ensure icons are aligned - nerd_font_variant = "mono", - windows = { - autocomplete = { - -- draw = "reversed", - winblend = vim.o.pumblend, + completion = { + accept = { + -- experimental auto-brackets support + auto_brackets = { + enabled = true, + }, + }, + menu = { + draw = { + treesitter = { "lsp" }, + }, }, documentation = { auto_show = true, + auto_show_delay_ms = 200, }, ghost_text = { - enabled = true, + enabled = vim.g.ai_cmp, }, }, - -- experimental auto-brackets support - accept = { auto_brackets = { enabled = true } }, - -- experimental signature help support - -- trigger = { signature_help = { enabled = true } } + -- signature = { enabled = true }, + sources = { - completion = { - -- remember to enable your providers here - enabled_providers = { "lsp", "path", "snippets", "buffer" }, - }, + -- adding any nvim-cmp sources here will enable them + -- with blink.compat + compat = {}, + default = { "lsp", "path", "snippets", "buffer" }, + cmdline = {}, }, keymap = { preset = "enter", + [""] = { "select_and_accept" }, }, }, + ---@param opts blink.cmp.Config | { sources: { compat: string[] } } + config = function(_, opts) + -- setup compat sources + local enabled = opts.sources.default + for _, source in ipairs(opts.sources.compat or {}) do + opts.sources.providers[source] = vim.tbl_deep_extend( + "force", + { name = source, module = "blink.compat.source" }, + opts.sources.providers[source] or {} + ) + if type(enabled) == "table" and not vim.tbl_contains(enabled, source) then + table.insert(enabled, source) + end + end + + -- add ai_accept to key + if not opts.keymap[""] then + if opts.keymap.preset == "super-tab" then -- super-tab + opts.keymap[""] = { + require("blink.cmp.keymap.presets")["super-tab"][""][1], + LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), + "fallback", + } + else -- other presets + opts.keymap[""] = { + LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), + "fallback", + } + end + end + + --- NOTE: compat with latest version. Currenlty 0.7.6 + if not vim.g.lazyvim_blink_main then + ---@diagnostic disable-next-line: inject-field + opts.sources.completion = opts.sources.completion or {} + opts.sources.completion.enabled_providers = enabled + if vim.tbl_get(opts, "completion", "menu", "draw", "treesitter") then + ---@diagnostic disable-next-line: assign-type-mismatch + opts.completion.menu.draw.treesitter = true + end + end + + -- Unset custom prop to pass blink.cmp validation + opts.sources.compat = nil + + -- check if we need to override symbol kinds + for _, provider in pairs(opts.sources.providers or {}) do + ---@cast provider blink.cmp.SourceProviderConfig|{kind?:string} + if provider.kind then + local CompletionItemKind = require("blink.cmp.types").CompletionItemKind + local kind_idx = #CompletionItemKind + 1 + + CompletionItemKind[kind_idx] = provider.kind + ---@diagnostic disable-next-line: no-unknown + CompletionItemKind[provider.kind] = kind_idx + + ---@type fun(ctx: blink.cmp.Context, items: blink.cmp.CompletionItem[]): blink.cmp.CompletionItem[] + local transform_items = provider.transform_items + ---@param ctx blink.cmp.Context + ---@param items blink.cmp.CompletionItem[] + provider.transform_items = function(ctx, items) + items = transform_items and transform_items(ctx, items) or items + for _, item in ipairs(items) do + item.kind = kind_idx or item.kind + end + return items + end + + -- Unset custom prop to pass blink.cmp validation + provider.kind = nil + end + end + + require("blink.cmp").setup(opts) + end, }, -- add icons { "saghen/blink.cmp", opts = function(_, opts) - opts.kind_icons = LazyVim.config.icons.kinds + opts.appearance = opts.appearance or {} + opts.appearance.kind_icons = vim.tbl_extend("keep", { + Color = "██", -- Use block instead of icon for color items to make swatches more usable + }, LazyVim.config.icons.kinds) end, }, @@ -70,21 +180,24 @@ return { "saghen/blink.cmp", opts = { sources = { - completion = { - -- add lazydev to your completion providers - enabled_providers = { "lazydev" }, - }, + -- add lazydev to your completion providers + default = { "lazydev" }, providers = { - lsp = { - -- dont show LuaLS require statements when lazydev has items - fallback_for = { "lazydev" }, - }, lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", + score_offset = 100, -- show at a higher priority than lsp }, }, }, }, }, + -- catppuccin support + { + "catppuccin", + optional = true, + opts = { + integrations = { blink_cmp = true }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua deleted file mode 100644 index b95ad433..00000000 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ /dev/null @@ -1,33 +0,0 @@ -return { - - -- codeium cmp source - { - "nvim-cmp", - dependencies = { - -- codeium - { - "Exafunction/codeium.nvim", - cmd = "Codeium", - build = ":Codeium Auth", - opts = {}, - }, - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "codeium", - group_index = 1, - priority = 100, - }) - end, - }, - - { - "nvim-lualine/lualine.nvim", - optional = true, - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium")) - end, - }, -} diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua deleted file mode 100644 index 22ba0c64..00000000 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ /dev/null @@ -1,125 +0,0 @@ -return { - recommended = true, - -- copilot - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - build = ":Copilot auth", - opts = { - suggestion = { enabled = false }, - panel = { enabled = false }, - filetypes = { - markdown = true, - help = true, - }, - }, - }, - { - "nvim-lualine/lualine.nvim", - optional = true, - event = "VeryLazy", - opts = function(_, opts) - local colors = { - [""] = LazyVim.ui.fg("Special"), - ["Normal"] = LazyVim.ui.fg("Special"), - ["Warning"] = LazyVim.ui.fg("DiagnosticError"), - ["InProgress"] = LazyVim.ui.fg("DiagnosticWarn"), - } - table.insert(opts.sections.lualine_x, 2, { - function() - local icon = LazyVim.config.icons.kinds.Copilot - local status = require("copilot.api").status.data - return icon .. (status.message or "") - end, - cond = function() - if not package.loaded["copilot"] then - return - end - local ok, clients = pcall(LazyVim.lsp.get_clients, { name = "copilot", bufnr = 0 }) - if not ok then - return false - end - return ok and #clients > 0 - end, - color = function() - if not package.loaded["copilot"] then - return - end - local status = require("copilot.api").status.data - return colors[status.status] or colors[""] - end, - }) - end, - }, - - -- copilot cmp source - { - "nvim-cmp", - dependencies = { - { - "zbirenbaum/copilot-cmp", - dependencies = "copilot.lua", - opts = {}, - config = function(_, opts) - local copilot_cmp = require("copilot_cmp") - copilot_cmp.setup(opts) - -- attach cmp source whenever copilot attaches - -- fixes lazy-loading issues with the copilot cmp source - LazyVim.lsp.on_attach(function(client) - copilot_cmp._on_insert_enter({}) - end, "copilot") - end, - }, - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "copilot", - group_index = 1, - priority = 100, - }) - end, - }, - - { - "saghen/blink.cmp", - optional = true, - specs = { - { - "zbirenbaum/copilot.lua", - event = "InsertEnter", - opts = { - suggestion = { - enabled = true, - auto_trigger = true, - keymap = { accept = false }, - }, - }, - }, - }, - opts = { - windows = { - ghost_text = { - enabled = false, - }, - }, - keymap = { - [""] = { - function(cmp) - if cmp.is_in_snippet() then - return cmp.accept() - elseif require("copilot.suggestion").is_visible() then - LazyVim.create_undo() - require("copilot.suggestion").accept() - return true - else - return cmp.select_and_accept() - end - end, - "snippet_forward", - "fallback", - }, - }, - }, - }, -} diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua index 47bd80c4..6b16ba90 100644 --- a/lua/lazyvim/plugins/extras/coding/luasnip.lua +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -1,4 +1,8 @@ return { + -- disable builtin snippet support + { "garymjr/nvim-snippets", enabled = false }, + + -- add luasnip { "L3MON4D3/LuaSnip", lazy = true, @@ -10,20 +14,7 @@ return { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - { - "nvim-cmp", - dependencies = { - "saadparwaiz1/cmp_luasnip", - }, - opts = function(_, opts) - opts.snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - } - table.insert(opts.sources, { name = "luasnip" }) + require("luasnip.loaders.from_vscode").lazy_load({ paths = { vim.fn.stdpath("config") .. "/snippets" } }) end, }, }, @@ -32,23 +23,70 @@ return { delete_check_events = "TextChanged", }, }, + + -- add snippet_forward action { - "nvim-cmp", + "L3MON4D3/LuaSnip", + opts = function() + LazyVim.cmp.actions.snippet_forward = function() + if require("luasnip").jumpable(1) then + require("luasnip").jump(1) + return true + end + end + LazyVim.cmp.actions.snippet_stop = function() + if require("luasnip").expand_or_jumpable() then -- or just jumpable(1) is fine? + require("luasnip").unlink_current() + return true + end + end + end, + }, + + -- nvim-cmp integration + { + "hrsh7th/nvim-cmp", + optional = true, + dependencies = { "saadparwaiz1/cmp_luasnip" }, + opts = function(_, opts) + opts.snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + } + table.insert(opts.sources, { name = "luasnip" }) + end, -- stylua: ignore keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, silent = true, mode = "i", - }, { "", function() require("luasnip").jump(1) end, mode = "s" }, { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, }, }, + + -- blink.cmp integration { - "garymjr/nvim-snippets", - enabled = false, + "saghen/blink.cmp", + optional = true, + dependencies = { + { "saghen/blink.compat", opts = { impersonate_nvim_cmp = true } }, + { "saadparwaiz1/cmp_luasnip" }, + }, + opts = { + sources = { compat = { "luasnip" } }, + snippets = { + expand = function(snippet) + require("luasnip").lsp_expand(snippet) + end, + active = function(filter) + if filter and filter.direction then + return require("luasnip").jumpable(filter.direction) + end + return require("luasnip").in_snippet() + end, + jump = function(direction) + require("luasnip").jump(direction) + end, + }, + }, }, } diff --git a/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua b/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua new file mode 100644 index 00000000..cdada25a --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/nvim-cmp.lua @@ -0,0 +1,118 @@ +return { + { + "saghen/blink.cmp", + enabled = false, + optional = true, + }, + + -- Setup nvim-cmp + { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + -- Not all LSP servers add brackets when completing a function. + -- To better deal with this, LazyVim adds a custom option to cmp, + -- that you can configure. For example: + -- + -- ```lua + -- opts = { + -- auto_brackets = { "python" } + -- } + -- ``` + opts = function() + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + local auto_select = true + return { + auto_brackets = {}, -- configure any filetype to auto add brackets + completion = { + completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), + }, + preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.complete(), + [""] = LazyVim.cmp.confirm({ select = auto_select }), + [""] = LazyVim.cmp.confirm({ select = true }), + [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + cmp.abort() + fallback() + end, + [""] = function(fallback) + return LazyVim.cmp.map({ "snippet_forward", "ai_accept" }, fallback)() + end, + }), + sources = cmp.config.sources({ + { name = "lazydev" }, + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + formatting = { + format = function(entry, item) + local icons = LazyVim.config.icons.kinds + if icons[item.kind] then + item.kind = icons[item.kind] .. item.kind + end + + local widths = { + abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, + menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, + } + + for key, width in pairs(widths) do + if item[key] and vim.fn.strdisplaywidth(item[key]) > width then + item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" + end + end + + return item + end, + }, + experimental = { + -- only show ghost text when we show ai completions + ghost_text = vim.g.ai_cmp and { + hl_group = "CmpGhostText", + } or false, + }, + sorting = defaults.sorting, + } + end, + main = "lazyvim.util.cmp", + }, + + -- snippets + { + "hrsh7th/nvim-cmp", + dependencies = { + { + "garymjr/nvim-snippets", + opts = { + friendly_snippets = true, + }, + dependencies = { "rafamadriz/friendly-snippets" }, + }, + }, + opts = function(_, opts) + opts.snippet = { + expand = function(item) + return LazyVim.cmp.expand(item.body) + end, + } + if LazyVim.has("nvim-snippets") then + table.insert(opts.sources, { name = "snippets" }) + end + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index b0582673..d84b71bf 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -33,7 +33,6 @@ return { -- stylua: ignore keys = { - { "d", "", desc = "+debug", mode = {"n", "v"} }, { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, { "dc", function() require("dap").continue() end, desc = "Run/Continue" }, @@ -46,7 +45,7 @@ return { { "dl", function() require("dap").run_last() end, desc = "Run Last" }, { "do", function() require("dap").step_out() end, desc = "Step Out" }, { "dO", function() require("dap").step_over() end, desc = "Step Over" }, - { "dp", function() require("dap").pause() end, desc = "Pause" }, + { "dP", function() require("dap").pause() end, desc = "Pause" }, { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, { "ds", function() require("dap").session() end, desc = "Session" }, { "dt", function() require("dap").terminate() end, desc = "Terminate" }, diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 4bfb285d..a9f7bb26 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -98,39 +98,40 @@ return { return { dials_by_ft = { css = "css", + vue = "vue", javascript = "typescript", + typescript = "typescript", + typescriptreact = "typescript", javascriptreact = "typescript", json = "json", lua = "lua", markdown = "markdown", - python = "python", sass = "css", scss = "css", - typescript = "typescript", - typescriptreact = "typescript", - yaml = "yaml", + python = "python", }, groups = { default = { augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) + augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) ordinal_numbers, weekdays, months, - }, - typescript = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number + capitalized_boolean, augend.constant.alias.bool, -- boolean value (true <-> false) logical_alias, + }, + vue = { + augend.constant.new({ elements = { "let", "const" } }), + augend.hexcolor.new({ case = "lower" }), + augend.hexcolor.new({ case = "upper" }), + }, + typescript = { augend.constant.new({ elements = { "let", "const" } }), }, - yaml = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number - augend.constant.alias.bool, -- boolean value (true <-> false) - }, css = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.hexcolor.new({ case = "lower", }), @@ -142,12 +143,9 @@ return { augend.misc.alias.markdown_header, }, json = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number augend.semver.alias.semver, -- versioning (v1.1.2) }, lua = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number - augend.constant.alias.bool, -- boolean value (true <-> false) augend.constant.new({ elements = { "and", "or" }, word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. @@ -155,14 +153,20 @@ return { }), }, python = { - augend.integer.alias.decimal_int, -- nonnegative and negative decimal number - capitalized_boolean, - logical_alias, + augend.constant.new({ + elements = { "and", "or" }, + }), }, }, } end, config = function(_, opts) + -- copy defaults to each group + for name, group in pairs(opts.groups) do + if name ~= "default" then + vim.list_extend(group, opts.groups.default) + end + end require("dial.config").augends:register_group(opts.groups) vim.g.dials_by_ft = opts.dials_by_ft end, diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index e23af81b..c70a6f14 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -74,18 +74,6 @@ return { config.defaults.actions.files["alt-c"] = config.defaults.actions.files["ctrl-r"] config.set_action_helpstr(config.defaults.actions.files["ctrl-r"], "toggle-root-dir") - -- use the same prompt for all - local defaults = require("fzf-lua.profiles.default-title") - local function fix(t) - t.prompt = t.prompt ~= nil and " " or nil - for _, v in pairs(t) do - if type(v) == "table" then - fix(v) - end - end - end - fix(defaults) - local img_previewer ---@type string[]? for _, v in ipairs({ { cmd = "ueberzug", args = {} }, @@ -98,7 +86,8 @@ return { end end - return vim.tbl_deep_extend("force", defaults, { + return { + "default-title", fzf_colors = true, fzf_opts = { ["--no-scrollbar"] = true, @@ -186,9 +175,24 @@ return { previewer = vim.fn.executable("delta") == 1 and "codeaction_native" or nil, }, }, - }) + } end, config = function(_, opts) + if opts[1] == "default-title" then + -- use the same prompt for all pickers for profile `default-title` and + -- profiles that use `default-title` as base profile + local function fix(t) + t.prompt = t.prompt ~= nil and " " or nil + for _, v in pairs(t) do + if type(v) == "table" then + fix(v) + end + end + return t + end + opts = vim.tbl_deep_extend("force", fix(require("fzf-lua.profiles.default-title")), opts) + opts[1] = nil + end require("fzf-lua").setup(opts) end, init = function() diff --git a/lua/lazyvim/plugins/extras/editor/illuminate.lua b/lua/lazyvim/plugins/extras/editor/illuminate.lua index 59aada0a..66c45937 100644 --- a/lua/lazyvim/plugins/extras/editor/illuminate.lua +++ b/lua/lazyvim/plugins/extras/editor/illuminate.lua @@ -2,6 +2,9 @@ -- This works with LSP, Treesitter, and regexp matching to find the other -- instances. return { + -- disable snacks words + { "snacks.nvim", opts = { words = { enabled = false } } }, + { "RRethy/vim-illuminate", event = "LazyFile", @@ -53,8 +56,4 @@ return { { "[[", desc = "Prev Reference" }, }, }, - { - "neovim/nvim-lspconfig", - opts = { document_highlight = { enabled = false } }, - }, } diff --git a/lua/lazyvim/plugins/extras/editor/mini-diff.lua b/lua/lazyvim/plugins/extras/editor/mini-diff.lua index 6e5040ad..fe25c11e 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-diff.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-diff.lua @@ -29,6 +29,29 @@ return { }, }, }, + { + "mini.diff", + opts = function() + Snacks.toggle({ + name = "Mini Diff Signs", + get = function() + return vim.g.minidiff_disable ~= true + end, + set = function(state) + vim.g.minidiff_disable = not state + if state then + require("mini.diff").enable(0) + else + require("mini.diff").disable(0) + end + -- HACK: redraw to update the signs + vim.defer_fn(function() + vim.cmd([[redraw!]]) + end, 200) + end, + }):map("uG") + end, + }, -- lualine integration { diff --git a/lua/lazyvim/plugins/extras/formatting/biome.lua b/lua/lazyvim/plugins/extras/formatting/biome.lua new file mode 100644 index 00000000..1a4e274c --- /dev/null +++ b/lua/lazyvim/plugins/extras/formatting/biome.lua @@ -0,0 +1,59 @@ +---@diagnostic disable: inject-field +if lazyvim_docs then + -- Enable this option to avoid conflicts with Prettier. + vim.g.lazyvim_prettier_needs_config = true +end + +-- https://biomejs.dev/internals/language-support/ +local supported = { + "astro", + "css", + "graphql", + -- "html", + "javascript", + "javascriptreact", + "json", + "jsonc", + -- "markdown", + "svelte", + "typescript", + "typescriptreact", + "vue", + -- "yaml", +} + +return { + { + "williamboman/mason.nvim", + opts = { ensure_installed = { "biome" } }, + }, + + { + "stevearc/conform.nvim", + optional = true, + ---@param opts ConformOpts + opts = function(_, opts) + opts.formatters_by_ft = opts.formatters_by_ft or {} + for _, ft in ipairs(supported) do + opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {} + table.insert(opts.formatters_by_ft[ft], "biome") + end + + opts.formatters = opts.formatters or {} + opts.formatters.biome = { + require_cwd = true, + } + end, + }, + + -- none-ls support + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = opts.sources or {} + table.insert(opts.sources, nls.builtins.formatting.biome) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index dccbc9cb..ae245d54 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -103,8 +103,11 @@ return { }, { - "nvim-cmp", + "hrsh7th/nvim-cmp", + optional = true, opts = function(_, opts) + opts.sorting = opts.sorting or {} + opts.sorting.comparators = opts.sorting.comparators or {} table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores")) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/git.lua b/lua/lazyvim/plugins/extras/lang/git.lua index 0fc92c4d..8399d620 100644 --- a/lua/lazyvim/plugins/extras/lang/git.lua +++ b/lua/lazyvim/plugins/extras/lang/git.lua @@ -9,7 +9,8 @@ return { }, { - "nvim-cmp", + "hrsh7th/nvim-cmp", + optional = true, dependencies = { { "petertriho/cmp-git", opts = {} }, }, diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 6b83fe29..520776fe 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -40,6 +40,20 @@ return { { "mfussenegger/nvim-dap", optional = true, + opts = function() + -- Simple configuration to attach to remote java debug process + -- Taken directly from https://github.com/mfussenegger/nvim-dap/wiki/Java + local dap = require("dap") + dap.configurations.java = { + { + type = "java", + request = "attach", + name = "Debug (Attach) - Remote", + hostName = "127.0.0.1", + port = 5005, + }, + } + end, dependencies = { { "williamboman/mason.nvim", @@ -71,8 +85,12 @@ return { dependencies = { "folke/which-key.nvim" }, ft = java_filetypes, opts = function() - local mason_registry = require("mason-registry") - local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar" + 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" + 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. @@ -93,10 +111,7 @@ return { -- How to run jdtls. This can be overridden to a full java command-line -- if the Python wrapper script doesn't suffice. - cmd = { - vim.fn.exepath("jdtls"), - string.format("--jvm-arg=-javaagent:%s", lombok_jar), - }, + cmd = cmd, full_cmd = function(opts) local fname = vim.api.nvim_buf_get_name(0) local root_dir = opts.root_dir(fname) @@ -131,29 +146,30 @@ return { config = function(_, opts) -- Find the extra bundles that should be passed on the jdtls command-line -- if nvim-dap is enabled with java debug/test. - local mason_registry = require("mason-registry") local bundles = {} ---@type string[] - 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", - } - -- 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) + 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", + } + -- 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 end end end - local function attach_jdtls() local fname = vim.api.nvim_buf_get_name(0) @@ -197,8 +213,8 @@ return { { "cx", group = "extract" }, { "cxv", require("jdtls").extract_variable_all, desc = "Extract Variable" }, { "cxc", require("jdtls").extract_constant, desc = "Extract Constant" }, - { "gs", require("jdtls").super_implementation, desc = "Goto Super" }, - { "gS", require("jdtls.tests").goto_subjects, desc = "Goto Subjects" }, + { "cgs", require("jdtls").super_implementation, desc = "Goto Super" }, + { "cgS", require("jdtls.tests").goto_subjects, desc = "Goto Subjects" }, { "co", require("jdtls").organize_imports, desc = "Organize Imports" }, }, }) @@ -225,40 +241,43 @@ return { }, }) - if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then - -- custom init for Java debugger - require("jdtls").setup_dap(opts.dap) - require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) + if 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 + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main) - -- Java Test require Java debugger to work - if opts.test and mason_registry.is_installed("java-test") then - -- custom keymaps for Java test runner (not yet compatible with neotest) - wk.add({ - { - mode = "n", - buffer = args.buf, - { "t", group = "test" }, + -- Java Test require Java debugger to work + if opts.test and mason_registry.is_installed("java-test") then + -- custom keymaps for Java test runner (not yet compatible with neotest) + wk.add({ { - "tt", - function() - require("jdtls.dap").test_class({ - config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, - }) - end, - desc = "Run All Test", + mode = "n", + buffer = args.buf, + { "t", group = "test" }, + { + "tt", + function() + require("jdtls.dap").test_class({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) + end, + desc = "Run All Test", + }, + { + "tr", + function() + require("jdtls.dap").test_nearest_method({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) + end, + desc = "Run Nearest Test", + }, + { "tT", require("jdtls.dap").pick_test, desc = "Run Test" }, }, - { - "tr", - function() - require("jdtls.dap").test_nearest_method({ - config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, - }) - end, - desc = "Run Nearest Test", - }, - { "tT", require("jdtls.dap").pick_test, desc = "Run Test" }, - }, - }) + }) + end end end diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 583981d4..e5304b56 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -1,3 +1,13 @@ +if lazyvim_docs then + -- LSP Server to use for Rust. + -- Set to "bacon-ls" to use bacon-ls instead of rust-analyzer. + -- only for diagnostics. The rest of LSP support will still be + -- provided by rust-analyzer. + vim.g.lazyvim_rust_diagnostics = "rust-analyzer" +end + +local diagnostics = vim.g.lazyvim_rust_diagnostics or "rust-analyzer" + return { recommended = function() return LazyVim.extras.wants({ @@ -35,7 +45,13 @@ return { { "williamboman/mason.nvim", optional = true, - opts = { ensure_installed = { "codelldb" } }, + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "codelldb" }) + if diagnostics == "bacon-ls" then + vim.list_extend(opts.ensure_installed, { "bacon" }) + end + end, }, { @@ -62,8 +78,12 @@ return { enable = true, }, }, - -- Add clippy lints for Rust. - checkOnSave = true, + -- Add clippy lints for Rust if using rust-analyzer + checkOnSave = diagnostics == "rust-analyzer", + -- Enable diagnostics if using rust-analyzer + diagnostics = { + enable = diagnostics == "rust-analyzer", + }, procMacro = { enable = true, ignored = { @@ -72,11 +92,36 @@ return { ["async-recursion"] = { "async_recursion" }, }, }, + files = { + excludeDirs = { + ".direnv", + ".git", + ".github", + ".gitlab", + "bin", + "node_modules", + "target", + "venv", + ".venv", + }, + }, }, }, }, }, 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 + opts.dap = { + adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb, library_path), + } + end vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {}) if vim.fn.executable("rust-analyzer") == 0 then LazyVim.error( @@ -92,6 +137,9 @@ return { "neovim/nvim-lspconfig", opts = { servers = { + bacon_ls = { + enabled = diagnostics == "bacon-ls", + }, rust_analyzer = { enabled = false }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/sql.lua b/lua/lazyvim/plugins/extras/lang/sql.lua index a4b426ba..075182d6 100644 --- a/lua/lazyvim/plugins/extras/lang/sql.lua +++ b/lua/lazyvim/plugins/extras/lang/sql.lua @@ -48,19 +48,21 @@ return { vim.api.nvim_create_autocmd("FileType", { pattern = sql_ft, callback = function() - local cmp = require("cmp") + if LazyVim.has("nvim-cmp") then + local cmp = require("cmp") - -- global sources - ---@param source cmp.SourceConfig - local sources = vim.tbl_map(function(source) - return { name = source.name } - end, cmp.get_config().sources) + -- global sources + ---@param source cmp.SourceConfig + local sources = vim.tbl_map(function(source) + return { name = source.name } + end, cmp.get_config().sources) - -- add vim-dadbod-completion source - table.insert(sources, { name = "vim-dadbod-completion" }) + -- add vim-dadbod-completion source + table.insert(sources, { name = "vim-dadbod-completion" }) - -- update sources for the current buffer - cmp.setup.buffer({ sources = sources }) + -- update sources for the current buffer + cmp.setup.buffer({ sources = sources }) + end end, }) end, @@ -122,6 +124,23 @@ return { end, }, + -- blink.cmp integration + { + "saghen/blink.cmp", + optional = true, + opts = { + sources = { + default = { "dadbod" }, + providers = { + dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, + }, + }, + }, + dependencies = { + "kristijanhusak/vim-dadbod-completion", + }, + }, + -- Linters & formatters { "williamboman/mason.nvim", diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua index 870a3fda..9ced69e1 100644 --- a/lua/lazyvim/plugins/extras/lang/tex.lua +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -30,7 +30,7 @@ return { vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" end, keys = { - { "l", "", desc = "+vimtex" }, + { "l", "", desc = "+vimtex", ft = "tex" }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index dd5ca25c..6d7ae673 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -44,6 +44,7 @@ return { enableMoveToFileCodeAction = true, autoUseWorkspaceTsdk = true, experimental = { + maxInlayHintLength = 30, completion = { enableServerSideFuzzyMatch = true, }, diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index 1898bd08..2a25a3e7 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -1,7 +1,6 @@ return { - { "nvimdev/dashboard-nvim", enabled = false }, - { "echasnovski/mini.starter", enabled = false }, + { "folke/snacks.nvim", opts = { dashboard = { enabled = false } } }, -- Dashboard. This runs when neovim starts, and is what displays -- the "LAZYVIM" banner. { @@ -23,11 +22,11 @@ return { dashboard.section.header.val = vim.split(logo, "\n") -- stylua: ignore dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", LazyVim.pick()), + dashboard.button("f", " " .. " Find file", " lua LazyVim.pick()() "), dashboard.button("n", " " .. " New file", [[ ene startinsert ]]), - dashboard.button("r", " " .. " Recent files", LazyVim.pick("oldfiles")), - dashboard.button("g", " " .. " Find text", LazyVim.pick("live_grep")), - dashboard.button("c", " " .. " Config", LazyVim.pick.config_files()), + dashboard.button("r", " " .. " Recent files", [[ lua LazyVim.pick("oldfiles")() ]]), + dashboard.button("g", " " .. " Find text", [[ lua LazyVim.pick("live_grep")() ]]), + dashboard.button("c", " " .. " Config", " lua LazyVim.pick.config_files()() "), dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), dashboard.button("x", " " .. " Lazy Extras", " LazyExtras "), dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), diff --git a/lua/lazyvim/plugins/extras/ui/dashboard-nvim.lua b/lua/lazyvim/plugins/extras/ui/dashboard-nvim.lua new file mode 100644 index 00000000..4bda3fe5 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/dashboard-nvim.lua @@ -0,0 +1,68 @@ +return { + { "folke/snacks.nvim", opts = { dashboard = { enabled = false } } }, + { + "nvimdev/dashboard-nvim", + lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. + opts = function() + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep("\n", 8) .. logo .. "\n\n" + + local opts = { + theme = "doom", + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, + config = { + header = vim.split(logo, "\n"), + -- stylua: ignore + center = { + { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, + { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" }, + { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" }, + { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" + end + + -- open dashboard after closing lazy + if vim.o.filetype == "lazy" then + vim.api.nvim_create_autocmd("WinClosed", { + pattern = tostring(vim.api.nvim_get_current_win()), + once = true, + callback = function() + vim.schedule(function() + vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) + end) + end, + }) + end + + return opts + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/indent-blankline.lua b/lua/lazyvim/plugins/extras/ui/indent-blankline.lua new file mode 100644 index 00000000..fe87f9dd --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/indent-blankline.lua @@ -0,0 +1,51 @@ +return { + -- disable snacks indent when indent-blankline is enabled + { + "snacks.nvim", + opts = { + indent = { enabled = false }, + }, + }, + { + "lukas-reineke/indent-blankline.nvim", + event = "LazyFile", + opts = function() + Snacks.toggle({ + name = "Indention Guides", + get = function() + return require("ibl.config").get_config(0).enabled + end, + set = function(state) + require("ibl").setup_buffer(0, { enabled = state }) + end, + }):map("ug") + + return { + indent = { + char = "│", + tab_char = "│", + }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "Trouble", + "alpha", + "dashboard", + "help", + "lazy", + "mason", + "neo-tree", + "notify", + "snacks_dashboard", + "snacks_notif", + "snacks_terminal", + "snacks_win", + "toggleterm", + "trouble", + }, + }, + } + end, + main = "ibl", + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index 925a9f80..bbd3e587 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -1,53 +1,64 @@ -- animations return { - "echasnovski/mini.animate", - recommended = true, - event = "VeryLazy", - opts = function() - -- don't use animate when scrolling with the mouse - local mouse_scrolled = false - for _, scroll in ipairs({ "Up", "Down" }) do - local key = "" - vim.keymap.set({ "", "i" }, key, function() - mouse_scrolled = true - return key - end, { expr = true }) - end + -- disable snacks scroll when animate is enabled + { + "snacks.nvim", + opts = { + scroll = { enabled = false }, + }, + }, - vim.api.nvim_create_autocmd("FileType", { - pattern = "grug-far", - callback = function() - vim.b.minianimate_disable = true - end, - }) + -- setup animate + { + "echasnovski/mini.animate", + event = "VeryLazy", + cond = vim.g.neovide == nil, + opts = function(_, opts) + -- don't use animate when scrolling with the mouse + local mouse_scrolled = false + for _, scroll in ipairs({ "Up", "Down" }) do + local key = "" + vim.keymap.set({ "", "i" }, key, function() + mouse_scrolled = true + return key + end, { expr = true }) + end - Snacks.toggle({ - name = "Mini Animate", - get = function() - return not vim.g.minianimate_disable - end, - set = function(state) - vim.g.minianimate_disable = not state - end, - }):map("ua") + vim.api.nvim_create_autocmd("FileType", { + pattern = "grug-far", + callback = function() + vim.b.minianimate_disable = true + end, + }) - local animate = require("mini.animate") - return { - resize = { - timing = animate.gen_timing.linear({ duration = 50, unit = "total" }), - }, - scroll = { - timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), - subscroll = animate.gen_subscroll.equal({ - predicate = function(total_scroll) - if mouse_scrolled then - mouse_scrolled = false - return false - end - return total_scroll > 1 - end, - }), - }, - } - end, + Snacks.toggle({ + name = "Mini Animate", + get = function() + return not vim.g.minianimate_disable + end, + set = function(state) + vim.g.minianimate_disable = not state + end, + }):map("ua") + + local animate = require("mini.animate") + return vim.tbl_deep_extend("force", opts, { + resize = { + timing = animate.gen_timing.linear({ duration = 50, unit = "total" }), + }, + scroll = { + timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), + subscroll = animate.gen_subscroll.equal({ + predicate = function(total_scroll) + if mouse_scrolled then + mouse_scrolled = false + return false + end + return total_scroll > 1 + end, + }), + }, + }) + end, + }, } diff --git a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua index 3c49d83b..91ec1d45 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-indentscope.lua @@ -23,6 +23,7 @@ return { "mason", "neo-tree", "notify", + "snacks_dashboard", "snacks_notif", "snacks_terminal", "snacks_win", @@ -33,13 +34,33 @@ return { vim.b.miniindentscope_disable = true end, }) + + vim.api.nvim_create_autocmd("User", { + pattern = "SnacksDashboardOpened", + callback = function(data) + vim.b[data.buf].miniindentscope_disable = true + end, + }) end, }, + + -- disable inent-blankline scope when mini-indentscope is enabled { "lukas-reineke/indent-blankline.nvim", + optional = true, event = "LazyFile", opts = { scope = { enabled = false }, }, }, + + -- disable snacks scroll when mini-indentscope is enabled + { + "snacks.nvim", + opts = { + indent = { + scope = { enabled = false }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 6407345c..c1bd7bc1 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -1,8 +1,7 @@ -- start screen return { -- disable alpha - { "goolord/alpha-nvim", enabled = false }, - { "nvimdev/dashboard-nvim", enabled = false }, + { "folke/snacks.nvim", opts = { dashboard = { enabled = false } } }, -- enable mini.starter { diff --git a/lua/lazyvim/plugins/extras/ui/smear-cursor.lua b/lua/lazyvim/plugins/extras/ui/smear-cursor.lua new file mode 100644 index 00000000..070d2623 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/smear-cursor.lua @@ -0,0 +1,19 @@ +return { + "sphamba/smear-cursor.nvim", + event = "VeryLazy", + cond = vim.g.neovide == nil, + opts = { + hide_target_hack = true, + cursor_color = "none", + }, + specs = { + -- disable mini.animate cursor + { + "echasnovski/mini.animate", + optional = true, + opts = { + cursor = { enable = false }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua index ba9565a1..866e72f2 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua @@ -1,7 +1,7 @@ -- Show context of the current function return { "nvim-treesitter/nvim-treesitter-context", - event = "VeryLazy", + event = "LazyFile", opts = function() local tsc = require("treesitter-context") Snacks.toggle({ diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index ba2f627d..e24b9fe0 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -39,11 +39,12 @@ return { pattern = { [".*/waybar/config"] = "jsonc", [".*/mako/config"] = "dosini", - [".*/kitty/.+%.conf"] = "bash", + [".*/kitty/.+%.conf"] = "kitty", [".*/hypr/.+%.conf"] = "hyprlang", ["%.env%.[%w_.-]+"] = "sh", }, }) + vim.treesitter.language.register("bash", "kitty") add("git_config") diff --git a/lua/lazyvim/plugins/extras/util/octo.lua b/lua/lazyvim/plugins/extras/util/octo.lua index a8286265..9412e54c 100644 --- a/lua/lazyvim/plugins/extras/util/octo.lua +++ b/lua/lazyvim/plugins/extras/util/octo.lua @@ -22,13 +22,16 @@ return { { "gr", "Octo repo list", desc = "List Repos (Octo)" }, { "gS", "Octo search", desc = "Search (Octo)" }, - { "a", "", desc = "+assignee (Octo)", ft = "octo" }, - { "c", "", desc = "+comment/code (Octo)", ft = "octo" }, - { "l", "", desc = "+label (Octo)", ft = "octo" }, - { "i", "", desc = "+issue (Octo)", ft = "octo" }, - { "r", "", desc = "+react (Octo)", ft = "octo" }, - { "p", "", desc = "+pr (Octo)", ft = "octo" }, - { "v", "", desc = "+review (Octo)", ft = "octo" }, + { "a", "", desc = "+assignee (Octo)", ft = "octo" }, + { "c", "", desc = "+comment/code (Octo)", ft = "octo" }, + { "l", "", desc = "+label (Octo)", ft = "octo" }, + { "i", "", desc = "+issue (Octo)", ft = "octo" }, + { "r", "", desc = "+react (Octo)", ft = "octo" }, + { "p", "", desc = "+pr (Octo)", ft = "octo" }, + { "pr", "", desc = "+rebase (Octo)", ft = "octo" }, + { "ps", "", desc = "+squash (Octo)", ft = "octo" }, + { "v", "", desc = "+review (Octo)", ft = "octo" }, + { "g", "", desc = "+goto_issue (Octo)", ft = "octo" }, { "@", "@", mode = "i", ft = "octo", silent = true }, { "#", "#", mode = "i", ft = "octo", silent = true }, }, diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 5d399125..01a25bc2 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -152,6 +152,9 @@ return { "nvimdev/dashboard-nvim", optional = true, opts = function(_, opts) + if not vim.tbl_get(opts, "config", "center") then + return + end local projects = { action = pick, desc = " Projects", @@ -165,4 +168,17 @@ return { table.insert(opts.config.center, 3, projects) end, }, + + { + "folke/snacks.nvim", + optional = true, + opts = function(_, opts) + table.insert(opts.dashboard.preset.keys, 3, { + action = pick, + desc = "Projects", + icon = " ", + key = "p", + }) + end, + }, } diff --git a/lua/lazyvim/plugins/extras/util/rest.lua b/lua/lazyvim/plugins/extras/util/rest.lua index a8e12154..9f2e6d67 100644 --- a/lua/lazyvim/plugins/extras/util/rest.lua +++ b/lua/lazyvim/plugins/extras/util/rest.lua @@ -9,10 +9,23 @@ return { ft = "http", keys = { { "R", "", desc = "+Rest", ft = "http" }, - { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, - { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, - { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, + { "Rb", "lua require('kulala').scratchpad()", desc = "Open scratchpad", ft = "http" }, + { "Rc", "lua require('kulala').copy()", desc = "Copy as cURL", ft = "http" }, + { "RC", "lua require('kulala').from_curl()", desc = "Paste from curl", ft = "http" }, + { + "Rg", + "lua require('kulala').download_graphql_schema()", + desc = "Download GraphQL schema", + ft = "http", + }, + { "Ri", "lua require('kulala').inspect()", desc = "Inspect current request", ft = "http" }, { "Rn", "lua require('kulala').jump_next()", desc = "Jump to next request", ft = "http" }, + { "Rp", "lua require('kulala').jump_prev()", desc = "Jump to previous request", ft = "http" }, + { "Rq", "lua require('kulala').close()", desc = "Close window", ft = "http" }, + { "Rr", "lua require('kulala').replay()", desc = "Replay the last request", ft = "http" }, + { "Rs", "lua require('kulala').run()", desc = "Send the request", ft = "http" }, + { "RS", "lua require('kulala').show_stats()", desc = "Show stats", ft = "http" }, + { "Rt", "lua require('kulala').toggle_view()", desc = "Toggle headers/body", ft = "http" }, }, opts = {}, }, diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index a272d2ce..b9b1e0b1 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -3,6 +3,7 @@ if not vim.g.vscode then end local enabled = { + "LazyVim", "dial.nvim", "flit.nvim", "lazy.nvim", @@ -15,10 +16,10 @@ local enabled = { "nvim-treesitter", "nvim-treesitter-textobjects", "nvim-ts-context-commentstring", + "snacks.nvim", "ts-comments.nvim", "vim-repeat", "yanky.nvim", - "LazyVim", } local Config = require("lazy.core.config") @@ -27,14 +28,24 @@ Config.options.change_detection.enabled = false Config.options.defaults.cond = function(plugin) return vim.tbl_contains(enabled, plugin.name) or plugin.vscode end +vim.g.snacks_animate = false -- Add some vscode specific keymaps vim.api.nvim_create_autocmd("User", { pattern = "LazyVimKeymapsDefaults", callback = function() + -- VSCode-specific keymaps for search and navigation vim.keymap.set("n", "", "Find") vim.keymap.set("n", "/", [[lua require('vscode').action('workbench.action.findInFiles')]]) vim.keymap.set("n", "ss", [[lua require('vscode').action('workbench.action.gotoSymbol')]]) + + -- Keep undo/redo lists in sync with VsCode + vim.keymap.set("n", "u", "call VSCodeNotify('undo')") + vim.keymap.set("n", "", "call VSCodeNotify('redo')") + + -- Navigate VSCode tabs like lazyvim buffers + vim.keymap.set("n", "", "call VSCodeNotify('workbench.action.previousEditor')") + vim.keymap.set("n", "", "call VSCodeNotify('workbench.action.nextEditor')") end, }) @@ -43,6 +54,15 @@ function LazyVim.terminal() end return { + { + "snacks.nvim", + opts = { + indent = { enabled = false }, + scroll = { enabled = false }, + notifier = { enabled = false }, + statuscolumn = { enabled = false }, + }, + }, { "LazyVim/LazyVim", config = function(_, opts) diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index ad646b8e..c06fa9bc 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -10,16 +10,6 @@ end require("lazyvim.config").init() --- Terminal Mappings -local function term_nav(dir) - ---@param self snacks.terminal - return function(self) - return self:is_floating() and "" or vim.schedule(function() - vim.cmd.wincmd(dir) - end) - end -end - return { { "folke/lazy.nvim", version = "*" }, { "LazyVim/LazyVim", priority = 10000, lazy = false, opts = {}, cond = true, version = "*" }, @@ -27,31 +17,15 @@ return { "folke/snacks.nvim", priority = 1000, lazy = false, - opts = function() - ---@type snacks.Config - return { - toggle = { map = LazyVim.safe_keymap_set }, - notifier = { enabled = not LazyVim.has("noice.nvim") }, - terminal = { - win = { - keys = { - nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, - nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, - nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, - nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, - }, - }, - }, - } + opts = {}, + config = function(_, opts) + local notify = vim.notify + require("snacks").setup(opts) + -- HACK: restore vim.notify after snacks setup and let noice.nvim take over + -- this is needed to have early notifications show up in noice history + if LazyVim.has("noice.nvim") then + vim.notify = notify + end end, - keys = { - { - "un", - function() - Snacks.notifier.hide() - end, - desc = "Dismiss All Notifications", - }, - }, }, } diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index eb37acc3..6ba4597f 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -46,10 +46,6 @@ return { codelens = { enabled = false, }, - -- Enable lsp cursor word highlighting - document_highlight = { - enabled = true, - }, -- add any global capabilities here capabilities = { workspace = { diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 5eacba92..1b62a911 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -21,7 +21,7 @@ function M.get() { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, { "K", function() return vim.lsp.buf.hover() end, desc = "Hover" }, { "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" }, - { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, + { "", function() return vim.lsp.buf.signature_help() end, mode = "i", desc = "Signature Help", has = "signatureHelp" }, { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, { "cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" }, @@ -67,7 +67,7 @@ function M.resolve(buffer) if not Keys.resolve then return {} end - local spec = M.get() + local spec = vim.tbl_extend("force", {}, M.get()) local opts = LazyVim.opts("nvim-lspconfig") local clients = LazyVim.lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 136c372b..2bb2c644 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -7,7 +7,6 @@ return { keys = { { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, { "bP", "BufferLineGroupClose ungrouped", desc = "Delete Non-Pinned Buffers" }, - { "bo", "BufferLineCloseOthers", desc = "Delete Other Buffers" }, { "br", "BufferLineCloseRight", desc = "Delete Buffers to the Right" }, { "bl", "BufferLineCloseLeft", desc = "Delete Buffers to the Left" }, { "", "BufferLineCyclePrev", desc = "Prev Buffer" }, @@ -85,7 +84,7 @@ return { options = { theme = "auto", globalstatus = vim.o.laststatus == 3, - disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter" } }, + disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard" } }, }, sections = { lualine_a = { "mode" }, @@ -106,29 +105,30 @@ return { { LazyVim.lualine.pretty_path() }, }, lualine_x = { + Snacks.profiler.status(), -- stylua: ignore { function() return require("noice").api.status.command.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, - color = function() return LazyVim.ui.fg("Statement") end, + color = function() return { fg = Snacks.util.color("Statement") } end, }, -- stylua: ignore { function() return require("noice").api.status.mode.get() end, cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, - color = function() return LazyVim.ui.fg("Constant") end, + color = function() return { fg = Snacks.util.color("Constant") } end, }, -- stylua: ignore { function() return " " .. require("dap").status() end, cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, - color = function() return LazyVim.ui.fg("Debug") end, + color = function() return { fg = Snacks.util.color("Debug") } end, }, -- stylua: ignore { require("lazy.status").updates, cond = require("lazy.status").has_updates, - color = function() return LazyVim.ui.fg("Special") end, + color = function() return { fg = Snacks.util.color("Special") } end, }, { "diff", @@ -186,49 +186,6 @@ return { end, }, - -- indent guides for Neovim - { - "lukas-reineke/indent-blankline.nvim", - event = "LazyFile", - opts = function() - Snacks.toggle({ - name = "Indention Guides", - get = function() - return require("ibl.config").get_config(0).enabled - end, - set = function(state) - require("ibl").setup_buffer(0, { enabled = state }) - end, - }):map("ug") - - return { - indent = { - char = "│", - tab_char = "│", - }, - scope = { show_start = false, show_end = false }, - exclude = { - filetypes = { - "Trouble", - "alpha", - "dashboard", - "help", - "lazy", - "mason", - "neo-tree", - "notify", - "snacks_notif", - "snacks_terminal", - "snacks_win", - "toggleterm", - "trouble", - }, - }, - } - end, - main = "ibl", - }, - -- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu. { "folke/noice.nvim", @@ -308,68 +265,52 @@ return { { "MunifTanjim/nui.nvim", lazy = true }, { - "nvimdev/dashboard-nvim", - lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. - opts = function() - local logo = [[ - ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z - ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z - ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z - ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z - ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] + "snacks.nvim", + opts = { + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = false }, -- we set this in options.lua + toggle = { map = LazyVim.safe_keymap_set }, + words = { enabled = true }, + }, + -- stylua: ignore + keys = { + { "n", function() Snacks.notifier.show_history() end, desc = "Notification History" }, + { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, + }, + }, - logo = string.rep("\n", 8) .. logo .. "\n\n" - - local opts = { - theme = "doom", - hide = { - -- this is taken care of by lualine - -- enabling this messes up the actual laststatus setting after loading a file - statusline = false, - }, - config = { - header = vim.split(logo, "\n"), + { + "snacks.nvim", + opts = { + dashboard = { + preset = { + header = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]], -- stylua: ignore - center = { - { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, - { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" }, - { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" }, - { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, + ---@type snacks.dashboard.Item[] + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" }, + { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, }, - footer = function() - local stats = require("lazy").stats() - local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } - end, }, - } - - for _, button in ipairs(opts.config.center) do - button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - button.key_format = " %s" - end - - -- open dashboard after closing lazy - if vim.o.filetype == "lazy" then - vim.api.nvim_create_autocmd("WinClosed", { - pattern = tostring(vim.api.nvim_get_current_win()), - once = true, - callback = function() - vim.schedule(function() - vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) - end) - end, - }) - end - - return opts - end, + }, + }, }, } diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 22a3e734..8d8aa220 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -1,5 +1,40 @@ +-- Terminal Mappings +local function term_nav(dir) + ---@param self snacks.terminal + return function(self) + return self:is_floating() and "" or vim.schedule(function() + vim.cmd.wincmd(dir) + end) + end +end + return { + -- Snacks utils + { + "snacks.nvim", + opts = { + bigfile = { enabled = true }, + quickfile = { enabled = true }, + terminal = { + win = { + keys = { + nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, + nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, + nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, + nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + }, + }, + }, + }, + -- stylua: ignore + keys = { + { ".", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" }, + { "S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" }, + { "dps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Buffer" }, + }, + }, + -- Session management. This saves your session in the background, -- keeping track of open buffers, window arrangement, and more. -- You can restore sessions when returning through the dashboard. diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index c2b52cb6..ebb0dd89 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -2,6 +2,7 @@ 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.lang.typescript"] = 5, ["lazyvim.plugins.extras.coding.blink"] = 5, @@ -27,6 +28,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 table.sort(extras, function(a, b) local pa = prios[a] or 50 diff --git a/lua/lazyvim/util/cmp.lua b/lua/lazyvim/util/cmp.lua index 5eff81fa..0641c892 100644 --- a/lua/lazyvim/util/cmp.lua +++ b/lua/lazyvim/util/cmp.lua @@ -1,6 +1,41 @@ ---@class lazyvim.util.cmp local M = {} +---@alias lazyvim.util.cmp.Action fun():boolean? +---@type table +M.actions = { + -- Native Snippets + snippet_forward = function() + if vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) + return true + end + end, + snippet_stop = function() + if vim.snippet then + vim.snippet.stop() + end + end, +} + +---@param actions string[] +---@param fallback? string|fun() +function M.map(actions, fallback) + return function() + for _, name in ipairs(actions) do + if M.actions[name] then + local ret = M.actions[name]() + if ret then + return true + end + end + end + return type(fallback) == "function" and fallback() or fallback + end +end + ---@alias Placeholder {n:number, text:string} ---@param snippet string @@ -70,20 +105,6 @@ function M.add_missing_snippet_docs(window) end end -function M.visible() - ---@module 'blink.cmp' - local blink = package.loaded["blink.cmp"] - if blink then - return blink.windows and blink.windows.autocomplete.win:is_open() - end - ---@module 'cmp' - local cmp = package.loaded["cmp"] - if cmp then - return cmp.core.view:visible() - end - return false -end - -- This is a better implementation of `cmp.confirm`: -- * check if the completion menu is visible without waiting for running sources -- * create an undo point before confirming diff --git a/lua/lazyvim/util/deprecated.lua b/lua/lazyvim/util/deprecated.lua index 43d73fcf..375bc9ca 100644 --- a/lua/lazyvim/util/deprecated.lua +++ b/lua/lazyvim/util/deprecated.lua @@ -13,6 +13,12 @@ M.moved = { ui = { statuscolumn = { "Snacks.statuscolumn" }, bufremove = { "Snacks.bufdelete" }, + fg = { + "{ fg = Snacks.util.color(...) }", + fn = function(...) + return { fg = Snacks.util.color(...) } + end, + }, }, } @@ -33,6 +39,9 @@ function M.decorate(name, mod) if M.moved[name][k] then local to = M.moved[name][k][1] LazyVim.deprecate("LazyVim." .. name .. "." .. k, to) + if M.moved[name][k].fn then + return M.moved[name][k].fn + end local ret = vim.tbl_get(_G, unpack(vim.split(to, ".", { plain = true }))) return ret end diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 8d94f582..188544c3 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -265,4 +265,13 @@ function M.memoize(fn) end end +---@return "nvim-cmp" | "blink.cmp" +function M.cmp_engine() + vim.g.lazyvim_cmp = vim.g.lazyvim_cmp or "auto" + if vim.g.lazyvim_cmp == "auto" then + return LazyVim.has_extra("coding.nvim-cmp") and "nvim-cmp" or "blink.cmp" + end + return vim.g.lazyvim_cmp +end + return M diff --git a/lua/lazyvim/util/json.lua b/lua/lazyvim/util/json.lua index a823606a..f3ca7fcf 100644 --- a/lua/lazyvim/util/json.lua +++ b/lua/lazyvim/util/json.lua @@ -90,6 +90,13 @@ function M.migrate() json.data.extras = vim.tbl_filter(function(extra) return not (extra == "lazyvim.plugins.extras.editor.trouble-v3") end, json.data.extras or {}) + elseif json.data.version == 6 then + local ai = { "copilot", "codeium", "copilot-chat", "tabnine" } + json.data.extras = vim.tbl_map(function(extra) + return extra:gsub("^lazyvim%.plugins%.extras%.coding%.(.*)$", function(name) + return vim.tbl_contains(ai, name) and ("lazyvim.plugins.extras.ai." .. name) or extra + end) + end, json.data.extras or {}) end M.save() diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index db8311c4..5f4f1885 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -1,13 +1,37 @@ ---@class lazyvim.util.lualine local M = {} +---@param icon string +---@param status fun(): nil|"ok"|"error"|"pending" +function M.status(icon, status) + local colors = { + ok = "Special", + error = "DiagnosticError", + pending = "DiagnosticWarn", + } + return { + function() + return icon + end, + cond = function() + return status() ~= nil + end, + color = function() + return { fg = Snacks.util.color(colors[status()] or colors.ok) } + end, + } +end + +---@param name string +---@param icon? string function M.cmp_source(name, icon) + icon = icon or LazyVim.config.icons.kinds[name:sub(1, 1):upper() .. name:sub(2)] local started = false - local function status() + return M.status(icon, function() if not package.loaded["cmp"] then return end - for _, s in ipairs(require("cmp").core.sources) do + for _, s in ipairs(require("cmp").core.sources or {}) do if s.name == name then if s.source:is_available() then started = true @@ -20,25 +44,7 @@ function M.cmp_source(name, icon) return "ok" end end - end - - local colors = { - ok = LazyVim.ui.fg("Special"), - error = LazyVim.ui.fg("DiagnosticError"), - pending = LazyVim.ui.fg("DiagnosticWarn"), - } - - return { - function() - return icon or LazyVim.config.icons.kinds[name:sub(1, 1):upper() .. name:sub(2)] - end, - cond = function() - return status() ~= nil - end, - color = function() - return colors[status()] or colors.ok - end, - } + end) end ---@param component any @@ -91,6 +97,7 @@ function M.pretty_path(opts) return "" end + path = LazyVim.norm(path) local root = LazyVim.root.get({ normalize = true }) local cwd = LazyVim.root.cwd() @@ -138,7 +145,9 @@ function M.root_dir(opts) parent = true, other = true, icon = "󱉭 ", - color = LazyVim.ui.fg("Special"), + color = function() + return { fg = Snacks.util.color("Special") } + end, }, opts or {}) local function get() diff --git a/lua/lazyvim/util/mini.lua b/lua/lazyvim/util/mini.lua index 28d38f5b..e6f0d082 100644 --- a/lua/lazyvim/util/mini.lua +++ b/lua/lazyvim/util/mini.lua @@ -1,47 +1,6 @@ ---@class lazyvim.util.mini local M = {} ----@alias Mini.ai.loc {line:number, col:number} ----@alias Mini.ai.region {from:Mini.ai.loc, to:Mini.ai.loc} - --- Mini.ai indent text object --- For "a", it will include the non-whitespace line surrounding the indent block. --- "a" is line-wise, "i" is character-wise. -function M.ai_indent(ai_type) - local spaces = (" "):rep(vim.o.tabstop) - local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) - local indents = {} ---@type {line: number, indent: number, text: string}[] - - for l, line in ipairs(lines) do - if not line:find("^%s*$") then - indents[#indents + 1] = { line = l, indent = #line:gsub("\t", spaces):match("^%s*"), text = line } - end - end - - local ret = {} ---@type (Mini.ai.region | {indent: number})[] - - for i = 1, #indents do - if i == 1 or indents[i - 1].indent < indents[i].indent then - local from, to = i, i - for j = i + 1, #indents do - if indents[j].indent < indents[i].indent then - break - end - to = j - end - from = ai_type == "a" and from > 1 and from - 1 or from - to = ai_type == "a" and to < #indents and to + 1 or to - ret[#ret + 1] = { - indent = indents[i].indent, - from = { line = indents[from].line, col = ai_type == "a" and 1 or indents[from].indent + 1 }, - to = { line = indents[to].line, col = #indents[to].text }, - } - end - end - - return ret -end - -- taken from MiniExtra.gen_ai_spec.buffer function M.ai_buffer(ai_type) local start_line, end_line = 1, vim.fn.line("$") @@ -92,6 +51,7 @@ function M.ai_whichkey(opts) { "}", desc = "{} with ws" }, } + ---@type wk.Spec[] local ret = { mode = { "o", "x" } } ---@type table local mappings = vim.tbl_extend("force", {}, { diff --git a/lua/lazyvim/util/pick.lua b/lua/lazyvim/util/pick.lua index 7ab2b482..526025a3 100644 --- a/lua/lazyvim/util/pick.lua +++ b/lua/lazyvim/util/pick.lua @@ -42,10 +42,11 @@ function M.register(picker) return true end +---@return "telescope" | "fzf" function M.want() vim.g.lazyvim_picker = vim.g.lazyvim_picker or "auto" if vim.g.lazyvim_picker == "auto" then - return LazyVim.has_extra("editor.fzf") and "fzf" or "telescope" + return LazyVim.has_extra("editor.telescope") and "telescope" or "fzf" end return vim.g.lazyvim_picker end diff --git a/lua/lazyvim/util/terminal.lua b/lua/lazyvim/util/terminal.lua index b9345c1d..0e1af758 100644 --- a/lua/lazyvim/util/terminal.lua +++ b/lua/lazyvim/util/terminal.lua @@ -18,13 +18,13 @@ function M.setup(shell) -- Setting shell command flags vim.o.shellcmdflag = - "-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf8';" + "-NoLogo -NonInteractive -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf8';$PSStyle.OutputRendering='plaintext';Remove-Alias -Force -ErrorAction SilentlyContinue tee;" -- Setting shell redirection vim.o.shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' -- Setting shell pipe - vim.o.shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode' + vim.o.shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' -- Setting shell quote options vim.o.shellquote = "" diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 14d0850f..3460b0ab 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -1,129 +1,27 @@ ---@class lazyvim.util.ui local M = {} +-- foldtext for Neovim < 0.10.0 function M.foldtext() - local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf()) - local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext() - if not ret or type(ret) == "string" then - ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } } - end - table.insert(ret, { " " .. LazyVim.config.icons.misc.dots }) - - if not vim.treesitter.foldtext then - return table.concat( - vim.tbl_map(function(line) - return line[1] - end, ret), - " " - ) - end - return ret + return vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1] end ----@return {fg?:string}? -function M.fg(name) - local color = M.color(name) - return color and { fg = color } or nil -end - ----@param name string ----@param bg? boolean ----@return string? -function M.color(name, bg) - ---@type {foreground?:number}? - ---@diagnostic disable-next-line: deprecated - local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name, link = false }) - or vim.api.nvim_get_hl_by_name(name, true) - ---@diagnostic disable-next-line: undefined-field - ---@type string? - local color = nil - if hl then - if bg then - color = hl.bg or hl.background - else - color = hl.fg or hl.foreground - end - end - return color and string.format("#%06x", color) or nil -end - -M.skip_foldexpr = {} ---@type table -local skip_check = assert(vim.uv.new_check()) - +-- optimized treesitter foldexpr for Neovim >= 0.10.0 function M.foldexpr() local buf = vim.api.nvim_get_current_buf() - - -- still in the same tick and no parser - if M.skip_foldexpr[buf] then - return "0" + 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 - - -- don't use treesitter folds for terminal - if vim.bo[buf].buftype == "terminal" then - return "0" - end - - -- 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 - - local ok = pcall(vim.treesitter.get_parser, buf) - - if ok then - return vim.treesitter.foldexpr() - end - - -- no parser available, so mark it as skip - -- in the next tick, all skip marks will be reset - M.skip_foldexpr[buf] = true - skip_check:start(function() - M.skip_foldexpr = {} - skip_check:stop() - end) - return "0" -end - -function M.maximize() - ---@type {k:string, v:any}[]? - local maximized = nil - return Snacks.toggle({ - name = "Maximize", - get = function() - return maximized ~= nil - end, - set = function(state) - if state then - maximized = {} - local function set(k, v) - table.insert(maximized, 1, { k = k, v = vim.o[k] }) - vim.o[k] = v - end - set("winwidth", 999) - set("winheight", 999) - set("winminwidth", 10) - set("winminheight", 4) - vim.cmd("wincmd =") - -- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that - -- `VimLeavePre` might be another consideration? Not sure about differences between the 2 - vim.api.nvim_create_autocmd("ExitPre", { - once = true, - group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }), - desc = "Restore width/height when close Neovim while maximized", - callback = function() - M.maximize.set(false) - end, - }) - else - for _, opt in ipairs(maximized) do - vim.o[opt.k] = opt.v - end - maximized = nil - vim.cmd("wincmd =") - end - end, - }) + return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0" end return M