diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 0fd91466..03fbd8ca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -16,7 +16,7 @@ body: required: true - label: I have searched the existing issues of LazyVim required: true - - label: I have searched the exsiting issues of plugins related to this issue + - label: I have searched the existing issues of plugins related to this issue required: true - type: input attributes: @@ -59,6 +59,7 @@ body: value: | -- DO NOT change the paths and don't remove the colorscheme local root = vim.fn.fnamemodify("./.repro", ":p") + -- set stdpaths to use .repro for _, name in ipairs({ "config", "data", "state", "cache" }) do vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fd094f5..964a780f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,12 @@ jobs: - name: Install Neovim shell: bash run: | - wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.deb -O /tmp/nvim.deb - sudo dpkg -i /tmp/nvim.deb + mkdir -p /tmp/nvim + wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage + cd /tmp/nvim + chmod a+x ./nvim.appimage + ./nvim.appimage --appimage-extract + echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH - name: Run Tests run: | nvim --version @@ -55,7 +59,7 @@ jobs: with: release-type: simple package-name: LazyVim - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: tag stable versions if: ${{ steps.release.outputs.release_created }} run: | diff --git a/.neoconf.json b/.neoconf.json index aa1b504a..7c480874 100644 --- a/.neoconf.json +++ b/.neoconf.json @@ -7,7 +7,7 @@ }, "neoconf": { "plugins": { - "sumneko_lua": { + "lua_ls": { "enabled": true } } diff --git a/CHANGELOG.md b/CHANGELOG.md index cef370e6..2519346e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,322 @@ # Changelog +## [2.5.0](https://github.com/LazyVim/LazyVim/compare/v2.4.3...v2.5.0) (2023-04-19) + + +### Features + +* **lsp:** added support for setting global lsp client capabilities ([ac10516](https://github.com/LazyVim/LazyVim/commit/ac1051686bcff8377f1d99228bcbe64530ec384a)) + +## [2.4.3](https://github.com/LazyVim/LazyVim/compare/v2.4.2...v2.4.3) (2023-04-19) + + +### Bug Fixes + +* **treesitter:** de-duplicate langs in endure_installed. Fixes [#628](https://github.com/LazyVim/LazyVim/issues/628) ([1d2c97c](https://github.com/LazyVim/LazyVim/commit/1d2c97cbda099c76ee132ee5019a3f80fd88f8ed)) + +## [2.4.2](https://github.com/LazyVim/LazyVim/compare/v2.4.1...v2.4.2) (2023-04-19) + + +### Bug Fixes + +* **diagnostics:** deepcopy diagnostic params. Fixes [#621](https://github.com/LazyVim/LazyVim/issues/621) ([1caa27b](https://github.com/LazyVim/LazyVim/commit/1caa27ba4acb04ebbc64a91de242574790dcf92f)) + +## [2.4.1](https://github.com/LazyVim/LazyVim/compare/v2.4.0...v2.4.1) (2023-04-19) + + +### Bug Fixes + +* **lsp:** properly check that diagnostics virtual_text is a table. Fixes [#618](https://github.com/LazyVim/LazyVim/issues/618) ([17fe32e](https://github.com/LazyVim/LazyVim/commit/17fe32e428bbade6f91770814e8748425bfc01a2)) + +## [2.4.0](https://github.com/LazyVim/LazyVim/compare/v2.3.0...v2.4.0) (2023-04-18) + + +### Features + +* **dap:** add more keybindings and lualine component ([#612](https://github.com/LazyVim/LazyVim/issues/612)) ([38ad79d](https://github.com/LazyVim/LazyVim/commit/38ad79d5485c083afdb04b1fb9f9683403a6d7bd)) +* **diagnostics:** added support for setting prefix = "icons". Check the docs on how to enable ([01a1b8e](https://github.com/LazyVim/LazyVim/commit/01a1b8e80db55963f281cf36674cf1c174e2f50e)) +* **diagnostics:** show diagnostics source when more than one source is reporting diagnostics ([06c38c5](https://github.com/LazyVim/LazyVim/commit/06c38c52a91bb1dcc2dec2d79d6e13606324be77)) + +## [2.3.0](https://github.com/LazyVim/LazyVim/compare/v2.2.1...v2.3.0) (2023-04-17) + + +### Features + +* **dap:** add step out, rebind step over ([#605](https://github.com/LazyVim/LazyVim/issues/605)) ([cfaf3b0](https://github.com/LazyVim/LazyVim/commit/cfaf3b054e1a68ea0f7a73d51a0f6c27395198e9)) + +## [2.2.1](https://github.com/LazyVim/LazyVim/compare/v2.2.0...v2.2.1) (2023-04-17) + + +### Bug Fixes + +* **telescope:** typo ([a94f7af](https://github.com/LazyVim/LazyVim/commit/a94f7afdebc56338b5552de11561646d8ef4b5be)) + +## [2.2.0](https://github.com/LazyVim/LazyVim/compare/v2.1.0...v2.2.0) (2023-04-17) + + +### Features + +* **noice:** added keymap to dismiss all noice messages ([0155de0](https://github.com/LazyVim/LazyVim/commit/0155de00ab76e7ffc1d8232c10121f24c4e84cd9)) + + +### Bug Fixes + +* **lsp:** gT => gy. keymap for goto type definition. Fixes [#554](https://github.com/LazyVim/LazyVim/issues/554) ([0cb8974](https://github.com/LazyVim/LazyVim/commit/0cb89742216d4c73fa944ab9e2fcd21793ed7a78)) +* **telescope:** consistent keymap description. Fixes [#600](https://github.com/LazyVim/LazyVim/issues/600) ([df9547f](https://github.com/LazyVim/LazyVim/commit/df9547f43223fd89ccc7c1fa5088623ca3c2cfd4)) + +## [2.1.0](https://github.com/LazyVim/LazyVim/compare/v2.0.0...v2.1.0) (2023-04-16) + + +### Features + +* added extra for dap ([bc14e02](https://github.com/LazyVim/LazyVim/commit/bc14e02a1ff43f1a69d2a6755faeec8a5ec26ac9)) +* **dap:** added extra for dap nlua ([f562d1d](https://github.com/LazyVim/LazyVim/commit/f562d1d19761c3419380c3b175fd00a440ff0932)) +* **which-key:** easier integration for which-key group names ([df94a04](https://github.com/LazyVim/LazyVim/commit/df94a044ec656c456067b550531a62e80a5be420)) + + +### Bug Fixes + +* **dap:** added DapInstall and DapUninstall to cmds ([feaeab9](https://github.com/LazyVim/LazyVim/commit/feaeab9fcabf005cbf18b846d2ab0129a73837a9)) + +## [2.0.0](https://github.com/LazyVim/LazyVim/compare/v1.24.0...v2.0.0) (2023-04-16) + + +### ⚠ BREAKING CHANGES + +* **treesitter:** rename help to vimdoc ([#521](https://github.com/LazyVim/LazyVim/issues/521)) + +### Features + +* **autocmds:** add checkhealth filetype to close_with_q list ([#512](https://github.com/LazyVim/LazyVim/issues/512)) ([1defd5f](https://github.com/LazyVim/LazyVim/commit/1defd5f67008c695a7d99d72bc50432de5eaed3a)) +* **keymaps:** Get rename command from inc_rename configuration ([#579](https://github.com/LazyVim/LazyVim/issues/579)) ([a099b2d](https://github.com/LazyVim/LazyVim/commit/a099b2d3ab3ff3bafb075c101e2b2a48b44fe869)) +* **telescope:** add document/workspace diagnostics and todo/fixme telescope keymaps ([#557](https://github.com/LazyVim/LazyVim/issues/557)) ([98775f5](https://github.com/LazyVim/LazyVim/commit/98775f56312110c640be7e9d43ecc766a116427a)) +* **telescope:** use the new dynamic workspace symbols ([#577](https://github.com/LazyVim/LazyVim/issues/577)) ([6e01e85](https://github.com/LazyVim/LazyVim/commit/6e01e8560e4ca197bc56666e9b969fe75d91b310)) + + +### Bug Fixes + +* **autocmds:** don't auto create dirs for urls. Fixes [#583](https://github.com/LazyVim/LazyVim/issues/583) ([7476da7](https://github.com/LazyVim/LazyVim/commit/7476da78117b032bc34d0130e6b1f9c7eea77073)) +* **config:** options cant be disabled with lazyvim config. Fixes [#566](https://github.com/LazyVim/LazyVim/issues/566) ([02c5e8d](https://github.com/LazyVim/LazyVim/commit/02c5e8d953fff68b832a8f22a83428bd229ddc59)) +* **format:** ignore vim.b.autoformat when formatting using key bindings. Fixes [#575](https://github.com/LazyVim/LazyVim/issues/575) ([bef36bb](https://github.com/LazyVim/LazyVim/commit/bef36bb2fd7493828529ed49a071d240602b164d)) +* **lazygit:** dont use `<esc>` for normal more for laygit to prevent delays on ``. Fixes [#567](https://github.com/LazyVim/LazyVim/issues/567) ([a9e9204](https://github.com/LazyVim/LazyVim/commit/a9e9204daec3355015bbe677068198cf38cd2cf3)) +* **lsp:** gt -> gT. Fixes [#554](https://github.com/LazyVim/LazyVim/issues/554) ([2d8116e](https://github.com/LazyVim/LazyVim/commit/2d8116ef674ad4b2a3ba62f590ff32d1c30a2f9c)) + + +### Code Refactoring + +* **treesitter:** rename help to vimdoc ([#521](https://github.com/LazyVim/LazyVim/issues/521)) ([078250a](https://github.com/LazyVim/LazyVim/commit/078250a114b45785743fcfe0482c7667f304f92c)) + +## [1.24.0](https://github.com/LazyVim/LazyVim/compare/v1.23.0...v1.24.0) (2023-03-31) + + +### Features + +* **autocmds:** add auto create dir ([#493](https://github.com/LazyVim/LazyVim/issues/493)) ([ed48b85](https://github.com/LazyVim/LazyVim/commit/ed48b85dbea30a15518b4caa58cbf5d2b54f97a0)) +* **lualine:** added lazy extension ([79fe045](https://github.com/LazyVim/LazyVim/commit/79fe0455a02b791eae26e9934fdbaf075d9522ae)) + +## [1.23.0](https://github.com/LazyVim/LazyVim/compare/v1.22.0...v1.23.0) (2023-03-25) + + +### Features + +* **treesitter:** use Python indents as they've improved greatly ([#490](https://github.com/LazyVim/LazyVim/issues/490)) ([59eb198](https://github.com/LazyVim/LazyVim/commit/59eb19835f3b291912d46e5e8ea762367201cbf1)) + +## [1.22.0](https://github.com/LazyVim/LazyVim/compare/v1.21.2...v1.22.0) (2023-03-23) + + +### Features + +* **mason:** compatibility with the new mason registry ([df5cbfd](https://github.com/LazyVim/LazyVim/commit/df5cbfdbeccfa37ee391be8b49da7a4a4b6dcc40)) +* **treesitter:** add luadoc ([#469](https://github.com/LazyVim/LazyVim/issues/469)) ([ade4342](https://github.com/LazyVim/LazyVim/commit/ade4342c42c47f4eadae3e6267ac35f546692158)) + + +### Bug Fixes + +* **autocmd:** remove query from q-to-quit autocmd ([#473](https://github.com/LazyVim/LazyVim/issues/473)) ([b0cef1f](https://github.com/LazyVim/LazyVim/commit/b0cef1f506e4bbaa8cfe07990ee49518d8e13f3d)) +* **mason:** removed flake8. You can add it back in your own configs if you need it or add ruff_lsp ([381ee0a](https://github.com/LazyVim/LazyVim/commit/381ee0a9fc536a4e1ed9ad3e089f10129f0d50a0)) + +## [1.21.2](https://github.com/LazyVim/LazyVim/compare/v1.21.1...v1.21.2) (2023-03-19) + + +### Bug Fixes + +* **alpha:** use `AlphaFooter` highlight for footer section ([#461](https://github.com/LazyVim/LazyVim/issues/461)) ([a7b25e1](https://github.com/LazyVim/LazyVim/commit/a7b25e13fa645dea848047e0dda54db9b254ec8e)) + +## [1.21.1](https://github.com/LazyVim/LazyVim/compare/v1.21.0...v1.21.1) (2023-03-17) + + +### Bug Fixes + +* **config:** compat with lazy.nvim ([501474e](https://github.com/LazyVim/LazyVim/commit/501474e42166e199e61b4e704b266bd0a9625a65)) + +## [1.21.0](https://github.com/LazyVim/LazyVim/compare/v1.20.0...v1.21.0) (2023-03-17) + + +### Features + +* **lsp:** added keymap to see source actions with `<leader>cA` (useful for tsserver and others) ([9f5a0f1](https://github.com/LazyVim/LazyVim/commit/9f5a0f1bd847663deea9cb48a178b85d7bdb3ec6)) + +## [1.20.0](https://github.com/LazyVim/LazyVim/compare/v1.19.0...v1.20.0) (2023-03-17) + + +### Features + +* **lsp:** make lsp work when mason-lspconfig is disabled. Fixed [#445](https://github.com/LazyVim/LazyVim/issues/445) ([c10e550](https://github.com/LazyVim/LazyVim/commit/c10e550639caef68146d122d9bc4a66f2f38650a)) + + +### Bug Fixes + +* **icons:** replace obsolete icons ([#441](https://github.com/LazyVim/LazyVim/issues/441)) ([cec000d](https://github.com/LazyVim/LazyVim/commit/cec000dfd863bd681a5195eb71c0797f5d030062)) + +## [1.19.0](https://github.com/LazyVim/LazyVim/compare/v1.18.2...v1.19.0) (2023-03-14) + + +### Features + +* **mini-starter:** add Session restore to starter menu ([#421](https://github.com/LazyVim/LazyVim/issues/421)) ([bcdcfab](https://github.com/LazyVim/LazyVim/commit/bcdcfab020308a90c8cb347cf63d318f4cb05941)) + + +### Bug Fixes + +* **core:** set `cond=true` for LazyVim ([df6ac59](https://github.com/LazyVim/LazyVim/commit/df6ac591baf8ab2ef40e3ddcaf34ed124f42469f)) + +## [1.18.2](https://github.com/LazyVim/LazyVim/compare/v1.18.1...v1.18.2) (2023-03-12) + + +### Bug Fixes + +* **lsp:** allow `silent=false` for lsp keymaps. Fixes [#414](https://github.com/LazyVim/LazyVim/issues/414) ([a28885b](https://github.com/LazyVim/LazyVim/commit/a28885be3f2428c993a3133f283d5648b6fa6b94)) + +## [1.18.1](https://github.com/LazyVim/LazyVim/compare/v1.18.0...v1.18.1) (2023-03-10) + + +### Bug Fixes + +* **prettier:** extend ensure_installed instead of overwriting it. Fixes [#406](https://github.com/LazyVim/LazyVim/issues/406) ([9f30a2e](https://github.com/LazyVim/LazyVim/commit/9f30a2e03a66775bcbf3601e7a46e0aacf1bb291)) + +## [1.18.0](https://github.com/LazyVim/LazyVim/compare/v1.17.1...v1.18.0) (2023-03-10) + + +### Features + +* **copilot:** better sorting for cmp sources when using copilot ([23ba877](https://github.com/LazyVim/LazyVim/commit/23ba877bb07f17a44af60e341be9f246ece5c133)) +* **eslint:** added an extra for eslint lsp that runs EslintFixAll before saving a buffer ([75299da](https://github.com/LazyVim/LazyVim/commit/75299da24c4982f0d3ec6c9c3fbad7f94aa9eb72)) +* **null-ls:** added .neoconf.json to null-ls root_dir ([5aad574](https://github.com/LazyVim/LazyVim/commit/5aad5749a745f928b0a1954917467f04c84e8a07)) +* **null-ls:** added fish_indent and fish diag ([8f3834b](https://github.com/LazyVim/LazyVim/commit/8f3834bc13c6ca5acf82c1e44c5c250799d683a0)) +* **prettierd:** added an extra for prettierd with null-ls ([aa8bae0](https://github.com/LazyVim/LazyVim/commit/aa8bae07aea7a81e2f507e1920fd84a6b83c34ad)) +* **shfmt:** added shfmt to null-ls and mason ([c407ddf](https://github.com/LazyVim/LazyVim/commit/c407ddfe8ab36608ba1fe1c1d4f6723cce506a01)) +* **typescript:** added null-ls typescript code actions ([5bb2314](https://github.com/LazyVim/LazyVim/commit/5bb23147877b3fcbe4cc28c0a7d820bcb52bb141)) + + +### Bug Fixes + +* **eslint:** only run EslintFixAll on buffers where eslint is attached ([f1dbd09](https://github.com/LazyVim/LazyVim/commit/f1dbd097e4461c322d6982c925d605a6ed57a4b2)) + +## [1.17.1](https://github.com/LazyVim/LazyVim/compare/v1.17.0...v1.17.1) (2023-03-05) + + +### Bug Fixes + +* **copilot:** confirm with replace for copilot only ([079d396](https://github.com/LazyVim/LazyVim/commit/079d3967d03d47b95bdec10bb2621db1c4a07dce)) + +## [1.17.0](https://github.com/LazyVim/LazyVim/compare/v1.16.0...v1.17.0) (2023-03-05) + + +### Features + +* add luap to nvim-treesitter ensure_installed ([#383](https://github.com/LazyVim/LazyVim/issues/383)) ([f441faa](https://github.com/LazyVim/LazyVim/commit/f441faad03501198a4a1ed52bca48aac3c7158c3)) +* **autocmds:** added 'query' to close_with_q autocmd ([2e951e4](https://github.com/LazyVim/LazyVim/commit/2e951e4f4414ba88895b1ddc3a189dd3213be404)) + + +### Bug Fixes + +* **mason:** removed installing of shellcheck and shfmt. Use bashls instead ([e7a515e](https://github.com/LazyVim/LazyVim/commit/e7a515e5481e6cd2f00e8da523454713009f12a5)) +* rename more appropriately (also a typo) ([#378](https://github.com/LazyVim/LazyVim/issues/378)) ([9dd2487](https://github.com/LazyVim/LazyVim/commit/9dd2487529d6012088e86f089c445549aa4b37bb)) +* **typescript:** enable function call completion snippets ([6fec14e](https://github.com/LazyVim/LazyVim/commit/6fec14e5082363ab87efb169f312a396e5e2dbb7)) + +## [1.16.0](https://github.com/LazyVim/LazyVim/compare/v1.15.0...v1.16.0) (2023-03-03) + + +### Features + +* **neo-tree:** added expanders ([57c2dcb](https://github.com/LazyVim/LazyVim/commit/57c2dcb3a35704a849ea8ba210f963c22fb6d1ce)) + +## [1.15.0](https://github.com/LazyVim/LazyVim/compare/v1.14.1...v1.15.0) (2023-03-03) + + +### Features + +* **cmp:** added `<s-CR>` to confirm completion with replace ([3a52307](https://github.com/LazyVim/LazyVim/commit/3a523075057f346451075454a96b1ca355f7592a)) +* **copilot:** added an extra to enable copilot. `{import = "lazyvim.plugins.extras.coding.copilot"}` ([368c65e](https://github.com/LazyVim/LazyVim/commit/368c65e14b1155d051b4aa6bac91808a2bc5f5ba)) + + +### Bug Fixes + +* **luasnip:** added note that jsregexp is optional if it fails to build ([04a60e2](https://github.com/LazyVim/LazyVim/commit/04a60e251b1c2437ad6d0a237fbacc1848d4aac1)) + +## [1.14.1](https://github.com/LazyVim/LazyVim/compare/v1.14.0...v1.14.1) (2023-03-02) + + +### Bug Fixes + +* **alpha:** larger session icon. Fixes [#365](https://github.com/LazyVim/LazyVim/issues/365) ([d00aade](https://github.com/LazyVim/LazyVim/commit/d00aade8dbb7720b3f501424814ec3dd357b7373)) +* **leap:** unpin leap ([16e4a3f](https://github.com/LazyVim/LazyVim/commit/16e4a3f8fd5929c9ef2cf2c12b076bcbc947ab36)) +* **luasnip:** dont build jsregexp on Windows ([f6f3ce4](https://github.com/LazyVim/LazyVim/commit/f6f3ce4a9b7a797653dc290b9485d2ce970af871)) + +## [1.14.0](https://github.com/LazyVim/LazyVim/compare/v1.13.1...v1.14.0) (2023-03-01) + + +### Features + +* **telescope:** Add open selected with trouble keymap ([#357](https://github.com/LazyVim/LazyVim/issues/357)) ([f9b7406](https://github.com/LazyVim/LazyVim/commit/f9b7406df96cf1fad5685865ffef5ec725573f1c)) + +## [1.13.1](https://github.com/LazyVim/LazyVim/compare/v1.13.0...v1.13.1) (2023-03-01) + + +### Bug Fixes + +* **leap:** pin leap for now till flit issue is fixed ([787ceab](https://github.com/LazyVim/LazyVim/commit/787ceab0311ce20cc37ef2a81dabafdc09f1c624)) + +## [1.13.0](https://github.com/LazyVim/LazyVim/compare/v1.12.1...v1.13.0) (2023-02-28) + + +### Features + +* **keymaps:** Add previous/next trouble/quickfix item keymap `[q`, `]q` ([#299](https://github.com/LazyVim/LazyVim/issues/299)) ([59fa836](https://github.com/LazyVim/LazyVim/commit/59fa83653f3d4f1911e220c2a96a7e47878a16bc)) + + +### Bug Fixes + +* **git-signs:** larger icons for delete ([4b37723](https://github.com/LazyVim/LazyVim/commit/4b37723558e45f14c3e8d05fc84ad3a701b9faf0)) +* **icons:** replace obsolete Nerd icons ([#331](https://github.com/LazyVim/LazyVim/issues/331)) ([588dc5d](https://github.com/LazyVim/LazyVim/commit/588dc5dd65aa3881122aa4e59710de6722423251)) +* **lsp:** only map lsp goto definition when client has definitionProvider ([#348](https://github.com/LazyVim/LazyVim/issues/348)) ([5abb10b](https://github.com/LazyVim/LazyVim/commit/5abb10b5ab3c2c5462f699fc98f618f39543f8f4)) +* **luasnips:** make install_jsregexp ([bd62cbe](https://github.com/LazyVim/LazyVim/commit/bd62cbe370a72525a29790c710d3f213c3e184e4)) +* **mini-indentscope:** disable indentscope for filetypes during init. Fixes [#318](https://github.com/LazyVim/LazyVim/issues/318) ([d97bf66](https://github.com/LazyVim/LazyVim/commit/d97bf66eed76c91eac11c81dad69aff9f632b214)) +* **treesitter:** always install all built-in treesitter parsers to prevent queriy issues ([fc765e9](https://github.com/LazyVim/LazyVim/commit/fc765e9e3d1fe8dc9f84087a73f12a2b3bbe60c4)) + +## [1.12.1](https://github.com/LazyVim/LazyVim/compare/v1.12.0...v1.12.1) (2023-02-20) + + +### Bug Fixes + +* **treesitter:** nil check [#312](https://github.com/LazyVim/LazyVim/issues/312) ([#313](https://github.com/LazyVim/LazyVim/issues/313)) ([0eef2c2](https://github.com/LazyVim/LazyVim/commit/0eef2c2f29cc95b6a3da8c9dced215acf60147dc)) + +## [1.12.0](https://github.com/LazyVim/LazyVim/compare/v1.11.0...v1.12.0) (2023-02-20) + + +### Features + +* persist pinned tabs ([#304](https://github.com/LazyVim/LazyVim/issues/304)) ([6b9f0c0](https://github.com/LazyVim/LazyVim/commit/6b9f0c0c3c16b39a0764632402707822a084af50)) +* **telescope:** add `<leader>sS` for `:Telescope lsp_workspace_symbols` ([#309](https://github.com/LazyVim/LazyVim/issues/309)) ([cccdc1c](https://github.com/LazyVim/LazyVim/commit/cccdc1cacfa486edcaf67111aa3c6fd9a626ae1f)) + + +### Bug Fixes + +* **illuminate:** always set refernce keymaps on the buffer as well to properly overwrite ftplugin mappings. Fixes [#292](https://github.com/LazyVim/LazyVim/issues/292) ([a0cf00c](https://github.com/LazyVim/LazyVim/commit/a0cf00c81b3a4a352cdc26c94112d9a5827881e1)) +* **mini.surround:** don't create empty keymaps. Fixes [#296](https://github.com/LazyVim/LazyVim/issues/296) ([8e84dcf](https://github.com/LazyVim/LazyVim/commit/8e84dcf85c8a73ebcf6ade6b7b77544f468f1dfa)) +* **treesitter:** disable indent only for python right now ([de6a28b](https://github.com/LazyVim/LazyVim/commit/de6a28b781e8a06e4f70c913539c97260392131a)) +* **treesitter:** disable treesitter indent by default, since it has too many issues. See [#297](https://github.com/LazyVim/LazyVim/issues/297) ([329a2da](https://github.com/LazyVim/LazyVim/commit/329a2daff493abd2bd5c8fedbf0dfa13039d3931)) + ## [1.11.0](https://github.com/LazyVim/LazyVim/compare/v1.10.0...v1.11.0) (2023-02-17) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index a72ac194..e96a3e1f 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 February 18 +*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 April 19 ============================================================================== Table of Contents *LazyVim-table-of-contents* @@ -9,46 +9,29 @@ Table of Contents *LazyVim-table-of-contents* - File Structure |LazyVim-file-structure| - Configuration |LazyVim-configuration| - - -
- -

- -Install +Install · -Configure +Configure · -Docs +Docs + + + + + + + + + + + + + + -

-
- -Latest release - - -Last commit - - -License - - -Stars - - -Issues - - -Repo Size - - -follow on Twitter - -
LazyVim is a Neovim setup powered by lazy.nvim to make it easy to customize and extend @@ -57,15 +40,6 @@ using a pre-made distro, LazyVim offers the best of both worlds - the flexibility to tweak your config as needed, along with the convenience of a pre-configured setup. -
- -

image

-
- -
- -

image

-
FEATURES *LazyVim-features* @@ -82,7 +56,7 @@ REQUIREMENTS *LazyVim-requirements* - Neovim >= **0.8.0** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) -- a Nerd Font **_(optional)_** +- a Nerd Font **(optional)** GETTING STARTED *LazyVim-getting-started* @@ -90,7 +64,7 @@ GETTING STARTED *LazyVim-getting-started* You can find a starter template for **LazyVim** here -Try it with Docker +Try it with Docker ~ >sh docker run -w /root -it --rm alpine:edge sh -uelic ' @@ -101,8 +75,7 @@ Try it with Docker ' < - -Install the LazyVim Starter +Install the LazyVim Starter ~ - Make a backup of your current Neovim files: @@ -124,44 +97,36 @@ Install the LazyVim Starter < Refer to the comments in the files on how to customize **LazyVim**. - ------------------------------------------------------------------------------ +There’s a great video created by @elijahmanor + with a walkthrough to get started. -There’s a great video created by elijahmano -with a walkthrough to get started. - - + FILE STRUCTURE *LazyVim-file-structure* The files under config will be automatically loaded at the appropriate time, so you don’t need to require those files manually. **LazyVim** comes with a set -of default config files that will be loaded **_before_** your own. See here +of default config files that will be loaded **before** your own. See here You can add your custom plugin specs under `lua/plugins/`. All files there will be automatically loaded by lazy.nvim -
-~/.config/nvim
- lua
-    config
-       autocmds.lua
-       keymaps.lua
-       lazy.lua
-       options.lua
-    plugins
-        spec1.lua
-        
-        spec2.lua
- init.lua
-
CONFIGURATION *LazyVim-configuration* Refer to the docs +============================================================================== +1. Links *LazyVim-links* + +1. *image*: https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png +2. *image*: https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png +3. *@elijahmanor*: +4. *Watch the video*: https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg + Generated by panvimdoc vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 22557977..639a01c8 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -42,15 +42,16 @@ vim.api.nvim_create_autocmd("BufReadPost", { vim.api.nvim_create_autocmd("FileType", { group = augroup("close_with_q"), pattern = { - "qf", + "PlenaryTestPopup", "help", + "lspinfo", "man", "notify", - "lspinfo", + "qf", "spectre_panel", "startuptime", "tsplayground", - "PlenaryTestPopup", + "checkhealth", }, callback = function(event) vim.bo[event.buf].buflisted = false @@ -67,3 +68,15 @@ vim.api.nvim_create_autocmd("FileType", { vim.opt_local.spell = true end, }) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("auto_create_dir"), + callback = function(event) + if event.match:match("^%w%w+://") then + return + end + local file = vim.loop.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, +}) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 1caa03b9..71bdb54f 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -14,14 +14,22 @@ local defaults = { defaults = { autocmds = true, -- lazyvim.config.autocmds keymaps = true, -- lazyvim.config.keymaps - options = true, -- lazyvim.config.options + -- lazyvim.config.options can't be configured here since that's loaded before lazyvim setup + -- if you want to disable loading options, add `package.loaded["lazyvim.config.options"] = true` to the top of your init.lua }, -- icons used by other plugins icons = { + dap = { + Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", + }, diagnostics = { Error = " ", Warn = " ", - Hint = " ", + Hint = " ", Info = " ", }, git = { @@ -42,7 +50,7 @@ local defaults = { Event = " ", Field = " ", File = " ", - Folder = " ", + Folder = " ", Function = " ", Interface = " ", Key = " ", @@ -50,7 +58,7 @@ local defaults = { Method = " ", Module = " ", Namespace = " ", - Null = "ﳠ ", + Null = " ", Number = " ", Object = " ", Operator = " ", @@ -132,15 +140,16 @@ function M.load(name) end, { msg = "Failed loading " .. mod, on_error = function(msg) - local modpath = require("lazy.core.cache").find(mod) - if modpath then - Util.error(msg) + local info = require("lazy.core.cache").find(mod) + if info == nil or (type(info) == "table" and #info == 0) then + return end + Util.error(msg) end, }) end -- always load lazyvim, then user file - if M.defaults[name] then + if M.defaults[name] or name == "options" then _load("lazyvim.config." .. name) end _load("config." .. name) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 11c76ce9..0d8759b6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -64,8 +64,7 @@ map( { desc = "Redraw / clear hlsearch / diff update" } ) -map("n", "gw", "*N") -map("x", "gw", "*N") +map({ "n", "x" }, "gw", "*N", { desc = "Search word under cursor" }) -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) @@ -96,6 +95,11 @@ map("n", "fn", "enew", { desc = "New File" }) map("n", "xl", "lopen", { desc = "Location List" }) map("n", "xq", "copen", { desc = "Quickfix List" }) +if not Util.has("trouble.nvim") then + map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) + map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) +end + -- stylua: ignore start -- toggle options @@ -108,8 +112,8 @@ local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) -- lazygit -map("n", "gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root() }) end, { desc = "Lazygit (root dir)" }) -map("n", "gG", function() Util.float_term({ "lazygit" }) end, { desc = "Lazygit (cwd)" }) +map("n", "gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false }) end, { desc = "Lazygit (root dir)" }) +map("n", "gG", function() Util.float_term({ "lazygit" }, {esc_esc = false}) end, { desc = "Lazygit (cwd)" }) -- quit map("n", "qq", "qa", { desc = "Quit all" }) @@ -122,7 +126,7 @@ end -- floating terminal map("n", "ft", function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = "Terminal (root dir)" }) map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) -map("t", "", "", {desc = "Enter Normal Mode"}) +map("t", "", "", { desc = "Enter Normal Mode" }) -- windows map("n", "ww", "p", { desc = "Other window" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index bf3efb7c..0d302003 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -1,5 +1,4 @@ -- This file is automatically loaded by plugins.config - vim.g.mapleader = " " vim.g.maplocalleader = " " @@ -28,7 +27,7 @@ opt.scrolloff = 4 -- Lines of context opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.shiftround = true -- Round indent opt.shiftwidth = 2 -- Size of an indent -opt.shortmess:append { W = true, I = true, c = true } +opt.shortmess:append({ W = true, I = true, c = true }) opt.showmode = false -- Dont show mode since we have a statusline opt.sidescrolloff = 8 -- Columns of context opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time @@ -49,7 +48,7 @@ opt.wrap = false -- Disable line wrap if vim.fn.has("nvim-0.9.0") == 1 then opt.splitkeep = "screen" - opt.shortmess:append { C = true } + opt.shortmess:append({ C = true }) end -- Fix markdown indentation settings diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 522b207e..fc05bc3b 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -3,6 +3,9 @@ return { -- snippets { "L3MON4D3/LuaSnip", + build = (not jit.os:find("Windows")) + and "echo -e 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp" + or nil, dependencies = { "rafamadriz/friendly-snippets", config = function() @@ -57,6 +60,10 @@ return { [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = "nvim_lsp" }, diff --git a/lua/lazyvim/plugins/core.lua b/lua/lazyvim/plugins/core.lua index 47a4773f..847d8470 100644 --- a/lua/lazyvim/plugins/core.lua +++ b/lua/lazyvim/plugins/core.lua @@ -2,5 +2,5 @@ require("lazyvim.config").init() return { { "folke/lazy.nvim", version = "*" }, - { "LazyVim/LazyVim", priority = 10000, lazy = false, config = true, version = "*" }, + { "LazyVim/LazyVim", priority = 10000, lazy = false, config = true, cond = true, version = "*" }, } diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 2178cc5a..5ba69477 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -46,6 +46,14 @@ return { [""] = "none", }, }, + default_component_configs = { + indent = { + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + }, }, }, @@ -65,7 +73,7 @@ return { version = false, -- telescope did only one release, so use HEAD for now keys = { { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, - { "/", Util.telescope("live_grep"), desc = "Find in Files (Grep)" }, + { "/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { ":", "Telescope command_history", desc = "Command History" }, { "", Util.telescope("files"), desc = "Find Files (root dir)" }, -- find @@ -81,7 +89,8 @@ return { { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, { "sc", "Telescope command_history", desc = "Command History" }, { "sC", "Telescope commands", desc = "Commands" }, - { "sd", "Telescope diagnostics", desc = "Diagnostics" }, + { "sd", "Telescope diagnostics bufnr=0", desc = "Document diagnostics" }, + { "sD", "Telescope diagnostics", desc = "Workspace diagnostics" }, { "sg", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { "sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, { "sh", "Telescope help_tags", desc = "Help Pages" }, @@ -112,6 +121,24 @@ return { }), desc = "Goto Symbol", }, + { + "sS", + Util.telescope("lsp_dynamic_workspace_symbols", { + symbols = { + "Class", + "Function", + "Method", + "Constructor", + "Interface", + "Module", + "Struct", + "Trait", + "Field", + "Property", + }, + }), + desc = "Goto Symbol (Workspace)", + }, }, opts = { defaults = { @@ -122,6 +149,9 @@ return { [""] = function(...) return require("trouble.providers.telescope").open_with_trouble(...) end, + [""] = function(...) + return require("trouble.providers.telescope").open_selected_with_trouble(...) + end, [""] = function() Util.telescope("find_files", { no_ignore = true })() end, @@ -188,11 +218,7 @@ return { event = "VeryLazy", opts = { plugins = { spelling = true }, - }, - config = function(_, opts) - local wk = require("which-key") - wk.setup(opts) - local keymaps = { + defaults = { mode = { "n", "v" }, ["g"] = { name = "+goto" }, ["gz"] = { name = "+surround" }, @@ -209,11 +235,12 @@ return { ["u"] = { name = "+ui" }, ["w"] = { name = "+windows" }, ["x"] = { name = "+diagnostics/quickfix" }, - } - if Util.has("noice.nvim") then - keymaps["sn"] = { name = "+noice" } - end - wk.register(keymaps) + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) end, }, @@ -225,8 +252,8 @@ return { signs = { add = { text = "▎" }, change = { text = "▎" }, - delete = { text = "契" }, - topdelete = { text = "契" }, + delete = { text = "" }, + topdelete = { text = "" }, changedelete = { text = "▎" }, untracked = { text = "▎" }, }, @@ -306,6 +333,28 @@ return { { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, { "xL", "TroubleToggle loclist", desc = "Location List (Trouble)" }, { "xQ", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, + { + "[q", + function() + if require("trouble").is_open() then + require("trouble").previous({ skip_groups = true, jump = true }) + else + vim.cmd.cprev() + end + end, + desc = "Previous trouble/quickfix item", + }, + { + "]q", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + vim.cmd.cnext() + end + end, + desc = "Next trouble/quickfix item", + }, }, }, @@ -322,6 +371,7 @@ return { { "xt", "TodoTrouble", desc = "Todo (Trouble)" }, { "xT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme (Trouble)" }, { "st", "TodoTelescope", desc = "Todo" }, + { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, }, }, } diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua new file mode 100644 index 00000000..1c024a10 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -0,0 +1,76 @@ +return { + + -- copilot + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + build = ":Copilot auth", + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + }, + }, + + -- 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 + require("lazyvim.util").on_attach(function(client) + if client.name == "copilot" then + copilot_cmp._on_insert_enter() + end + end) + end, + }, + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + + table.insert(opts.sources, 1, { name = "copilot", group_index = 2 }) + + local confirm = opts.mapping[""] + local confirm_copilot = cmp.mapping.confirm({ + select = true, + behavior = cmp.ConfirmBehavior.Replace, + }) + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = function(...) + local entry = cmp.get_selected_entry() + if entry and entry.source.name == "copilot" then + return confirm_copilot(...) + end + return confirm(...) + end, + }) + opts.sorting = { + priority_weight = 2, + comparators = { + require("copilot_cmp.comparators").prioritize, + + -- Below is the default comparitor list and order for nvim-cmp + cmp.config.compare.offset, + -- cmp.config.compare.scopes, --this is commented in nvim-cmp too + cmp.config.compare.exact, + cmp.config.compare.score, + cmp.config.compare.recently_used, + cmp.config.compare.locality, + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + }, + } + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua new file mode 100644 index 00000000..c8699395 --- /dev/null +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -0,0 +1,103 @@ +return { + "mfussenegger/nvim-dap", + + dependencies = { + + -- fancy UI for the debugger + { + "rcarriga/nvim-dap-ui", + -- stylua: ignore + keys = { + { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + }, + opts = {}, + config = function(_, opts) + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({}) + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close({}) + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close({}) + end + end, + }, + + -- virtual text for the debugger + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + + -- which key integration + { + "folke/which-key.nvim", + opts = { + defaults = { + ["d"] = { name = "+debug" }, + ["da"] = { name = "+adapters" }, + }, + }, + }, + + -- mason.nvim integration + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + }, + }, + }, + }, + + -- stylua: ignore + keys = { + { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "dj", function() require("dap").down() end, desc = "Down" }, + { "dk", function() require("dap").up() end, desc = "Up" }, + { "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" }, + { "dr", function() require("dap").repl.open() end, desc = "Repl" }, + { "ds", function() require("dap").session() end, desc = "Session" }, + { "dt", function() require("dap").terminate() end, desc = "Terminate" }, + { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + }, + + config = function() + local Config = require("lazyvim.config") + vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" }) + + for name, sign in pairs(Config.icons.dap) do + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) + end + end, +} diff --git a/lua/lazyvim/plugins/extras/dap/nlua.lua b/lua/lazyvim/plugins/extras/dap/nlua.lua new file mode 100644 index 00000000..1d9eb650 --- /dev/null +++ b/lua/lazyvim/plugins/extras/dap/nlua.lua @@ -0,0 +1,27 @@ +return { + "mfussenegger/nvim-dap", + + dependencies = { + { + "jbyuki/one-small-step-for-vimkind", + -- stylua: ignore + keys = { + { "daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" }, + { "dal", function() require("osv").run_this() end, desc = "Adapter Lua" }, + }, + config = function() + local dap = require("dap") + dap.adapters.nlua = function(callback, config) + callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 }) + end + dap.configurations.lua = { + { + type = "nlua", + request = "attach", + name = "Attach to running Neovim instance", + }, + } + end, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/formatting/prettier.lua b/lua/lazyvim/plugins/extras/formatting/prettier.lua new file mode 100644 index 00000000..e16b9805 --- /dev/null +++ b/lua/lazyvim/plugins/extras/formatting/prettier.lua @@ -0,0 +1,15 @@ +return { + { + "williamboman/mason.nvim", + opts = function(_, opts) + table.insert(opts.ensure_installed, "prettierd") + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + table.insert(opts.sources, nls.builtins.formatting.prettierd) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 54860936..baabd58c 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -17,7 +17,14 @@ return { opts = { -- make sure mason installs the server servers = { - tsserver = {}, + ---@type lspconfig.options.tsserver + tsserver = { + settings = { + completions = { + completeFunctionCalls = true, + }, + }, + }, }, setup = { tsserver = function(_, opts) @@ -25,6 +32,7 @@ return { if client.name == "tsserver" then -- stylua: ignore vim.keymap.set("n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + -- stylua: ignore vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) end end) @@ -34,4 +42,10 @@ return { }, }, }, + { + "jose-elias-alvarez/null-ls.nvim", + opts = function(_, opts) + table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions")) + end, + }, } diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua new file mode 100644 index 00000000..ee7f040f --- /dev/null +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -0,0 +1,27 @@ +return { + { + "neovim/nvim-lspconfig", + -- other settings removed for brevity + opts = { + servers = { + eslint = { + settings = { + -- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root + workingDirectory = { mode = "auto" }, + }, + }, + }, + setup = { + eslint = function() + vim.api.nvim_create_autocmd("BufWritePre", { + callback = function(event) + if require("lspconfig.util").get_active_client_by_name(event.buf, "eslint") then + vim.cmd("EslintFixAll") + end + end, + }) + end, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/ui/mini-starter.lua b/lua/lazyvim/plugins/extras/ui/mini-starter.lua index 0a75d3dd..f677cf5e 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-starter.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-starter.lua @@ -35,6 +35,7 @@ return { new_section("Lazy", "Lazy", "Config"), new_section("New file", "ene | startinsert", "Built-in"), new_section("Quit", "qa", "Built-in"), + new_section("Session restore", [[lua require("persistence").load()]], "Session"), }, content_hooks = { starter.gen_hook.adding_bullet(pad .. "░ ", false), diff --git a/lua/lazyvim/plugins/lsp/format.lua b/lua/lazyvim/plugins/lsp/format.lua index 3605fc54..06841e21 100644 --- a/lua/lazyvim/plugins/lsp/format.lua +++ b/lua/lazyvim/plugins/lsp/format.lua @@ -18,9 +18,10 @@ function M.toggle() end end -function M.format() +---@param opts? {force?:boolean} +function M.format(opts) local buf = vim.api.nvim_get_current_buf() - if vim.b.autoformat == false then + if vim.b.autoformat == false and not (opts and opts.force) then return end local ft = vim.bo[buf].filetype diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 75d7fb72..42176c59 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -21,9 +21,18 @@ return { diagnostics = { underline = true, update_in_insert = false, - virtual_text = { spacing = 4, prefix = "●" }, + virtual_text = { + spacing = 4, + source = "if_many", + prefix = "●", + -- this will set set the prefix to a function that returns the diagnostics icon based on the severity + -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported + -- prefix = "icons", + }, severity_sort = true, }, + -- add any global capabilities here + capabilities = {}, -- Automatically format on save autoformat = true, -- options for vim.lsp.buf.format @@ -65,7 +74,7 @@ return { }, }, ---@param opts PluginLspOpts - config = function(plugin, opts) + config = function(_, opts) -- setup autoformat require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat -- setup formatting and keymaps @@ -79,10 +88,29 @@ return { name = "DiagnosticSign" .. name vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end - vim.diagnostic.config(opts.diagnostics) + + if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then + opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●" + or function(diagnostic) + local icons = require("lazyvim.config").icons.diagnostics + for d, icon in pairs(icons) do + if diagnostic.severity == vim.diagnostic.severity[d:upper()] then + return icon + end + end + end + end + + vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) local servers = opts.servers - local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + opts.capabilities or {} + ) local function setup(server) local server_opts = vim.tbl_deep_extend("force", { @@ -101,23 +129,19 @@ return { require("lspconfig")[server].setup(server_opts) end - -- temp fix for lspconfig rename - -- https://github.com/neovim/nvim-lspconfig/pull/2439 - local mappings = require("mason-lspconfig.mappings.server") - if not mappings.lspconfig_to_package.lua_ls then - mappings.lspconfig_to_package.lua_ls = "lua-language-server" - mappings.package_to_lspconfig["lua-language-server"] = "lua_ls" + -- get all the servers that are available thourgh mason-lspconfig + local have_mason, mlsp = pcall(require, "mason-lspconfig") + local all_mslp_servers = {} + if have_mason then + all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) end - local mlsp = require("mason-lspconfig") - local available = mlsp.get_available_servers() - local ensure_installed = {} ---@type string[] for server, server_opts in pairs(servers) do if server_opts then server_opts = server_opts == true and {} or server_opts -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig - if server_opts.mason == false or not vim.tbl_contains(available, server) then + if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then setup(server) else ensure_installed[#ensure_installed + 1] = server @@ -125,8 +149,10 @@ return { end end - require("mason-lspconfig").setup({ ensure_installed = ensure_installed }) - require("mason-lspconfig").setup_handlers({ setup }) + if have_mason then + mlsp.setup({ ensure_installed = ensure_installed }) + mlsp.setup_handlers({ setup }) + end end, }, @@ -138,10 +164,13 @@ return { opts = function() local nls = require("null-ls") return { + root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"), sources = { - -- nls.builtins.formatting.prettierd, + nls.builtins.formatting.fish_indent, + nls.builtins.diagnostics.fish, nls.builtins.formatting.stylua, - nls.builtins.diagnostics.flake8, + nls.builtins.formatting.shfmt, + -- nls.builtins.diagnostics.flake8, }, } end, @@ -156,21 +185,27 @@ return { opts = { ensure_installed = { "stylua", - "shellcheck", "shfmt", - "flake8", + -- "flake8", }, }, ---@param opts MasonSettings | {ensure_installed: string[]} - config = function(plugin, opts) + config = function(_, opts) require("mason").setup(opts) local mr = require("mason-registry") - for _, tool in ipairs(opts.ensure_installed) do - local p = mr.get_package(tool) - if not p:is_installed() then - p:install() + local function ensure_installed() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end end end + if mr.refresh then + mr.refresh(ensure_installed) + else + ensure_installed() + end end, }, } diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index e47bf464..de97d08d 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -5,18 +5,20 @@ M._keys = nil ---@return (LazyKeys|{has?:string})[] function M.get() - local format = require("lazyvim.plugins.lsp.format").format + local format = function() + require("lazyvim.plugins.lsp.format").format({ force = true }) + end if not M._keys then ---@class PluginLspKeys -- stylua: ignore M._keys = { { "cd", vim.diagnostic.open_float, desc = "Line Diagnostics" }, { "cl", "LspInfo", desc = "Lsp Info" }, - { "gd", "Telescope lsp_definitions", desc = "Goto Definition" }, + { "gd", "Telescope lsp_definitions", desc = "Goto Definition", has = "definition" }, { "gr", "Telescope lsp_references", desc = "References" }, { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, { "gI", "Telescope lsp_implementations", desc = "Goto Implementation" }, - { "gt", "Telescope lsp_type_definitions", desc = "Goto Type Definition" }, + { "gy", "Telescope lsp_type_definitions", desc = "Goto T[y]pe Definition" }, { "K", vim.lsp.buf.hover, desc = "Hover" }, { "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, @@ -26,16 +28,31 @@ function M.get() { "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" }, { "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" }, { "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" }, - { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "cf", format, desc = "Format Document", has = "documentFormatting" }, { "cf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" }, + { "ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, + { + "cA", + function() + vim.lsp.buf.code_action({ + context = { + only = { + "source", + }, + diagnostics = {}, + }, + }) + end, + desc = "Source Action", + has = "codeAction", + } } if require("lazyvim.util").has("inc-rename.nvim") then M._keys[#M._keys + 1] = { "cr", function() - require("inc_rename") - return ":IncRename " .. vim.fn.expand("") + local inc_rename = require("inc_rename") + return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") end, expr = true, desc = "Rename", @@ -66,7 +83,7 @@ function M.on_attach(client, buffer) local opts = Keys.opts(keys) ---@diagnostic disable-next-line: no-unknown opts.has = nil - opts.silent = true + opts.silent = opts.silent ~= false opts.buffer = buffer vim.keymap.set(keys.mode or "n", keys[1], keys[2], opts) end diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 83eb574b..d1eeb191 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -14,7 +14,7 @@ return { local enabled = false if opts.textobjects then for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do - if opts.textobjects[mod].enable then + if opts.textobjects[mod] and opts.textobjects[mod].enable then enabled = true break end @@ -28,20 +28,22 @@ return { }, keys = { { "", desc = "Increment selection" }, - { "", desc = "Schrink selection", mode = "x" }, + { "", desc = "Decrement selection", mode = "x" }, }, ---@type TSConfig opts = { highlight = { enable = true }, - indent = { enable = true, disable = { "python" } }, + indent = { enable = true }, context_commentstring = { enable = true, enable_autocmd = false }, ensure_installed = { "bash", - "help", + "c", "html", "javascript", "json", "lua", + "luadoc", + "luap", "markdown", "markdown_inline", "python", @@ -50,6 +52,7 @@ return { "tsx", "typescript", "vim", + "vimdoc", "yaml", }, incremental_selection = { @@ -64,6 +67,17 @@ return { }, ---@param opts TSConfig config = function(_, opts) + if type(opts.ensure_installed) == "table" then + ---@type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) + end require("nvim-treesitter.configs").setup(opts) end, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index a83b1b03..4cb3bb1b 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -83,7 +83,7 @@ return { { "nvim-lualine/lualine.nvim", event = "VeryLazy", - opts = function(plugin) + opts = function() local icons = require("lazyvim.config").icons local function fg(name) @@ -98,7 +98,7 @@ return { options = { theme = "auto", globalstatus = true, - disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } }, + disabled_filetypes = { statusline = { "dashboard", "alpha" } }, }, sections = { lualine_a = { "mode" }, @@ -122,17 +122,23 @@ return { }, }, lualine_x = { + -- stylua: ignore + { + function() return " " .. require("dap").status() end, + cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, + color = fg("Debug"), + }, -- 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 = fg("Statement") + color = fg("Statement"), }, -- 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 = fg("Constant") , + color = fg("Constant"), }, { require("lazy.status").updates, cond = require("lazy.status").has_updates, color = fg("Special") }, { @@ -154,7 +160,7 @@ return { end, }, }, - extensions = { "neo-tree" }, + extensions = { "neo-tree", "lazy" }, } end, }, @@ -182,13 +188,15 @@ return { symbol = "│", options = { try_as_border = true }, }, - config = function(_, opts) + init = function() vim.api.nvim_create_autocmd("FileType", { pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" }, callback = function() vim.b.miniindentscope_disable = true end, }) + end, + config = function(_, opts) require("mini.indentscope").setup(opts) end, }, @@ -197,6 +205,17 @@ return { { "folke/noice.nvim", event = "VeryLazy", + dependencies = { + -- which key integration + { + "folke/which-key.nvim", + opts = function(_, opts) + if require("lazyvim.util").has("noice.nvim") then + opts.defaults["sn"] = { name = "+noice" } + end + end, + }, + }, opts = { lsp = { override = { @@ -216,6 +235,7 @@ return { { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, }, @@ -238,23 +258,23 @@ return { dashboard.section.header.val = vim.split(logo, "\n") dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", ":Telescope find_files "), + dashboard.button("f", " " .. " Find file", ":Telescope find_files "), dashboard.button("n", " " .. " New file", ":ene startinsert "), - dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), + dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), dashboard.button("p", " " .. " Projects", ":Telescope projects "), dashboard.button("g", " " .. " Find text", ":Telescope live_grep "), dashboard.button("c", " " .. " Config", ":e $MYVIMRC "), - dashboard.button("s", "勒" .. " Restore Session", [[:lua require("persistence").load() ]]), - dashboard.button("l", "鈴" .. " Lazy", ":Lazy"), + dashboard.button("s", " " .. " Restore Session", [[:lua require("persistence").load() ]]), + dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy"), dashboard.button("q", " " .. " Quit", ":qa"), } for _, button in ipairs(dashboard.section.buttons.val) do button.opts.hl = "AlphaButtons" button.opts.hl_shortcut = "AlphaShortcut" end - dashboard.section.footer.opts.hl = "Type" dashboard.section.header.opts.hl = "AlphaHeader" dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.section.footer.opts.hl = "AlphaFooter" dashboard.opts.layout[1].val = 8 return dashboard end, diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 5c094ffc..a5bb572f 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -13,7 +13,7 @@ return { { "folke/persistence.nvim", event = "BufReadPre", - opts = { options = { "buffers", "curdir", "tabpages", "winsize", "help" } }, + opts = { options = { "buffers", "curdir", "tabpages", "winsize", "help", "globals" } }, -- stylua: ignore keys = { { "qs", function() require("persistence").load() end, desc = "Restore Session" }, diff --git a/lua/lazyvim/util/build.lua b/lua/lazyvim/util/build.lua index 872930f3..e76098a4 100644 --- a/lua/lazyvim/util/build.lua +++ b/lua/lazyvim/util/build.lua @@ -54,6 +54,23 @@ function M.keymaps() end end) + Util.walk(root .. "/lua/lazyvim/plugins/extras", function(path, name, t) + if t == "file" and name:find("%.lua$") then + local modname = path:gsub(".*/lua/", ""):gsub("/", "."):gsub("%.lua$", "") + local extra_doc = "/plugins/extras/" .. modname:gsub("lazyvim%.plugins%.extras%.", "") + local extra = require("lazy.core.plugin").Spec.new({ import = modname }) + Util.foreach(extra.plugins, function(name, plugin) + group = ("[%s](%s)\nPart of [%s](%s)"):format(plugin.name, plugin.url, modname, extra_doc) + for _, key in ipairs(plugin.keys or {}) do + if type(key) == "table" and key.desc then + local desc = key.desc or "" + map(key.mode or "n", key[1], key[2], { desc = desc }) + end + end + end) + end + end) + ---@type string[] local lines = {} @@ -256,7 +273,7 @@ function M.plugins(path) local function find_plugins(node) if node:type() == "string" then - local text = vim.treesitter.query.get_node_text(node, source):sub(2, -2) + local text = vim.treesitter.get_node_text(node, source):sub(2, -2) if text:find("/") and #node:parent():field("name") == 0 then local plugin_node = node:parent():parent() if plugin_node:named_child(0):field("value")[1]:id() ~= node:id() then diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 1ef39a78..0bbabae2 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -102,15 +102,17 @@ function M.telescope(builtin, opts) end end --- FIXME: create a togglable terminal -- Opens a floating terminal (interactive by default) ---@param cmd? string[]|string ----@param opts? LazyCmdOptions|{interactive?:boolean} +---@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false} function M.float_term(cmd, opts) opts = vim.tbl_deep_extend("force", { size = { width = 0.9, height = 0.9 }, }, opts or {}) - require("lazy.util").float_term(cmd, opts) + local float = require("lazy.util").float_term(cmd, opts) + if opts.esc_esc == false then + vim.keymap.set("t", "", "", { buffer = float.buf, nowait = true }) + end end ---@param silent boolean?