Compare commits

..

75 Commits

Author SHA1 Message Date
91fe7ef568 chore(main): release 11.8.0 (#3326)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-27 09:07:31 +02:00
46785526a6 feat(extras): added extra for CopilotChat.nvim 2024-05-27 08:42:30 +02:00
d3500a4a33 fix(rust): show error when rust-analyzer not found 2024-05-27 08:09:24 +02:00
f48d55a653 fix(lang/rust): Remove rust-analyzer from nvim-lspconfig (#2755)
According to the maintainer of `rustaceanvim` (see his comment [here](https://github.com/LazyVim/LazyVim/pull/2198#issuecomment-1999475044)) he says
> To pick up on this: There's a good reason rustaceanvim doesn't automatically pick up a mason.nvim installation. It will most likely be built with a different toolchain than the one your project uses, often leading to discrepancies and subtle bugs.
It's easy to configure rustaceanvim to use mason.nvim if you really want it, but I generally adhere to the YAGNI principle.

I tried locally and the removal of `rust-analyzer` from `nvim-lspconfig` doesn't
seem to have any effect on how `rustaceanvim` behaves.

I propose to remove all instances of `rust-analyzer` from `nvim-lspconfig` to avoid
any possible issues from users that don't have `rust-analyzer` installed
in their toolchain (in this case it would pick up Mason's $PATH I
believe), since they will think that since `rust-analyzer` is installed
by Mason, there shouldn't be a problem and report issues as bugs.
2024-05-27 08:04:51 +02:00
9ccdbf644c feat(git): Change Commit Log to use Lazygit (#2959)
* feat(git): Change Commit Log to use Lazygit

* fix: use gl

* fix conflicts

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2024-05-27 07:53:49 +02:00
dbed614655 fix(laygit): normalize paths. Fixes #3327 2024-05-27 05:35:47 +02:00
61dc00147b chore(build): auto-generate vimdoc 2024-05-27 05:14:23 +00:00
d23e8572e8 fix(laygit): use correct .git root for git blame 2024-05-27 07:13:43 +02:00
53911748dd fix(snippet): always use top-level snippet session. Fixes #3199 2024-05-26 18:51:14 +02:00
59204df1cb chore(main): release 11.7.0 (#3317)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-26 17:04:15 +02:00
3a30070a4c feat: lazyrc files are now a lazy.nvim feature 2024-05-26 16:49:48 +02:00
7aa37064a2 fix(lspconfig): make opts a function (#3311)
`LazyVim.config` gets evaluated during the parsing phase with `opts`
as a table (thus not taking into account changes made in the user's
personal configuration for the icons), so make `opts` a function to
defer the evaluation until the plugin loads.
2024-05-26 16:06:15 +02:00
b3373f3428 fix(lsp): added a-n, a-p for document highlights and cycling. Closes #3320 2024-05-26 16:03:13 +02:00
c9ab8224f5 fix(illuminate): s/enabed/enabled (#3313) 2024-05-26 10:38:28 +02:00
cdff9de172 fix(lsp): correct previous reference keymap description (#3314) 2024-05-26 10:33:40 +02:00
945ee7e283 chore(build): auto-generate vimdoc 2024-05-26 08:11:46 +00:00
07a137199c fix(lsp): properly get buffer for dynamic capabilities (#3315) 2024-05-26 10:11:12 +02:00
0f6ff53ce3 chore(main): release 11.6.1 (#3292)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-23 17:41:03 +02:00
10ed3082a4 fix(lsp): use proper buffer for dynamic capabilities. Fixes #3246 2024-05-23 17:39:23 +02:00
c6e8c5b450 chore(main): release 11.6.0 (#3269)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-23 07:15:41 +02:00
692aa08da7 chore(build): auto-generate vimdoc 2024-05-23 05:14:55 +00:00
46cf5347b5 fix(lsp): only enableinlay hints for when buffer is an actual file. See #3284 2024-05-23 07:14:17 +02:00
f9b31372ae fix(python): extras.lang.python to enable venv select keys on ft (#3280) 2024-05-22 19:39:16 +02:00
ad6c9bcfab Revert "fix: set markdown for LICENSE file (#3276)"
This reverts commit 1eea51606e1ec1035c440a4ca9b3eab053337a7d.
2024-05-22 19:37:23 +02:00
31f876cc4c chore(build): auto-generate vimdoc 2024-05-22 17:37:04 +00:00
1eea51606e fix: set markdown for LICENSE file (#3276) 2024-05-22 19:36:33 +02:00
ae6d8f1a34 feat(markdown): add formatter for mdx 2024-05-21 23:05:29 +02:00
9eec03d890 feat(markdown): configure conform for markdown files (#2308) 2024-05-21 23:03:43 +02:00
79608fbc4f feat(telescope): add telescope jumplist keymap (#3268) 2024-05-21 22:56:15 +02:00
3ebe30685d chore(main): release 11.5.0 (#3265)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-21 22:28:15 +02:00
e46dd4e9b2 fix(neo-tree): better icons for git staged/unstaged 2024-05-21 22:06:52 +02:00
ab4e57a4bf feat(telescope): add quickfix and telescope keymaps (#3077) 2024-05-21 20:34:28 +02:00
027d6bc2e8 fix(snippets): my nvim-snippets PR is merged, so remove work-around. That was quick :) 2024-05-21 20:26:30 +02:00
cb1e1b9c82 fix(snippets): fixes custom snippets. use my branch till nvim-snippets PR is merged. Fixes #3240 2024-05-21 20:18:20 +02:00
d73397c4aa fix(snippets): make friendly snippets a dep of nvim-snippets 2024-05-21 19:54:20 +02:00
2bae438570 fix(cmp): fix cmp's broken snippet parsing functionality. Fixes #3266 2024-05-21 19:51:13 +02:00
8ba7c64a7d feat(comments): use ts-comments.nvim instead of nvim-ts-context-commentstring on Neovim 0.10 2024-05-21 19:31:40 +02:00
55b07dee21 fix(nvim-snippets): enable global friendly-snippets. See #3240 2024-05-21 19:22:41 +02:00
8c94842b4a fix(lsp): sometimes lsp client is not fully initialized and doesnt yet have client.supports_method on 0.9.5. Fixes #3263 2024-05-21 18:23:10 +02:00
d19a004136 chore(build): auto-generate vimdoc 2024-05-21 10:01:38 +00:00
6aae99e76d chore(main): release 11.4.1 (#3256)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-21 12:00:59 +02:00
8e67bb1240 fix(java): properly pass settings to jdtls 2024-05-20 22:39:36 +02:00
50626e3092 chore(main): release 11.4.0 (#3243)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-20 21:26:18 +02:00
dd417c36cd feat(kotlin): added recommended checks 2024-05-20 21:25:29 +02:00
94c9f4cf37 feat(extras.lang): Add kotlin (#2890)
* Add kotlin lang

* Update the opts.ensure_installed

* Add the kotlin setup in nvim-dap

* Update plugins based on the review comments.

1. Remove kotlin language server from mason

2. Add optinal is true, only enabled if the user has explicitly enabled
the extra plugin.

3. Remove duplicate dependencies cause they are already defined in the
plugin.

4. Add none-ls as optional

* Update comment message
2024-05-20 21:24:50 +02:00
e5ea8abd38 feat(java): enable inlay hints. Fixes #3244 2024-05-20 20:42:25 +02:00
3db94e44a0 refactor(lsp): refactored again :) 2024-05-20 20:25:55 +02:00
0006fe7a3c refactor(cmp): snippet_resolve => snippet_preview 2024-05-20 20:05:02 +02:00
5726f3966d feat(vscode): enable more compatible plugins (#3250) 2024-05-20 19:56:14 +02:00
130d402759 chore(build): auto-generate vimdoc 2024-05-20 17:54:27 +00:00
ea1c3ad6b4 fix(bufferline): unpin bufferline with 0.9.x compatibility (#3252) 2024-05-20 19:53:49 +02:00
ac092289f5 refactor(lsp): prevent autocmd leaks 2024-05-20 00:56:25 +02:00
69751cf417 refactor(lsp): refactored on_supports_method 2024-05-20 00:35:52 +02:00
32f000754f docs: readme should be unix format. Fixes #3247 2024-05-20 00:13:18 +02:00
20e002f9f0 feat(lsp): properly update certain Neovim functionlity based on dynamic capabilities. See #3244. Fixes #3246 2024-05-20 00:08:05 +02:00
97862f4259 feat(cmp): better error handling and automatic fixing of snippets that fail to parse with native Neovim snippets 2024-05-19 22:48:01 +02:00
7d72436193 feat(cmp): resolve placeholders in generated missing snippet documentation 2024-05-19 22:47:13 +02:00
2961162eba fix(cmp): use better cmp.confirm 2024-05-19 22:46:09 +02:00
24a2a9fb0b feat(cmp): add missing documentation to snippets when needed 2024-05-19 21:47:42 +02:00
39f3ebcadf feat(cmp): move cmp autobracket support to util class 2024-05-19 21:46:54 +02:00
57a31c3920 fix(cmp): no need to setup native snippets with latest cmp 2024-05-19 21:24:23 +02:00
c264253d8f feat(toml): also recommend toml when theres toml files in the cwd 2024-05-19 21:23:49 +02:00
76033c6aa9 fix(config): add some extra LazyVim keys to lazy health 2024-05-19 21:12:51 +02:00
e0c67f6776 feat(lang): add toml (#3022)
Co-authored-by: gacallea <gacallea@users.noreply.github.com>
2024-05-19 20:47:00 +02:00
a72baa8295 chore(main): release 11.3.2 (#3232)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-19 19:46:44 +02:00
573aa226f9 fix(bufferline): pin bufferline to older version on 0.9.x for now 2024-05-19 19:44:37 +02:00
4a41012483 fix: show refactored success msg (#3233) 2024-05-19 17:45:36 +02:00
93c156a0a5 fix(yanky): load yanky earlier to avoid losing deleted lines (#3234) 2024-05-19 17:25:00 +02:00
ad22adab7d fix(cmp): only complete on <cr> when cmp is really visible. Dont wait till it might be visible. Faster and more correct imho 2024-05-19 09:58:28 +02:00
4208a09df8 fix(git): off-by-one issue in lazygit blame line (#3230) 2024-05-19 09:30:03 +02:00
e346d17812 fix(gitui): properly delete lazygit keymap at the correct time. Fixes #3227 2024-05-19 09:29:17 +02:00
74b7c9110e chore(build): auto-generate vimdoc 2024-05-19 07:24:09 +00:00
22c4eadef5 docs: Clarify vim.g.deprecation_warnings behavior (#3229)
The previous wording was a little clunky (disable disabling). This removes the double negative.
2024-05-19 09:23:37 +02:00
b0128b60bf chore(main): release 11.3.1 (#3226)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-18 23:55:59 +02:00
3a4672de3f fix(util): fixup 2024-05-18 23:54:17 +02:00
30 changed files with 991 additions and 408 deletions

View File

@ -1,5 +1,131 @@
# Changelog
## [11.8.0](https://github.com/LazyVim/LazyVim/compare/v11.7.0...v11.8.0) (2024-05-27)
### Features
* **extras:** added extra for CopilotChat.nvim ([4678552](https://github.com/LazyVim/LazyVim/commit/46785526a63b401d812de79fbbecca26414dc8e8))
* **git:** Change Commit Log to use Lazygit ([#2959](https://github.com/LazyVim/LazyVim/issues/2959)) ([9ccdbf6](https://github.com/LazyVim/LazyVim/commit/9ccdbf644cc6f38ade7fdd7e554e8da8b38091ac))
### Bug Fixes
* **lang/rust:** Remove `rust-analyzer` from `nvim-lspconfig` ([#2755](https://github.com/LazyVim/LazyVim/issues/2755)) ([f48d55a](https://github.com/LazyVim/LazyVim/commit/f48d55a653cc829e7dfecc3c01bf1ccbdf337257))
* **laygit:** normalize paths. Fixes [#3327](https://github.com/LazyVim/LazyVim/issues/3327) ([dbed614](https://github.com/LazyVim/LazyVim/commit/dbed614655fdf13436654356c0ba156d45ee7cc4))
* **laygit:** use correct .git root for git blame ([d23e857](https://github.com/LazyVim/LazyVim/commit/d23e8572e8ccc96b686ef8187aadf56ad47edd67))
* **rust:** show error when rust-analyzer not found ([d3500a4](https://github.com/LazyVim/LazyVim/commit/d3500a4a33ab87c6225d991302a72012c54b26fe))
* **snippet:** always use top-level snippet session. Fixes [#3199](https://github.com/LazyVim/LazyVim/issues/3199) ([5391174](https://github.com/LazyVim/LazyVim/commit/53911748ddc7f92793c6fec6348a9cde32159ef3))
## [11.7.0](https://github.com/LazyVim/LazyVim/compare/v11.6.1...v11.7.0) (2024-05-26)
### Features
* lazyrc files are now a lazy.nvim feature ([3a30070](https://github.com/LazyVim/LazyVim/commit/3a30070a4cd4465699d1fdd384d95bdb9935376b))
### Bug Fixes
* **illuminate:** s/enabed/enabled ([#3313](https://github.com/LazyVim/LazyVim/issues/3313)) ([c9ab822](https://github.com/LazyVim/LazyVim/commit/c9ab8224f54fb6e93050fab1043b9d1efb917c23))
* **lsp:** added a-n, a-p for document highlights and cycling. Closes [#3320](https://github.com/LazyVim/LazyVim/issues/3320) ([b3373f3](https://github.com/LazyVim/LazyVim/commit/b3373f3428f8ded19f8162a46bf9f2784299b43b))
* **lspconfig:** make `opts` a function ([#3311](https://github.com/LazyVim/LazyVim/issues/3311)) ([7aa3706](https://github.com/LazyVim/LazyVim/commit/7aa37064a2421f044c61d4baf42f71a923fab94b))
* **lsp:** correct previous reference keymap description ([#3314](https://github.com/LazyVim/LazyVim/issues/3314)) ([cdff9de](https://github.com/LazyVim/LazyVim/commit/cdff9de17226701f37069744a402b7afd9942f66))
* **lsp:** properly get buffer for dynamic capabilities ([#3315](https://github.com/LazyVim/LazyVim/issues/3315)) ([07a1371](https://github.com/LazyVim/LazyVim/commit/07a137199cde87f089776b3f992bd9ed08889cac))
## [11.6.1](https://github.com/LazyVim/LazyVim/compare/v11.6.0...v11.6.1) (2024-05-23)
### Bug Fixes
* **lsp:** use proper buffer for dynamic capabilities. Fixes [#3246](https://github.com/LazyVim/LazyVim/issues/3246) ([10ed308](https://github.com/LazyVim/LazyVim/commit/10ed3082a415b525628dfaebdcd007c7e96a5b87))
## [11.6.0](https://github.com/LazyVim/LazyVim/compare/v11.5.0...v11.6.0) (2024-05-23)
### Features
* **markdown:** add formatter for mdx ([ae6d8f1](https://github.com/LazyVim/LazyVim/commit/ae6d8f1a34fff49f9f1abf9fdd8a559c95b85cf3))
* **markdown:** configure conform for markdown files ([#2308](https://github.com/LazyVim/LazyVim/issues/2308)) ([9eec03d](https://github.com/LazyVim/LazyVim/commit/9eec03d890f7846e6f47e12ebbe369c7177fd5f1))
* **telescope:** add telescope jumplist keymap ([#3268](https://github.com/LazyVim/LazyVim/issues/3268)) ([79608fb](https://github.com/LazyVim/LazyVim/commit/79608fbc4fe7d5fbd2d238e8d8ebfce7d576b7c2))
### Bug Fixes
* **lsp:** only enableinlay hints for when buffer is an actual file. See [#3284](https://github.com/LazyVim/LazyVim/issues/3284) ([46cf534](https://github.com/LazyVim/LazyVim/commit/46cf5347b5649e856a69b9f52ccad8a671ddefc6))
* **python:** extras.lang.python to enable venv select keys on ft ([#3280](https://github.com/LazyVim/LazyVim/issues/3280)) ([f9b3137](https://github.com/LazyVim/LazyVim/commit/f9b31372aef9f1f862bf24879ba388f0d89c2349))
* set markdown for LICENSE file ([#3276](https://github.com/LazyVim/LazyVim/issues/3276)) ([1eea516](https://github.com/LazyVim/LazyVim/commit/1eea51606e1ec1035c440a4ca9b3eab053337a7d))
## [11.5.0](https://github.com/LazyVim/LazyVim/compare/v11.4.1...v11.5.0) (2024-05-21)
### Features
* **comments:** use ts-comments.nvim instead of nvim-ts-context-commentstring on Neovim 0.10 ([8ba7c64](https://github.com/LazyVim/LazyVim/commit/8ba7c64a7da9e46f2ac601919508803824208935))
* **telescope:** add quickfix and telescope keymaps ([#3077](https://github.com/LazyVim/LazyVim/issues/3077)) ([ab4e57a](https://github.com/LazyVim/LazyVim/commit/ab4e57a4bfe6107c21a25450292ef69537a2b37b))
### Bug Fixes
* **cmp:** fix cmp's broken snippet parsing functionality. Fixes [#3266](https://github.com/LazyVim/LazyVim/issues/3266) ([2bae438](https://github.com/LazyVim/LazyVim/commit/2bae438570aa96904836e56d8dad7f33eb3204ee))
* **lsp:** sometimes lsp client is not fully initialized and doesnt yet have client.supports_method on 0.9.5. Fixes [#3263](https://github.com/LazyVim/LazyVim/issues/3263) ([8c94842](https://github.com/LazyVim/LazyVim/commit/8c94842b4a613995bf4c0c79febcd74c310439d0))
* **neo-tree:** better icons for git staged/unstaged ([e46dd4e](https://github.com/LazyVim/LazyVim/commit/e46dd4e9b2ac68a5058447ef73b413605d15ae62))
* **nvim-snippets:** enable global friendly-snippets. See [#3240](https://github.com/LazyVim/LazyVim/issues/3240) ([55b07de](https://github.com/LazyVim/LazyVim/commit/55b07dee21ee5306624e16dd90c2b3c9c0f3ddde))
* **snippets:** fixes custom snippets. use my branch till nvim-snippets PR is merged. Fixes [#3240](https://github.com/LazyVim/LazyVim/issues/3240) ([cb1e1b9](https://github.com/LazyVim/LazyVim/commit/cb1e1b9c82b405fa277f1869cd04dcd9c4507412))
* **snippets:** make friendly snippets a dep of nvim-snippets ([d73397c](https://github.com/LazyVim/LazyVim/commit/d73397c4aaac74d95970ac06caffa25abd7c2af4))
* **snippets:** my nvim-snippets PR is merged, so remove work-around. That was quick :) ([027d6bc](https://github.com/LazyVim/LazyVim/commit/027d6bc2e896d453153f48a8c15db2a627698dc8))
## [11.4.1](https://github.com/LazyVim/LazyVim/compare/v11.4.0...v11.4.1) (2024-05-20)
### Bug Fixes
* **java:** properly pass settings to jdtls ([8e67bb1](https://github.com/LazyVim/LazyVim/commit/8e67bb124009e0dbf29f8e78d701d07756670278))
## [11.4.0](https://github.com/LazyVim/LazyVim/compare/v11.3.2...v11.4.0) (2024-05-20)
### Features
* **cmp:** add missing documentation to snippets when needed ([24a2a9f](https://github.com/LazyVim/LazyVim/commit/24a2a9fb0ba60e0e7c6c8c4ee95a5db7ea0e123e))
* **cmp:** better error handling and automatic fixing of snippets that fail to parse with native Neovim snippets ([97862f4](https://github.com/LazyVim/LazyVim/commit/97862f425997bf89f581e6aeceed9aac85d90432))
* **cmp:** move cmp autobracket support to util class ([39f3ebc](https://github.com/LazyVim/LazyVim/commit/39f3ebcadf49b285d8ae06270ed0c2098e7f03bd))
* **cmp:** resolve placeholders in generated missing snippet documentation ([7d72436](https://github.com/LazyVim/LazyVim/commit/7d72436193b3624a9198a5e57ec1bd7e90260c00))
* **extras.lang:** Add kotlin ([#2890](https://github.com/LazyVim/LazyVim/issues/2890)) ([94c9f4c](https://github.com/LazyVim/LazyVim/commit/94c9f4cf379e472fbd1a342ef28687dfa418dec0))
* **java:** enable inlay hints. Fixes [#3244](https://github.com/LazyVim/LazyVim/issues/3244) ([e5ea8ab](https://github.com/LazyVim/LazyVim/commit/e5ea8abd38c4b93edccd69c9ef4462377103a9c3))
* **kotlin:** added recommended checks ([dd417c3](https://github.com/LazyVim/LazyVim/commit/dd417c36cd14b5b347b4f82e9e7683b085c768fb))
* **lang:** add toml ([#3022](https://github.com/LazyVim/LazyVim/issues/3022)) ([e0c67f6](https://github.com/LazyVim/LazyVim/commit/e0c67f6776a5e6f1b72852567ce4fec16598b2da))
* **lsp:** properly update certain Neovim functionlity based on dynamic capabilities. See [#3244](https://github.com/LazyVim/LazyVim/issues/3244). Fixes [#3246](https://github.com/LazyVim/LazyVim/issues/3246) ([20e002f](https://github.com/LazyVim/LazyVim/commit/20e002f9f0e9bfdff1ffc638987fbd46b31e5f9b))
* **toml:** also recommend toml when theres toml files in the cwd ([c264253](https://github.com/LazyVim/LazyVim/commit/c264253d8fd4f068c7c2ddb5ea3c63596ab5d23f))
* **vscode:** enable more compatible plugins ([#3250](https://github.com/LazyVim/LazyVim/issues/3250)) ([5726f39](https://github.com/LazyVim/LazyVim/commit/5726f3966df7c1e9b350d24aa94f621d0ea484da))
### Bug Fixes
* **bufferline:** unpin bufferline with 0.9.x compatibility ([#3252](https://github.com/LazyVim/LazyVim/issues/3252)) ([ea1c3ad](https://github.com/LazyVim/LazyVim/commit/ea1c3ad6b46dfaeca9ff4564499b4cdc8f839610))
* **cmp:** no need to setup native snippets with latest cmp ([57a31c3](https://github.com/LazyVim/LazyVim/commit/57a31c3920bcb9baec9a6d3915506a638b0801b8))
* **cmp:** use better cmp.confirm ([2961162](https://github.com/LazyVim/LazyVim/commit/2961162ebaef96e4ffbc1e6c97dba0dc32efbbb0))
* **config:** add some extra LazyVim keys to lazy health ([76033c6](https://github.com/LazyVim/LazyVim/commit/76033c6aa92e633de968b515d3fd5f9e0447a74f))
## [11.3.2](https://github.com/LazyVim/LazyVim/compare/v11.3.1...v11.3.2) (2024-05-19)
### Bug Fixes
* **bufferline:** pin bufferline to older version on 0.9.x for now ([573aa22](https://github.com/LazyVim/LazyVim/commit/573aa226f9f9b9fb9c9886381d3fd06746b7ae6a))
* **cmp:** only complete on `&lt;cr&gt;` when cmp is really visible. Dont wait till it might be visible. Faster and more correct imho ([ad22ada](https://github.com/LazyVim/LazyVim/commit/ad22adab7d446018875de2dc96168295cad9298e))
* **git:** off-by-one issue in lazygit blame line ([#3230](https://github.com/LazyVim/LazyVim/issues/3230)) ([4208a09](https://github.com/LazyVim/LazyVim/commit/4208a09df8cd20fe491a5fdcc722c12fb07588dc))
* **gitui:** properly delete lazygit keymap at the correct time. Fixes [#3227](https://github.com/LazyVim/LazyVim/issues/3227) ([e346d17](https://github.com/LazyVim/LazyVim/commit/e346d17812de516ad0789ede49b49a8b7ba213fe))
* show refactored success msg ([#3233](https://github.com/LazyVim/LazyVim/issues/3233)) ([4a41012](https://github.com/LazyVim/LazyVim/commit/4a41012483e67ffe5ff65f31934ed668325ea131))
* **yanky:** load yanky earlier to avoid losing deleted lines ([#3234](https://github.com/LazyVim/LazyVim/issues/3234)) ([93c156a](https://github.com/LazyVim/LazyVim/commit/93c156a0a54e5400436a950263dd140ca591d3e5))
## [11.3.1](https://github.com/LazyVim/LazyVim/compare/v11.3.0...v11.3.1) (2024-05-18)
### Bug Fixes
* **util:** fixup ([3a4672d](https://github.com/LazyVim/LazyVim/commit/3a4672de3f8b6410de9fbd5b7134d5108d86f46c))
## [11.3.0](https://github.com/LazyVim/LazyVim/compare/v11.2.0...v11.3.0) (2024-05-18)

View File

@ -14,7 +14,7 @@
- **Languages**: other language extras
- new option `vim.g.deprecation_warnings` to disable deprecation warnings
Defaults to `false`. To disable, set it to `true` in your `options.lua`
Defaults to `false`. To enable deprecation warnings, set it to `true` in your `options.lua`
- `vim-illuminate` move to extras
Document highlights now use native lsp functionality by default

View File

@ -1,138 +1,138 @@
<div align="center">
<img src="https://user-images.githubusercontent.com/292349/213446185-2db63fd5-8c84-459c-9f04-e286382d6e80.png">
</div>
<hr>
<h4 align="center">
<a href="https://lazyvim.github.io/installation">Installieren</a>
·
<a href="https://lazyvim.github.io/configuration">Konfigurieren</a>
·
<a href="https://lazyvim.github.io">Dokumentation</a>
</h4>
<div align="center"><p>
<a href="https://github.com/LazyVim/LazyVim/releases/latest">
<img alt="Latest release" src="https://img.shields.io/github/v/release/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41&include_prerelease&sort=semver" />
</a>
<a href="https://github.com/LazyVim/LazyVim/pulse">
<img alt="Last commit" src="https://img.shields.io/github/last-commit/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/LazyVim/LazyVim/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=ee999f&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim/stargazers">
<img alt="Stars" src="https://img.shields.io/github/stars/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/LazyVim/LazyVim?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim">
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/LazyVim/LazyVim?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://twitter.com/intent/follow?screen_name=folke">
<img alt="follow on Twitter" src="https://img.shields.io/twitter/follow/folke?style=for-the-badge&logo=twitter&color=8aadf3&logoColor=D9E0EE&labelColor=302D41" />
</a>
</div>
LazyVim ist ein Neovim-Setup aufgebaut auf [💤 lazy.nvim](https://github.com/folke/lazy.nvim).
Es erleichtert das Anpassen und Erweitern von Ihrer Konfiguration.
Anstatt von vorne anzufangen oder eine vorgefertigte Distro zu verwenden, gibt LazyVim das beste aus
beiden Welten - die Flexibilität Ihre Konfiguration zu verändern und einzustellen wie Sie es wollen
und die Einfachheit von einem vorgefertigten Setup.
![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png)
![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png)
## ✨ Features
- 🔥 Transformiere dein Neovim in eine komplette IDE
- 💤 Passe deine Konfiguration einfach an und erweitere diese mit [lazy.nvim](https://github.com/folke/lazy.nvim)
- 🚀 Extrem schnell
- 🧹 Logische Voreinstellungen für optionen, autocmds und keymaps
- 📦 Kommt mit einem Haufen vorkonfigurierter, ready-to-use Plugins
## ⚡️ Vorraussetzungen
- Neovim >= **0.8.0** (gebraucht um mit **LuaJIT** zu bauen)
- Git >= **2.19.0** (um Teil-Klone zu unterstützen)
- eine [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
## 🚀 Einstieg
Sie können eine Startvorlage für **LazyVim** [hier](https://github.com/LazyVim/starter) finden
<details><summary>Versuchen Sie's mit Docker</summary>
```sh
docker run -w /root -it --rm alpine:edge sh -uelic '
apk add git lazygit neovim ripgrep alpine-sdk --update
git clone https://github.com/LazyVim/starter ~/.config/nvim
cd ~/.config/nvim
nvim
'
```
</details>
<details><summary>Installieren von <a href="https://github.com/LazyVim/starter">LazyVim Starter</a></summary>
- Neovim Files sichern:
```sh
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
```
- Den Starter Klonen:
```sh
git clone https://github.com/LazyVim/starter ~/.config/nvim
```
- Den `.git` Folder löschen, um die Konfiguration zu einer eigenen distro hinzuzufügen:
```sh
rm -rf ~/.config/nvim/.git
```
- Neovim starten!
```sh
nvim
```
Refer to the comments in the files on how to customize **LazyVim**.
</details>
## 📂 Dateistruktur
Die Dateien unter `config` werden automatisch und zur richtigen Zeit geladen,
sodass ein manuelles `require` nicht nötig ist.
**LazyVim** bringt Konfigurationsdatein mit, die **_vor_** Ihren eigenen geladen werden -
siehe [hier](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config)
Sie können eigene Plugins unter `lua/plugins/` hinzufügen. Alle Dateien innerhalb
dieses Ordners werden automatisch mit [lazy.nvim](https://github.com/folke/lazy.nvim)
geladen.
<pre>
~/.config/nvim
├── lua
│ ├── config
│ │ ├── autocmds.lua
│ │ ├── keymaps.lua
│ │ ├── lazy.lua
│ │ └── options.lua
│ └── plugins
│ ├── spec1.lua
│ ├── **
│ └── spec2.lua
└── init.toml
</pre>
## ⚙️ Konfiguration
Siehe [Dokumentation](https://lazyvim.github.io).
<div align="center">
<img src="https://user-images.githubusercontent.com/292349/213446185-2db63fd5-8c84-459c-9f04-e286382d6e80.png">
</div>
<hr>
<h4 align="center">
<a href="https://lazyvim.github.io/installation">Installieren</a>
·
<a href="https://lazyvim.github.io/configuration">Konfigurieren</a>
·
<a href="https://lazyvim.github.io">Dokumentation</a>
</h4>
<div align="center"><p>
<a href="https://github.com/LazyVim/LazyVim/releases/latest">
<img alt="Latest release" src="https://img.shields.io/github/v/release/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41&include_prerelease&sort=semver" />
</a>
<a href="https://github.com/LazyVim/LazyVim/pulse">
<img alt="Last commit" src="https://img.shields.io/github/last-commit/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/LazyVim/LazyVim/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=ee999f&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim/stargazers">
<img alt="Stars" src="https://img.shields.io/github/stars/LazyVim/LazyVim?style=for-the-badge&logo=starship&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/LazyVim/LazyVim?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/LazyVim/LazyVim">
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/LazyVim/LazyVim?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://twitter.com/intent/follow?screen_name=folke">
<img alt="follow on Twitter" src="https://img.shields.io/twitter/follow/folke?style=for-the-badge&logo=twitter&color=8aadf3&logoColor=D9E0EE&labelColor=302D41" />
</a>
</div>
LazyVim ist ein Neovim-Setup aufgebaut auf [💤 lazy.nvim](https://github.com/folke/lazy.nvim).
Es erleichtert das Anpassen und Erweitern von Ihrer Konfiguration.
Anstatt von vorne anzufangen oder eine vorgefertigte Distro zu verwenden, gibt LazyVim das beste aus
beiden Welten - die Flexibilität Ihre Konfiguration zu verändern und einzustellen wie Sie es wollen
und die Einfachheit von einem vorgefertigten Setup.
![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png)
![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png)
## ✨ Features
- 🔥 Transformiere dein Neovim in eine komplette IDE
- 💤 Passe deine Konfiguration einfach an und erweitere diese mit [lazy.nvim](https://github.com/folke/lazy.nvim)
- 🚀 Extrem schnell
- 🧹 Logische Voreinstellungen für optionen, autocmds und keymaps
- 📦 Kommt mit einem Haufen vorkonfigurierter, ready-to-use Plugins
## ⚡️ Vorraussetzungen
- Neovim >= **0.8.0** (gebraucht um mit **LuaJIT** zu bauen)
- Git >= **2.19.0** (um Teil-Klone zu unterstützen)
- eine [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
## 🚀 Einstieg
Sie können eine Startvorlage für **LazyVim** [hier](https://github.com/LazyVim/starter) finden
<details><summary>Versuchen Sie's mit Docker</summary>
```sh
docker run -w /root -it --rm alpine:edge sh -uelic '
apk add git lazygit neovim ripgrep alpine-sdk --update
git clone https://github.com/LazyVim/starter ~/.config/nvim
cd ~/.config/nvim
nvim
'
```
</details>
<details><summary>Installieren von <a href="https://github.com/LazyVim/starter">LazyVim Starter</a></summary>
- Neovim Files sichern:
```sh
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
```
- Den Starter Klonen:
```sh
git clone https://github.com/LazyVim/starter ~/.config/nvim
```
- Den `.git` Folder löschen, um die Konfiguration zu einer eigenen distro hinzuzufügen:
```sh
rm -rf ~/.config/nvim/.git
```
- Neovim starten!
```sh
nvim
```
Refer to the comments in the files on how to customize **LazyVim**.
</details>
## 📂 Dateistruktur
Die Dateien unter `config` werden automatisch und zur richtigen Zeit geladen,
sodass ein manuelles `require` nicht nötig ist.
**LazyVim** bringt Konfigurationsdatein mit, die **_vor_** Ihren eigenen geladen werden -
siehe [hier](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config)
Sie können eigene Plugins unter `lua/plugins/` hinzufügen. Alle Dateien innerhalb
dieses Ordners werden automatisch mit [lazy.nvim](https://github.com/folke/lazy.nvim)
geladen.
<pre>
~/.config/nvim
├── lua
│ ├── config
│ │ ├── autocmds.lua
│ │ ├── keymaps.lua
│ │ ├── lazy.lua
│ │ └── options.lua
│ └── plugins
│ ├── spec1.lua
│ ├── **
│ └── spec2.lua
└── init.toml
</pre>
## ⚙️ Konfiguration
Siehe [Dokumentation](https://lazyvim.github.io).

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 18
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 27
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -132,7 +132,7 @@ local defaults = {
}
M.json = {
version = 4,
version = 5,
data = {
version = nil, ---@type string?
news = {}, ---@type table<string, string>
@ -191,6 +191,13 @@ function M.setup(opts)
vim.cmd([[Lazy! load all]])
vim.cmd([[checkhealth]])
end, { desc = "Load all plugins and run :checkhealth" })
local health = require("lazy.health")
vim.list_extend(health.valid, {
"recommended",
"desc",
"vscode",
})
end,
})

View File

@ -136,6 +136,10 @@ map("n", "<leader>gf", function()
LazyVim.lazygit({args = { "-f", vim.trim(git_path) }})
end, { desc = "Lazygit Current File History" })
map("n", "<leader>gl", function()
LazyVim.lazygit({ args = { "log" } })
end, { desc = "Lazygit Log" })
-- quit
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })

View File

@ -36,19 +36,8 @@ return {
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = function(fallback)
if cmp.visible() then
LazyVim.create_undo()
if cmp.confirm({ select = true }) then
return
end
end
return fallback()
end,
["<S-CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = LazyVim.cmp.confirm(),
["<S-CR>"] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-CR>"] = function(fallback)
cmp.abort()
fallback()
@ -82,24 +71,26 @@ return {
for _, source in ipairs(opts.sources) do
source.group_index = source.group_index or 1
end
local parse = require("cmp.utils.snippet").parse
require("cmp.utils.snippet").parse = function(input)
local ok, ret = pcall(parse, input)
if ok then
return ret
end
return LazyVim.cmp.snippet_preview(input)
end
local cmp = require("cmp")
local Kind = cmp.lsp.CompletionItemKind
cmp.setup(opts)
cmp.event:on("confirm_done", function(event)
if not vim.tbl_contains(opts.auto_brackets or {}, vim.bo.filetype) then
return
end
local entry = event.entry
local item = entry:get_completion_item()
if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) and item.insertTextFormat ~= 2 then
local cursor = vim.api.nvim_win_get_cursor(0)
local prev_char = vim.api.nvim_buf_get_text(0, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2] + 1, {})[1]
if prev_char ~= "(" and prev_char ~= ")" then
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
vim.api.nvim_feedkeys(keys, "i", true)
end
if vim.tbl_contains(opts.auto_brackets or {}, vim.bo.filetype) then
LazyVim.cmp.auto_brackets(event.entry)
end
end)
cmp.event:on("menu_opened", function(event)
LazyVim.cmp.add_missing_snippet_docs(event.window)
end)
end,
},
@ -108,13 +99,19 @@ return {
and {
"nvim-cmp",
dependencies = {
{ "rafamadriz/friendly-snippets" },
{ "garymjr/nvim-snippets", opts = { friendly_snippets = true } },
{
"garymjr/nvim-snippets",
opts = {
friendly_snippets = true,
global_snippets = { "all", "global" },
},
dependencies = { "rafamadriz/friendly-snippets" },
},
},
opts = function(_, opts)
opts.snippet = {
expand = function(args)
vim.snippet.expand(args.body)
expand = function(item)
return LazyVim.cmp.expand(item.body)
end,
}
table.insert(opts.sources, { name = "snippets" })
@ -169,22 +166,10 @@ return {
-- comments
{
"JoosepAlviste/nvim-ts-context-commentstring",
lazy = true,
opts = {
enable_autocmd = false,
},
init = function()
if vim.fn.has("nvim-0.10") == 1 then
vim.schedule(function()
local get_option = vim.filetype.get_option
vim.filetype.get_option = function(filetype, option)
return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring()
or get_option(filetype, option)
end
end)
end
end,
"folke/ts-comments.nvim",
event = "VeryLazy",
opts = {},
enabled = vim.fn.has("nvim-0.10") == 1,
},
{
import = "lazyvim.plugins.extras.coding.mini-comment",

View File

@ -96,6 +96,12 @@ return {
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
git_status = {
symbols = {
unstaged = "󰄱",
staged = "󰱒",
},
},
},
},
config = function(_, opts)
@ -197,11 +203,14 @@ return {
{ "<leader>sG", LazyVim.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
{ "<leader>sj", "<cmd>Telescope jumplist<cr>", desc = "Jumplist" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
{ "<leader>sl", "<cmd>Telescope loclist<cr>", desc = "Location List" },
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
{ "<leader>sq", "<cmd>Telescope quickfix<cr>", desc = "Quickfix List" },
{ "<leader>sw", LazyVim.telescope("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" },
{ "<leader>sW", LazyVim.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
{ "<leader>sw", LazyVim.telescope("grep_string"), mode = "v", desc = "Selection (Root Dir)" },

View File

@ -0,0 +1,91 @@
return {
{
"CopilotC-Nvim/CopilotChat.nvim",
branch = "canary",
cmd = "CopilotChat",
opts = {
model = "gpt-4",
auto_insert_mode = true,
window = {
width = 0.4,
},
selection = function(source)
local select = require("CopilotChat.select")
return select.visual(source) or select.buffer(source)
end,
},
keys = {
{
"<leader>aa",
function()
return require("CopilotChat").toggle()
end,
desc = "Toggle (CopilotChat)",
},
{
"<leader>ax",
function()
return require("CopilotChat").clear()
end,
desc = "Clear (CopilotChat)",
},
{
"<leader>aq",
function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
end
end,
desc = "Quick Chat (CopilotChat)",
},
},
init = function()
LazyVim.on_load("which-key.nvim", function()
vim.schedule(function()
require("which-key").register({ a = { name = "+CopilotChat (AI)" } }, { prefix = "<leader>" })
end)
end)
end,
config = function(_, opts)
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "copilot-chat",
callback = function()
vim.opt_local.relativenumber = false
vim.opt_local.number = false
end,
})
require("CopilotChat").setup(opts)
end,
},
{
"nvim-telescope/telescope.nvim",
optional = true,
keys = {
-- Show help actions with telescope
{
"<leader>ad",
function()
local actions = require("CopilotChat.actions")
local help = actions.help_actions()
if not help then
LazyVim.warn("No diagnostics found on the current line")
return
end
require("CopilotChat.integrations.telescope").pick(help)
end,
desc = "Diagnostic Help (CopilotChat)",
},
-- Show prompts actions with telescope
{
"<leader>ap",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
end,
desc = "Prompt Actions (CopilotChat)",
},
},
},
}

View File

@ -10,4 +10,11 @@ return {
},
},
},
{
"JoosepAlviste/nvim-ts-context-commentstring",
lazy = true,
opts = {
enable_autocmd = false,
},
},
}

View File

@ -3,6 +3,7 @@ return {
"gbprod/yanky.nvim",
recommended = true,
desc = "Better Yank/Paste",
event = "LazyFile",
opts = {
highlight = { timer = 150 },
},

View File

@ -40,6 +40,6 @@ return {
},
{
"neovim/nvim-lspconfig",
opts = { document_highlight = { enabed = false } },
opts = { document_highlight = { enabled = false } },
},
}

View File

@ -112,6 +112,8 @@ return {
},
printf_statements = {},
print_var_statements = {},
show_success_message = true, -- shows a message with information about the refactor on success
-- i.e. [Refactor] Inlined 3 variable occurrences
},
config = function(_, opts)
require("refactoring").setup(opts)

View File

@ -118,11 +118,18 @@ return {
dap = { hotcodereplace = "auto", config_overrides = {} },
dap_main = {},
test = true,
settings = {
java = {
inlayHints = {
parameterNames = {
enabled = "all",
},
},
},
},
}
end,
config = function()
local opts = LazyVim.opts("nvim-jdtls") or {}
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")
@ -158,6 +165,7 @@ return {
init_options = {
bundles = bundles,
},
settings = opts.settings,
-- enable CMP capabilities
capabilities = LazyVim.has("cmp-nvim-lsp") and require("cmp_nvim_lsp").default_capabilities() or nil,
}, opts.jdtls)

View File

@ -0,0 +1,117 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = "kotlin",
root = {
"settings.gradle", -- Gradle (multi-project)
"settings.gradle.kts", -- Gradle (multi-project)
"build.xml", -- Ant
"pom.xml", -- Maven
"build.gradle", -- Gradle
"build.gradle.kts", -- Gradle
},
})
end,
-- Add packages(linting, debug adapter)
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "ktlint", "kotlin-debug-adapter" })
end,
},
-- Add syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
end,
},
-- Add language server
{
"neovim/nvim-lspconfig",
opts = {
servers = {
kotlin_language_server = {},
},
},
},
-- Add linting as optional
{
"mfussenegger/nvim-lint",
optional = true,
dependencies = "williamboman/mason.nvim",
opts = {
linters_by_ft = { kotlin = { "ktlint" } },
},
},
-- Add formatting as optional
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = { kotlin = { "ktlint" } },
},
},
-- Add formatting and linting as optional
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.ktlint,
nls.builtins.diagnostics.ktlint,
})
end,
},
-- Add debugger
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = "williamboman/mason.nvim",
opts = function()
local dap = require("dap")
if not dap.adapters.kotlin then
require("dap").adapters.kotlin = {
type = "executable",
command = "kotlin-debug-adapter",
options = { auto_continue_if_many_stopped = false },
}
end
dap.configurations.kotlin = {
{
type = "kotlin",
request = "launch",
name = "This file",
-- may differ, when in doubt, whatever your project structure may be,
-- it has to correspond to the class file located at `build/classes/`
-- and of course you have to build before you debug
mainClass = function()
local root = vim.fs.find("src", { path = vim.uv.cwd(), upward = true, stop = vim.env.HOME })[1] or ""
local fname = vim.api.nvim_buf_get_name(0)
-- src/main/kotlin/websearch/Main.kt -> websearch.MainKt
return fname:gsub(root, ""):gsub("main/kotlin/", ""):gsub(".kt", "Kt"):gsub("/", "."):sub(2, -1)
end,
projectRoot = "${workspaceFolder}",
jsonLogFile = "",
enableJsonLogging = false,
},
{
-- Use this for unit tests
-- First, run
-- ./gradlew --info cleanTest test --debug-jvm
-- then attach the debugger to it
type = "kotlin",
request = "attach",
name = "Attach to debugging session",
port = 5005,
args = {},
projectRoot = vim.fn.getcwd,
hostName = "localhost",
timeout = 2000,
},
}
end,
},
}

View File

@ -5,6 +5,16 @@ return {
root = "README.md",
})
end,
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
["markdown"] = { { "prettierd", "prettier" }, "markdownlint", "markdown-toc" },
["markdown.mdx"] = { { "prettierd", "prettier" }, "markdownlint", "markdown-toc" },
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)

View File

@ -127,7 +127,7 @@ return {
},
})
end,
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } },
},
{
"hrsh7th/nvim-cmp",

View File

@ -90,6 +90,12 @@ return {
},
config = function(_, opts)
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
if vim.fn.executable("rust-analyzer") == 0 then
LazyVim.error(
"**rust-analyzer** not found in PATH, please install it.\nhttps://rust-analyzer.github.io/",
{ title = "rustaceanvim" }
)
end
end,
},
@ -98,7 +104,6 @@ return {
"neovim/nvim-lspconfig",
opts = {
servers = {
rust_analyzer = {},
taplo = {
keys = {
{
@ -115,11 +120,6 @@ return {
},
},
},
setup = {
rust_analyzer = function()
return true
end,
},
},
},

View File

@ -0,0 +1,31 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = "toml",
root = "*.toml",
})
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "toml" })
end
end,
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "taplo" })
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
taplo = {},
},
},
},
}

View File

@ -1,38 +0,0 @@
--[[
Enable project-specific plugin specs.
File .lazy.lua:
is read when present in the current working directory
should return a plugin spec
has to be manually trusted for each instance of the file
This extra should be the last plugin spec added to lazy.nvim
See:
:h 'exrc'
:h :trust
--]]
local filepath = vim.fn.fnamemodify(".lazy.lua", ":p")
local file = vim.secure.read(filepath)
if not file then
return {}
end
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
local Config = require("lazy.core.config")
local lazyrc_idx = LazyVim.plugin.extra_idx("lazyrc")
if lazyrc_idx and lazyrc_idx ~= #Config.spec.modules then
LazyVim.warn({
"The `lazyrc` extra must be the last plugin spec added to **lazy.nvim**. ",
"",
"Add `{ import = 'lazyvim.plugins.extras.lazyrc' }` to file `config.lazy`. ",
"Do not use the `LazyExtras` command. ",
}, { title = "LazyVim", once = true })
end
end,
})
return loadstring(file)()

View File

@ -4,22 +4,34 @@ return {
{
"williamboman/mason.nvim",
keys = {
{ "<leader>gG",
{
"<leader>gG",
function()
LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false })
end,
desc = "GitUi (cwd)" },
{ "<leader>gg",
desc = "GitUi (cwd)",
},
{
"<leader>gg",
function()
LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false })
end,
desc = "GitUi (Root Dir)" }
desc = "GitUi (Root Dir)",
},
},
init = function()
-- delete lazygit keymap for file history
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimKeymaps",
once = true,
callback = function()
pcall(vim.keymap.del, "n", "<leader>gf")
end,
})
end,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gitui" })
-- delete lazygit keymap for file history
vim.keymap.del("n", "<leader>gf")
end,
},
}

View File

@ -3,17 +3,20 @@ if not vim.g.vscode then
end
local enabled = {
"dial.nvim",
"flit.nvim",
"lazy.nvim",
"leap.nvim",
"mini.ai",
"mini.comment",
"mini.move",
"mini.pairs",
"mini.surround",
"nvim-treesitter",
"nvim-treesitter-textobjects",
"nvim-ts-context-commentstring",
"vim-repeat",
"yanky.nvim",
"LazyVim",
}

View File

@ -10,103 +10,105 @@ return {
"williamboman/mason-lspconfig.nvim",
},
---@class PluginLspOpts
opts = {
-- options for vim.diagnostic.config()
---@type vim.diagnostic.Opts
diagnostics = {
underline = true,
update_in_insert = false,
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,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = LazyVim.config.icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = LazyVim.config.icons.diagnostics.Warn,
[vim.diagnostic.severity.HINT] = LazyVim.config.icons.diagnostics.Hint,
[vim.diagnostic.severity.INFO] = LazyVim.config.icons.diagnostics.Info,
opts = function()
return {
-- options for vim.diagnostic.config()
---@type vim.diagnostic.Opts
diagnostics = {
underline = true,
update_in_insert = false,
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,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = LazyVim.config.icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = LazyVim.config.icons.diagnostics.Warn,
[vim.diagnostic.severity.HINT] = LazyVim.config.icons.diagnostics.Hint,
[vim.diagnostic.severity.INFO] = LazyVim.config.icons.diagnostics.Info,
},
},
},
},
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
-- provide the inlay hints.
inlay_hints = {
enabled = true,
},
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
-- provide the code lenses.
codelens = {
enabled = false,
},
-- Enable lsp cursor word highlighting
document_highlight = {
enabled = true,
},
-- add any global capabilities here
capabilities = {},
-- options for vim.lsp.buf.format
-- `bufnr` and `filter` is handled by the LazyVim formatter,
-- but can be also overridden when specified
format = {
formatting_options = nil,
timeout_ms = nil,
},
-- LSP Server Settings
---@type lspconfig.options
servers = {
lua_ls = {
-- mason = false, -- set to false if you don't want this server to be installed with mason
-- Use this to add any additional keymaps
-- for specific lsp servers
---@type LazyKeysSpec[]
-- keys = {},
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
codeLens = {
enable = true,
},
completion = {
callSnippet = "Replace",
},
doc = {
privateName = { "^_" },
},
hint = {
enable = true,
setType = false,
paramType = true,
paramName = "Disable",
semicolon = "Disable",
arrayIndex = "Disable",
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
-- provide the inlay hints.
inlay_hints = {
enabled = true,
},
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
-- provide the code lenses.
codelens = {
enabled = false,
},
-- Enable lsp cursor word highlighting
document_highlight = {
enabled = true,
},
-- add any global capabilities here
capabilities = {},
-- options for vim.lsp.buf.format
-- `bufnr` and `filter` is handled by the LazyVim formatter,
-- but can be also overridden when specified
format = {
formatting_options = nil,
timeout_ms = nil,
},
-- LSP Server Settings
---@type lspconfig.options
servers = {
lua_ls = {
-- mason = false, -- set to false if you don't want this server to be installed with mason
-- Use this to add any additional keymaps
-- for specific lsp servers
---@type LazyKeysSpec[]
-- keys = {},
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
codeLens = {
enable = true,
},
completion = {
callSnippet = "Replace",
},
doc = {
privateName = { "^_" },
},
hint = {
enable = true,
setType = false,
paramType = true,
paramName = "Disable",
semicolon = "Disable",
arrayIndex = "Disable",
},
},
},
},
},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
-- tsserver = function(_, opts)
-- require("typescript").setup({ server = opts })
-- return true
-- end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
-- tsserver = function(_, opts)
-- require("typescript").setup({ server = opts })
-- return true
-- end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
}
end,
---@param opts PluginLspOpts
config = function(_, opts)
if LazyVim.has("neoconf.nvim") then
@ -121,16 +123,8 @@ return {
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
end)
local register_capability = vim.lsp.handlers["client/registerCapability"]
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
---@diagnostic disable-next-line: no-unknown
local ret = register_capability(err, res, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id)
local buffer = vim.api.nvim_get_current_buf()
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
return ret
end
LazyVim.lsp.setup()
LazyVim.lsp.on_dynamic_capability(require("lazyvim.plugins.lsp.keymaps").on_attach)
LazyVim.lsp.words.setup(opts.document_highlight)
@ -148,8 +142,8 @@ return {
if vim.fn.has("nvim-0.10") == 1 then
-- inlay hints
if opts.inlay_hints.enabled then
LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/inlayHint") then
LazyVim.lsp.on_supports_method("textDocument/inlayHint", function(client, buffer)
if vim.api.nvim_buf_is_valid(buffer) and vim.bo[buffer].buftype == "" then
LazyVim.toggle.inlay_hints(buffer, true)
end
end)
@ -157,15 +151,12 @@ return {
-- code lens
if opts.codelens.enabled and vim.lsp.codelens then
LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/codeLens") then
vim.lsp.codelens.refresh()
--- autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
buffer = buffer,
callback = vim.lsp.codelens.refresh,
})
end
LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer)
vim.lsp.codelens.refresh()
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
buffer = buffer,
callback = vim.lsp.codelens.refresh,
})
end)
end
end

View File

@ -3,8 +3,8 @@ local M = {}
---@type LazyKeysLspSpec[]|nil
M._keys = nil
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string}
---@alias LazyKeysLsp LazyKeys|{has?:string}
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string, cond?:fun():boolean}
---@alias LazyKeysLsp LazyKeys|{has?:string, cond?:fun():boolean}
---@return LazyKeysLspSpec[]
function M.get()
@ -40,8 +40,14 @@ function M.get()
desc = "Source Action",
has = "codeAction",
},
{ "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" },
{ "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight", desc = "Next Reference" },
{ "]]", function() LazyVim.lsp.words.jump(vim.v.count1) end, has = "documentHighlight",
desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end },
{ "[[", function() LazyVim.lsp.words.jump(-vim.v.count1) end, has = "documentHighlight",
desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end },
{ "<a-n>", function() LazyVim.lsp.words.jump(vim.v.count1, true) end, has = "documentHighlight",
desc = "Next Reference", cond = function() return LazyVim.lsp.words.enabled end },
{ "<a-p>", function() LazyVim.lsp.words.jump(-vim.v.count1, true) end, has = "documentHighlight",
desc = "Prev Reference", cond = function() return LazyVim.lsp.words.enabled end },
}
if LazyVim.has("inc-rename.nvim") then
M._keys[#M._keys + 1] = {
@ -72,7 +78,7 @@ function M.has(buffer, method)
return false
end
---@return (LazyKeys|{has?:string})[]
---@return LazyKeysLsp[]
function M.resolve(buffer)
local Keys = require("lazy.core.handler.keys")
if not Keys.resolve then
@ -93,8 +99,12 @@ function M.on_attach(_, buffer)
local keymaps = M.resolve(buffer)
for _, keys in pairs(keymaps) do
if not keys.has or M.has(buffer, keys.has) then
local has = not keys.has or M.has(buffer, keys.has)
local cond = not (keys.cond == false or ((type(keys.cond) == "function") and not keys.cond()))
if has and cond then
local opts = Keys.opts(keys)
opts.cond = nil
opts.has = nil
opts.silent = opts.silent ~= false
opts.buffer = buffer

118
lua/lazyvim/util/cmp.lua Normal file
View File

@ -0,0 +1,118 @@
---@class lazyvim.util.cmp
local M = {}
---@param snippet string
---@param fn fun(placeholder:Placeholder):string
---@return string
function M.snippet_replace(snippet, fn)
return snippet:gsub("%$%b{}", function(m)
local n, name = m:match("^%${(%d+):(.+)}$")
return n and fn({ n = n, text = name }) or m
end) or snippet
end
-- This function resolves nested placeholders in a snippet.
---@param snippet string
---@return string
function M.snippet_preview(snippet)
local ret = M.snippet_replace(snippet, function(placeholder)
return M.snippet_preview(placeholder.text)
end):gsub("%$0", "")
return ret
end
-- This function replaces nested placeholders in a snippet with LSP placeholders.
function M.snippet_fix(snippet)
return M.snippet_replace(snippet, function(placeholder)
return "${" .. placeholder.n .. ":" .. M.snippet_preview(placeholder.text) .. "}"
end)
end
---@param entry cmp.Entry
function M.auto_brackets(entry)
local cmp = require("cmp")
local Kind = cmp.lsp.CompletionItemKind
local item = entry:get_completion_item()
if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then
local cursor = vim.api.nvim_win_get_cursor(0)
local prev_char = vim.api.nvim_buf_get_text(0, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2] + 1, {})[1]
if prev_char ~= "(" and prev_char ~= ")" then
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
vim.api.nvim_feedkeys(keys, "i", true)
end
end
end
-- This function adds missing documentation to snippets.
-- The documentation is a preview of the snippet.
---@param window cmp.CustomEntriesView|cmp.NativeEntriesView
function M.add_missing_snippet_docs(window)
local cmp = require("cmp")
local Kind = cmp.lsp.CompletionItemKind
local entries = window:get_entries()
for _, entry in ipairs(entries) do
if entry:get_kind() == Kind.Snippet then
local item = entry:get_completion_item()
if not item.documentation and item.insertText then
item.documentation = {
kind = cmp.lsp.MarkupKind.Markdown,
value = string.format("```%s\n%s\n```", vim.bo.filetype, M.snippet_preview(item.insertText)),
}
end
end
end
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
-- This function is both faster and more reliable.
---@param opts? {select: boolean, behavior: cmp.ConfirmBehavior}
function M.confirm(opts)
local cmp = require("cmp")
opts = vim.tbl_extend("force", {
select = true,
behavior = cmp.ConfirmBehavior.Insert,
}, opts or {})
return function(fallback)
if cmp.core.view:visible() or vim.fn.pumvisible() == 1 then
LazyVim.create_undo()
if cmp.confirm(opts) then
return
end
end
return fallback()
end
end
function M.expand(snippet)
-- Native sessions don't support nested snippet sessions.
-- Always use the top-level session.
-- Otherwise, when on the first placeholder and selecting a new completion,
-- the nested session will be used instead of the top-level session.
-- See: https://github.com/LazyVim/LazyVim/issues/3199
local session = vim.snippet.active() and vim.snippet._session or nil
local ok = pcall(vim.snippet.expand, snippet)
if not ok then
local fixed = M.snippet_fix(snippet)
ok = pcall(vim.snippet.expand, fixed)
local msg = ok and "Failed to parse snippet,\nbut was able to fix it automatically." or "Failed to parse snippet."
LazyVim[ok and "warn" or "error"](
([[%s
```%s
%s
```]]):format(msg, vim.bo.filetype, snippet),
{ title = "vim.snippet" }
)
end
-- Restore top-level session when needed
if session then
vim.snippet._session = session
end
end
return M

View File

@ -17,6 +17,7 @@ local LazyUtil = require("lazy.core.util")
---@field json lazyvim.util.json
---@field lualine lazyvim.util.lualine
---@field mini lazyvim.util.mini
---@field cmp lazyvim.util.cmp
local M = {}
---@type table<string, string|string[]>
@ -193,7 +194,6 @@ end
M.CREATE_UNDO = vim.api.nvim_replace_termcodes("<c-G>u", true, true, true)
function M.create_undo()
if vim.api.nvim_get_mode().mode == "i" then
dd("undo")
vim.api.nvim_feedkeys(M.CREATE_UNDO, "n", false)
end
end

View File

@ -85,6 +85,10 @@ function M.migrate()
or extra == "lazyvim.plugins.extras.ui.treesitter-rewrite"
)
end, json.data.extras or {})
elseif json.data.version == 4 then
json.data.extras = vim.tbl_filter(function(extra)
return not (extra == "lazyvim.plugins.extras.lazyrc")
end, json.data.extras or {})
end
M.save()

View File

@ -32,7 +32,7 @@ M.theme = {
unstagedChangesColor = { fg = "DiagnosticError" },
}
M.theme_path = vim.fn.stdpath("cache") .. "/lazygit-theme.yml"
M.theme_path = LazyVim.norm(vim.fn.stdpath("cache") .. "/lazygit-theme.yml")
-- re-create config file on startup
M.dirty = true
@ -69,7 +69,7 @@ function M.open(opts)
local ok, lines = pcall(Process.exec, { "lazygit", "-cd" })
if ok then
M.config_dir = lines[1]
vim.env.LG_CONFIG_FILE = M.config_dir .. "/config.yml" .. "," .. M.theme_path
vim.env.LG_CONFIG_FILE = LazyVim.norm(M.config_dir .. "/config.yml" .. "," .. M.theme_path)
else
---@diagnostic disable-next-line: cast-type-mismatch
---@cast lines string
@ -152,9 +152,10 @@ function M.blame_line(opts)
border = "rounded",
}, opts or {})
local cursor = vim.api.nvim_win_get_cursor(0)
local line = cursor[1] - 1
local line = cursor[1]
local file = vim.api.nvim_buf_get_name(0)
local cmd = { "git", "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
local root = LazyVim.root.detectors.pattern(0, { ".git" })[1]
local cmd = { "git", "-C", root, "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
return require("lazy.util").float_cmd(cmd, opts)
end

View File

@ -5,14 +5,14 @@ local M = {}
---@param opts? lsp.Client.filter
function M.get_clients(opts)
local ret = {} ---@type lsp.Client[]
local ret = {} ---@type vim.lsp.Client[]
if vim.lsp.get_clients then
ret = vim.lsp.get_clients(opts)
else
---@diagnostic disable-next-line: deprecated
ret = vim.lsp.get_active_clients(opts)
if opts and opts.method then
---@param client lsp.Client
---@param client vim.lsp.Client
ret = vim.tbl_filter(function(client)
return client.supports_method(opts.method, { bufnr = opts.bufnr })
end, ret)
@ -21,13 +21,98 @@ function M.get_clients(opts)
return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret
end
---@param on_attach fun(client:lsp.Client, buffer)
---@param on_attach fun(client:vim.lsp.Client, buffer)
function M.on_attach(on_attach)
vim.api.nvim_create_autocmd("LspAttach", {
return vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf ---@type number
local client = vim.lsp.get_client_by_id(args.data.client_id)
on_attach(client, buffer)
if client then
return on_attach(client, buffer)
end
end,
})
end
---@type table<string, table<vim.lsp.Client, table<number, boolean>>>
M._supports_method = {}
function M.setup()
local register_capability = vim.lsp.handlers["client/registerCapability"]
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
---@diagnostic disable-next-line: no-unknown
local ret = register_capability(err, res, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id)
if client then
for buffer in pairs(client.attached_buffers) do
vim.api.nvim_exec_autocmds("User", {
pattern = "LspDynamicCapability",
data = { client_id = client.id, buffer = buffer },
})
end
end
return ret
end
M.on_attach(M._check_methods)
M.on_dynamic_capability(M._check_methods)
end
---@param client vim.lsp.Client
function M._check_methods(client, buffer)
-- don't trigger on invalid buffers
if not vim.api.nvim_buf_is_valid(buffer) then
return
end
-- don't trigger on non-listed buffers
if not vim.bo[buffer].buflisted then
return
end
-- don't trigger on nofile buffers
if vim.bo[buffer].buftype == "nofile" then
return
end
for method, clients in pairs(M._supports_method) do
clients[client] = clients[client] or {}
if not clients[client][buffer] then
if client.supports_method and client.supports_method(method, { bufnr = buffer }) then
clients[client][buffer] = true
vim.api.nvim_exec_autocmds("User", {
pattern = "LspSupportsMethod",
data = { client_id = client.id, buffer = buffer, method = method },
})
end
end
end
end
---@param fn fun(client:vim.lsp.Client, buffer):boolean?
---@param opts? {group?: integer}
function M.on_dynamic_capability(fn, opts)
return vim.api.nvim_create_autocmd("User", {
pattern = "LspDynamicCapability",
group = opts and opts.group or nil,
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
local buffer = args.data.buffer ---@type number
if client then
return fn(client, buffer)
end
end,
})
end
---@param method string
---@param fn fun(client:vim.lsp.Client, buffer)
function M.on_supports_method(method, fn)
M._supports_method[method] = M._supports_method[method] or setmetatable({}, { __mode = "k" })
return vim.api.nvim_create_autocmd("User", {
pattern = "LspSupportsMethod",
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
local buffer = args.data.buffer ---@type number
if client and method == args.data.method then
return fn(client, buffer)
end
end,
})
end
@ -89,12 +174,12 @@ function M.formatter(opts)
end,
sources = function(buf)
local clients = M.get_clients(LazyVim.merge({}, filter, { bufnr = buf }))
---@param client lsp.Client
---@param client vim.lsp.Client
local ret = vim.tbl_filter(function(client)
return client.supports_method("textDocument/formatting")
or client.supports_method("textDocument/rangeFormatting")
end, clients)
---@param client lsp.Client
---@param client vim.lsp.Client
return vim.tbl_map(function(client)
return client.name
end, ret)
@ -125,8 +210,9 @@ function M.format(opts)
end
end
---@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}, current?:boolean} 1-0 indexed
---@alias LspWord {from:{[1]:number, [2]:number}, to:{[1]:number, [2]:number}} 1-0 indexed
M.words = {}
M.words.enabled = false
M.words.ns = vim.api.nvim_create_namespace("vim_lsp_references")
---@param opts? {enabled?: boolean}
@ -135,65 +221,62 @@ function M.words.setup(opts)
if not opts.enabled then
return
end
M.words.enabled = true
local handler = vim.lsp.handlers["textDocument/documentHighlight"]
vim.lsp.handlers["textDocument/documentHighlight"] = function(err, result, ctx, config)
if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then
return
end
vim.lsp.buf.clear_references()
return handler(err, result, ctx, config)
end
M.on_attach(function(client, buf)
if client.supports_method("textDocument/documentHighlight") then
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, {
group = vim.api.nvim_create_augroup("lsp_word_" .. buf, { clear = true }),
buffer = buf,
callback = function(ev)
if not M.words.at() then
if ev.event:find("CursorMoved") then
vim.lsp.buf.clear_references()
else
vim.lsp.buf.document_highlight()
end
M.on_supports_method("textDocument/documentHighlight", function(_, buf)
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, {
group = vim.api.nvim_create_augroup("lsp_word_" .. buf, { clear = true }),
buffer = buf,
callback = function(ev)
if not ({ M.words.get() })[2] then
if ev.event:find("CursorMoved") then
vim.lsp.buf.clear_references()
else
vim.lsp.buf.document_highlight()
end
end,
})
end
end
end,
})
end)
end
---@return LspWord[]
---@return LspWord[] words, number? current
function M.words.get()
local cursor = vim.api.nvim_win_get_cursor(0)
return vim.tbl_map(function(extmark)
local ret = {
local current, ret = nil, {} ---@type number?, LspWord[]
for _, extmark in ipairs(vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true })) do
local w = {
from = { extmark[2] + 1, extmark[3] },
to = { extmark[4].end_row + 1, extmark[4].end_col },
}
if cursor[1] >= ret.from[1] and cursor[1] <= ret.to[1] and cursor[2] >= ret.from[2] and cursor[2] <= ret.to[2] then
ret.current = true
end
return ret
end, vim.api.nvim_buf_get_extmarks(0, M.words.ns, 0, -1, { details = true }))
end
---@param words? LspWord[]
---@return LspWord?, number?
function M.words.at(words)
for idx, word in ipairs(words or M.words.get()) do
if word.current then
return word, idx
ret[#ret + 1] = w
if cursor[1] >= w.from[1] and cursor[1] <= w.to[1] and cursor[2] >= w.from[2] and cursor[2] <= w.to[2] then
current = #ret
end
end
return ret, current
end
function M.words.jump(count)
local words = M.words.get()
local _, idx = M.words.at(words)
---@param count number
---@param cycle? boolean
function M.words.jump(count, cycle)
local words, idx = M.words.get()
if not idx then
return
end
local target = words[idx + count]
idx = idx + count
if cycle then
idx = (idx - 1) % #words + 1
end
local target = words[idx]
if target then
vim.api.nvim_win_set_cursor(0, target.from)
end

View File

@ -13,6 +13,7 @@ M.deprecated_extras = {
["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**",
["lazyvim.plugins.extras.ui.treesitter-rewrite"] = "Disabled `treesitter-rewrite` extra for now. Not ready yet.",
["lazyvim.plugins.extras.coding.mini-ai"] = "`mini.ai` is now a core LazyVim plugin (again)",
["lazyvim.plugins.extras.lazyrc"] = "local spec files are now a lazy.nvim feature",
}
M.deprecated_modules = {