Compare commits

..

78 Commits

Author SHA1 Message Date
23a0004a86 chore(main): release 9.8.0 (#1642)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-10 00:13:40 +02:00
02bc41412a fix(telescope): remove telescope folding hack since PR with fix has been merged upstream 2023-10-09 23:32:34 +02:00
44984dcbe2 feat(telescope): add telescope-fzf-native by default. Will only be enabled if make is on your system. 2023-10-09 22:28:09 +02:00
0955129796 fix(project): make sure to load telescope extension after telescope ran setup 2023-10-09 22:11:17 +02:00
4e8a88fc1f fix(util): dont schedule on_load 2023-10-09 22:09:39 +02:00
9a4b9aa804 refactor(edgy): make telescope optional 2023-10-09 20:16:02 +02:00
9357ea2881 fix(edgy): typo 2023-10-09 20:12:45 +02:00
fb70170058 feat(edgy): when edgy is enabled, use edgy's main window for Telescope to open results in 2023-10-09 20:12:07 +02:00
c0ce89fe62 feat(telescope): smarter way to determine the window to open a file in 2023-10-09 20:11:45 +02:00
5d44c976a7 fix(autocmds): extra check that we didn't do last_loc more than once for the buffer 2023-10-09 20:11:05 +02:00
6b857f1de6 feat(options): set virtualedit=block by default 2023-10-09 17:49:00 +02:00
9670c8a400 feat(dashboard): show loaded/count plugins on dashboard instead of just count 2023-10-09 12:49:33 +02:00
2abb5907ef style(config): added tracking for colorscheme 2023-10-09 12:49:09 +02:00
2c658a374d style(cmp): dont include cmp-nvim-lsp as a dep of lspconfig 2023-10-09 11:34:58 +02:00
4fe7ccae73 build(format): sort requires 2023-10-09 11:34:23 +02:00
0a05888d99 fix(cmp): set default group_index to 1 to prevent issues with custom sources 2023-10-09 10:05:57 +02:00
d894556c37 feat(cmp): ctrl+CR will abort cmp and enter a new line 2023-10-09 09:51:55 +02:00
efbe4e5793 chore(main): release 9.7.0 (#1638)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-09 09:18:33 +02:00
1779858426 fix(black): remove unknown blackd from conform (#1640) 2023-10-09 09:15:15 +02:00
cc8397ade3 chore(build): auto-generate vimdoc 2023-10-09 07:14:25 +00:00
b05783de8c feat(codeium): added lualine component with codeium status similar to copilot 2023-10-09 09:13:14 +02:00
22271cdbbc refactor(copilot): dont use deprecated get_clients 2023-10-09 09:12:48 +02:00
bff3a99697 feat(cmp): removed priority comparator in favor of source priorities for copilot/codeium 2023-10-09 09:12:29 +02:00
302c1ff66e feat(codeium): use actual codeium icon 2023-10-09 08:25:02 +02:00
eddd3af351 feat(cmp): added custom comparator to prioritize AI sources like copilot and codeium 2023-10-09 00:06:58 +02:00
dd55cbdc99 fix(lualine): only show statusline as soon as lualine loads 2023-10-08 23:27:46 +02:00
838ce85ad6 fix(bufferline): fix bufferline when restoring a session 2023-10-08 23:00:25 +02:00
5219cad564 feat(black): added an extra for black with none-ls & conform.nvim (#1245)
* feat(black): added an extra for black with null-ls

* fix: update to none-ls/conform
2023-10-08 22:34:06 +02:00
de93848f58 fix(cmp): properly set cmp group_index to fix issues with copilot and other sources (#1639) 2023-10-08 22:32:03 +02:00
502d32490b fix(options): set sessionoptions the same as persistence 2023-10-08 20:24:45 +02:00
51e25a94b4 fix(plugins): make sure init specs are loaded first 2023-10-08 20:24:45 +02:00
1eac633c4f perf(util): closure for get_clients to prevent loading vim.lsp cascade early 2023-10-08 20:24:45 +02:00
3f67ac3c73 chore(main): release 9.6.0 (#1632)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-08 19:53:20 +02:00
33c677a55e fix(yaml): yaml schemas are a dict, not a list, so merge properly. Fixes #1636 2023-10-08 19:29:00 +02:00
e11a3cbe80 fix(config): trigger LazyFile additionally on BufWritePre for saving unnamed files 2023-10-08 15:17:50 +02:00
639a6e7545 feat(extra): add extra util.dot that configures multiple ft and treesitter langs when needed 2023-10-08 13:45:57 +02:00
80e6696343 chore(main): release 9.5.0 (#1631)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-08 12:58:53 +02:00
eebdceca17 fix(util): fixup typo vim.lsp.get_active_clients 2023-10-08 12:56:27 +02:00
c9bbb922e5 feat(treesitter): add diff, jsonc and yaml by default 2023-10-08 12:56:27 +02:00
6e3fb589d5 chore(main): release 9.4.1 (#1628)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-08 11:42:13 +02:00
4e0a05808c fix(config): dont append LazyVim early to the rtp when bootstrapping 2023-10-08 11:33:03 +02:00
6b837e9165 style: lua annotations and handle deprecated methods 2023-10-08 10:45:38 +02:00
21ee35f710 fix(util): fixed lsp willRenameFiles support check 2023-10-08 10:44:17 +02:00
25f3587f3f refactor(keymaps): move safe keymap.set wrapper to util and add message not to use it in a personal config 2023-10-08 10:28:01 +02:00
0cdc23a51d chore(main): release 9.4.0 (#1622)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-08 10:17:20 +02:00
89d0805fb8 chore(build): auto-generate vimdoc 2023-10-08 08:16:15 +00:00
1bc78272da feat(keymaps): added support for lazy's per-mode keymap disabling 2023-10-08 10:15:28 +02:00
af9e452854 feat(codeium): add codeium extra (#1619)
* [feat] add codeium extension

* PR comments
2023-10-07 21:09:36 +02:00
9372d78e7e feat(nlua): make lua dap keybindings buffer-local 2023-10-07 21:08:18 +02:00
30d573502a fix(alpha): reset laststatus when alpha unloads. Fixes #1623 2023-10-07 21:08:18 +02:00
3c92fa4eb0 perf(navic): enable lazy_update_context option to update context on "CursorHold" instead of of using default "CursorMove" (#1620)
Co-authored-by: Radvil <radvil@@access-mobile.com>
2023-10-07 20:42:33 +02:00
8c20e0b588 chore(main): release 9.3.1 (#1613)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-07 15:19:39 +02:00
862e140a7a fix(config): trigger all buf filetype events on LazyFile 2023-10-07 15:15:33 +02:00
1935486ff1 fix(treesitter-textobjects): use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes #1610 2023-10-07 15:06:13 +02:00
237be9e3a7 fix(rust): explicitly enable nvim-cmp source registration for crates (#1609) 2023-10-07 11:45:03 +02:00
75a26e8509 chore(build): auto-generate vimdoc 2023-10-07 09:18:48 +00:00
0fcdbe20da fix(ui): properly handly signs without name. Fixes #1612 2023-10-07 11:18:04 +02:00
fb110e76d8 docs(conform): conform condition example 2023-10-06 23:25:24 +02:00
8bcc241b72 chore(main): release 9.3.0 (#1603)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 23:16:59 +02:00
d8f4382dd3 fix(tailwind): nil check for filetypes_include. Fixes #1607 2023-10-06 23:06:51 +02:00
11c9084ec5 perf(config): only enable LazyFile when opening a file from the cmdline 2023-10-06 18:43:54 +02:00
54df3e26ac feat(bufremove): ask to save changes before trying to remove a buffer 2023-10-06 18:43:54 +02:00
e1f5484c82 refactor: use_lazy_file 2023-10-06 18:43:54 +02:00
6b4c872f2d chore(main): release 9.2.0 (#1600)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 15:53:13 +02:00
6e0e01f5b4 fix(config): fixed issues related to LazyFile. Fixes #1601 2023-10-06 15:40:27 +02:00
a1c5886947 feat(conform): ignore formatting errors for injected languages and fix condition example 2023-10-06 09:26:14 +02:00
8a1de2b90a fix(elixir): only enable credo when installed. Fixes #1546 2023-10-06 09:18:07 +02:00
3823f177e9 chore(build): auto-generate vimdoc 2023-10-06 07:03:24 +00:00
f1ea518e29 fix(which-key): change surround group key (#1598) 2023-10-06 09:02:45 +02:00
cce46cd640 chore(main): release 9.1.1 (#1597)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 01:02:16 +02:00
337cfdbec4 fix(ui): include extmark signs in signcolumn. Fixes #1596 2023-10-05 23:34:32 +02:00
b2af941290 ci: disable blank issues 2023-10-05 16:33:01 +02:00
f219364656 chore(main): release 9.1.0 (#1592)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-05 16:03:46 +02:00
6f1cdfe4bd feat(dashboard): add projects if enabled (#1595) 2023-10-05 15:59:44 +02:00
1eb019274b fix(options): set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering 2023-10-05 10:43:21 +02:00
d6b56c075e fix(dasboard): disable alpha only once 2023-10-05 09:53:50 +02:00
6f6d587998 chore(build): auto-generate vimdoc 2023-10-05 06:08:38 +00:00
d3e7f7717e fix(tailwind): allow overriding filetypes. Fixes #1590 2023-10-05 08:07:56 +02:00
31 changed files with 738 additions and 167 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1 @@
blank_issues_enabled: false

View File

@ -1,5 +1,167 @@
# Changelog
## [9.8.0](https://github.com/LazyVim/LazyVim/compare/v9.7.0...v9.8.0) (2023-10-09)
### Features
* **cmp:** ctrl+CR will abort cmp and enter a new line ([d894556](https://github.com/LazyVim/LazyVim/commit/d894556c375c1c2398f170c21f9323c9c1eba9d4))
* **dashboard:** show loaded/count plugins on dashboard instead of just count ([9670c8a](https://github.com/LazyVim/LazyVim/commit/9670c8a400100d38e15c9662f488232508bfb1bb))
* **edgy:** when edgy is enabled, use edgy's main window for Telescope to open results in ([fb70170](https://github.com/LazyVim/LazyVim/commit/fb7017005809d6be06a1ece748ef2406c37a34d9))
* **options:** set `virtualedit=block` by default ([6b857f1](https://github.com/LazyVim/LazyVim/commit/6b857f1de648292f2410f9beaa95318bd30454d5))
* **telescope:** add telescope-fzf-native by default. Will only be enabled if `make` is on your system. ([44984dc](https://github.com/LazyVim/LazyVim/commit/44984dcbe25c13e0e1bc582d5a51ccc2a4be8f70))
* **telescope:** smarter way to determine the window to open a file in ([c0ce89f](https://github.com/LazyVim/LazyVim/commit/c0ce89fe62bffc0fe35bf76d3e5f501c8b5276c2))
### Bug Fixes
* **autocmds:** extra check that we didn't do last_loc more than once for the buffer ([5d44c97](https://github.com/LazyVim/LazyVim/commit/5d44c976a746e29cfe52ceab93dd3de5db2eafa8))
* **cmp:** set default group_index to 1 to prevent issues with custom sources ([0a05888](https://github.com/LazyVim/LazyVim/commit/0a05888d992b37749f9aae25c7f63f2534ec1024))
* **edgy:** typo ([9357ea2](https://github.com/LazyVim/LazyVim/commit/9357ea2881fdd57b028256597c01e15601c29aaf))
* **project:** make sure to load telescope extension after telescope ran setup ([0955129](https://github.com/LazyVim/LazyVim/commit/0955129796749651e1413006e36e9a1c6d3027f3))
* **telescope:** remove telescope folding hack since PR with fix has been merged upstream ([02bc414](https://github.com/LazyVim/LazyVim/commit/02bc41412a14c1c0bb823421ef82ff5596f42571))
* **util:** dont schedule on_load ([4e8a88f](https://github.com/LazyVim/LazyVim/commit/4e8a88fc1f28d0420aa3badb703296f344d89968))
## [9.7.0](https://github.com/LazyVim/LazyVim/compare/v9.6.0...v9.7.0) (2023-10-09)
### Features
* **black:** added an extra for black with none-ls & conform.nvim ([#1245](https://github.com/LazyVim/LazyVim/issues/1245)) ([5219cad](https://github.com/LazyVim/LazyVim/commit/5219cad564152337d5d48572466ac976f300a557))
* **cmp:** added custom comparator to prioritize AI sources like copilot and codeium ([eddd3af](https://github.com/LazyVim/LazyVim/commit/eddd3af3512133f22eb26dda81c3c6f871453276))
* **cmp:** removed priority comparator in favor of source priorities for copilot/codeium ([bff3a99](https://github.com/LazyVim/LazyVim/commit/bff3a996971c1f526eb893d8e778daa19a4245b5))
* **codeium:** added lualine component with codeium status similar to copilot ([b05783d](https://github.com/LazyVim/LazyVim/commit/b05783de8c518c8a6e5c3f648448c3a6f00d0050))
* **codeium:** use actual codeium icon ([302c1ff](https://github.com/LazyVim/LazyVim/commit/302c1ff66e5b1d7bbe95f29e81c2d642e2cd4468))
### Bug Fixes
* **black:** remove unknown blackd from conform ([#1640](https://github.com/LazyVim/LazyVim/issues/1640)) ([1779858](https://github.com/LazyVim/LazyVim/commit/177985842665921e11f9e9813348fd6bef852e27))
* **bufferline:** fix bufferline when restoring a session ([838ce85](https://github.com/LazyVim/LazyVim/commit/838ce85ad6ae2dc2fa1d7518b0c5eb1eb8fe29b2))
* **cmp:** properly set cmp `group_index` to fix issues with copilot and other sources ([#1639](https://github.com/LazyVim/LazyVim/issues/1639)) ([de93848](https://github.com/LazyVim/LazyVim/commit/de93848f584b3443204247f49b405b81b0a3d4c1))
* **lualine:** only show statusline as soon as lualine loads ([dd55cbd](https://github.com/LazyVim/LazyVim/commit/dd55cbdc99021267bee8260c224582a053552dfe))
* **options:** set sessionoptions the same as persistence ([502d324](https://github.com/LazyVim/LazyVim/commit/502d32490b29e7f52b2941cfa6a306b45633d63e))
* **plugins:** make sure init specs are loaded first ([51e25a9](https://github.com/LazyVim/LazyVim/commit/51e25a94b4ff2339028bdded993756360145d1b3))
### Performance Improvements
* **util:** closure for get_clients to prevent loading vim.lsp cascade early ([1eac633](https://github.com/LazyVim/LazyVim/commit/1eac633c4f0621d5bd07db1ab7d563db5b342e82))
## [9.6.0](https://github.com/LazyVim/LazyVim/compare/v9.5.0...v9.6.0) (2023-10-08)
### Features
* **extra:** add extra `util.dot` that configures multiple ft and treesitter langs when needed ([639a6e7](https://github.com/LazyVim/LazyVim/commit/639a6e7545830602c09711b3757a28537baf8e75))
### Bug Fixes
* **config:** trigger LazyFile additionally on BufWritePre for saving unnamed files ([e11a3cb](https://github.com/LazyVim/LazyVim/commit/e11a3cbe800a1216062f7cefd25827f6fdad9daa))
* **yaml:** yaml schemas are a dict, not a list, so merge properly. Fixes [#1636](https://github.com/LazyVim/LazyVim/issues/1636) ([33c677a](https://github.com/LazyVim/LazyVim/commit/33c677a55e97ee115ad7050856856df7cd96b3e1))
## [9.5.0](https://github.com/LazyVim/LazyVim/compare/v9.4.1...v9.5.0) (2023-10-08)
### Features
* **treesitter:** add diff, jsonc and yaml by default ([c9bbb92](https://github.com/LazyVim/LazyVim/commit/c9bbb922e58b223d49785cddbed2feeea536237e))
### Bug Fixes
* **util:** fixup typo vim.lsp.get_active_clients ([eebdcec](https://github.com/LazyVim/LazyVim/commit/eebdceca1723801e1889d2a65bd676d17139fc6c))
## [9.4.1](https://github.com/LazyVim/LazyVim/compare/v9.4.0...v9.4.1) (2023-10-08)
### Bug Fixes
* **config:** dont append LazyVim early to the rtp when bootstrapping ([4e0a058](https://github.com/LazyVim/LazyVim/commit/4e0a05808cb0997e0ac7d939421f68e9dfa5d74d))
* **util:** fixed lsp willRenameFiles support check ([21ee35f](https://github.com/LazyVim/LazyVim/commit/21ee35f7108f4eefbce84d88a002572b168fc357))
## [9.4.0](https://github.com/LazyVim/LazyVim/compare/v9.3.1...v9.4.0) (2023-10-08)
### Features
* **codeium:** add codeium extra ([#1619](https://github.com/LazyVim/LazyVim/issues/1619)) ([af9e452](https://github.com/LazyVim/LazyVim/commit/af9e4528543d98bccce333d39eccc34e433ef6dc))
* **keymaps:** added support for lazy's per-mode keymap disabling ([1bc7827](https://github.com/LazyVim/LazyVim/commit/1bc78272da28821479e98df528d399214a8cdbee))
* **nlua:** make lua dap keybindings buffer-local ([9372d78](https://github.com/LazyVim/LazyVim/commit/9372d78e7e4ed46612de9818868373da81b6f4f1))
### Bug Fixes
* **alpha:** reset laststatus when alpha unloads. Fixes [#1623](https://github.com/LazyVim/LazyVim/issues/1623) ([30d5735](https://github.com/LazyVim/LazyVim/commit/30d573502a2f9264273a14143e6bddb0b876a391))
### Performance Improvements
* **navic:** enable lazy_update_context option to update context on "CursorHold" instead of of using default "CursorMove" ([#1620](https://github.com/LazyVim/LazyVim/issues/1620)) ([3c92fa4](https://github.com/LazyVim/LazyVim/commit/3c92fa4eb04f827c79c095905ca9391d540fea79))
## [9.3.1](https://github.com/LazyVim/LazyVim/compare/v9.3.0...v9.3.1) (2023-10-07)
### Bug Fixes
* **config:** trigger all buf filetype events on LazyFile ([862e140](https://github.com/LazyVim/LazyVim/commit/862e140a7ad8452cd5a103982687fca63a2f44da))
* **rust:** explicitly enable nvim-cmp source registration for crates ([#1609](https://github.com/LazyVim/LazyVim/issues/1609)) ([237be9e](https://github.com/LazyVim/LazyVim/commit/237be9e3a7f5ca8165d4242d47df34d8d407f4cc))
* **treesitter-textobjects:** use normal ]c,]C,[c,[C when in diff-mode instead of goto class. Fixes [#1610](https://github.com/LazyVim/LazyVim/issues/1610) ([1935486](https://github.com/LazyVim/LazyVim/commit/1935486ff143dd5cf100b8c89204dc01d8e06021))
* **ui:** properly handly signs without name. Fixes [#1612](https://github.com/LazyVim/LazyVim/issues/1612) ([0fcdbe2](https://github.com/LazyVim/LazyVim/commit/0fcdbe20daf44f00252668b3866b19ac18b339df))
## [9.3.0](https://github.com/LazyVim/LazyVim/compare/v9.2.0...v9.3.0) (2023-10-06)
### Features
* **bufremove:** ask to save changes before trying to remove a buffer ([54df3e2](https://github.com/LazyVim/LazyVim/commit/54df3e26aca5c5c4da746f210e6f7e7de30673bb))
### Bug Fixes
* **tailwind:** nil check for filetypes_include. Fixes [#1607](https://github.com/LazyVim/LazyVim/issues/1607) ([d8f4382](https://github.com/LazyVim/LazyVim/commit/d8f4382dd3850550076b33d64a5f455daf7e6450))
### Performance Improvements
* **config:** only enable LazyFile when opening a file from the cmdline ([11c9084](https://github.com/LazyVim/LazyVim/commit/11c9084ec576c8735a87550f7975640eb75e6ff7))
## [9.2.0](https://github.com/LazyVim/LazyVim/compare/v9.1.1...v9.2.0) (2023-10-06)
### Features
* **conform:** ignore formatting errors for injected languages and fix condition example ([a1c5886](https://github.com/LazyVim/LazyVim/commit/a1c5886947e20059ad7802e71e0a82b413af6657))
### Bug Fixes
* **config:** fixed issues related to LazyFile. Fixes [#1601](https://github.com/LazyVim/LazyVim/issues/1601) ([6e0e01f](https://github.com/LazyVim/LazyVim/commit/6e0e01f5b4dd7e97abbb50241a207d36d0ce9cd5))
* **elixir:** only enable credo when installed. Fixes [#1546](https://github.com/LazyVim/LazyVim/issues/1546) ([8a1de2b](https://github.com/LazyVim/LazyVim/commit/8a1de2b90a699bdfee704f3d4422e2ced18ae0f3))
* **which-key:** change surround group key ([#1598](https://github.com/LazyVim/LazyVim/issues/1598)) ([f1ea518](https://github.com/LazyVim/LazyVim/commit/f1ea518e29a601b773d9c9c94489fc9d273c2dea))
## [9.1.1](https://github.com/LazyVim/LazyVim/compare/v9.1.0...v9.1.1) (2023-10-05)
### Bug Fixes
* **ui:** include extmark signs in signcolumn. Fixes [#1596](https://github.com/LazyVim/LazyVim/issues/1596) ([337cfdb](https://github.com/LazyVim/LazyVim/commit/337cfdbec43003cb2c269e59b27167aa752bf41f))
## [9.1.0](https://github.com/LazyVim/LazyVim/compare/v9.0.2...v9.1.0) (2023-10-05)
### Features
* **dashboard:** add projects if enabled ([#1595](https://github.com/LazyVim/LazyVim/issues/1595)) ([6f1cdfe](https://github.com/LazyVim/LazyVim/commit/6f1cdfe4bd2ec9a85c92a312fa52ba86e02d1a9f))
### Bug Fixes
* **dasboard:** disable alpha only once ([d6b56c0](https://github.com/LazyVim/LazyVim/commit/d6b56c075e88ce12e9e16fb2eeeea38fb7853600))
* **options:** set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering ([1eb0192](https://github.com/LazyVim/LazyVim/commit/1eb019274b5564e66ac6c7e119c140bae262e10c))
* **tailwind:** allow overriding filetypes. Fixes [#1590](https://github.com/LazyVim/LazyVim/issues/1590) ([d3e7f77](https://github.com/LazyVim/LazyVim/commit/d3e7f7717e960bb883b35e9a75badfd5b938cace))
## [9.0.2](https://github.com/LazyVim/LazyVim/compare/v9.0.1...v9.0.2) (2023-10-04)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 04
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 09
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -32,14 +32,12 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("last_loc"),
callback = function(event)
if event.data and event.data.lazy_file then
return
end
local exclude = { "gitcommit" }
local buf = event.buf
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then
return
end
vim.b[buf].lazyvim_last_loc = true
local mark = vim.api.nvim_buf_get_mark(buf, '"')
local lcount = vim.api.nvim_buf_line_count(buf)
if mark[1] > 0 and mark[1] <= lcount then
@ -94,16 +92,3 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
-- HACK: re-caclulate folds when entering a buffer through Telescope
-- @see https://github.com/nvim-telescope/telescope.nvim/issues/699
vim.api.nvim_create_autocmd("BufEnter", {
group = augroup("fix_folds"),
callback = function()
if vim.opt.foldmethod:get() == "expr" then
vim.schedule(function()
vim.opt.foldmethod = "expr"
end)
end
end,
})

View File

@ -1,7 +1,11 @@
local Util = require("lazy.core.util")
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.lazy_version = ">=9.1.0"
M.lazy_version = ">=10.8.0"
M.use_lazy_file = true
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
---@class LazyVimOptions
local defaults = {
@ -44,6 +48,7 @@ local defaults = {
Array = "",
Boolean = "",
Class = "",
Codeium = "󰘦 ",
Color = "",
Constant = "",
Constructor = "",
@ -89,33 +94,50 @@ M.renames = {
---@type LazyVimOptions
local options
---@param lines {[1]:string, [2]:string}[]
function M.msg(lines)
vim.cmd([[clear]])
vim.api.nvim_echo(lines, true, {})
vim.fn.getchar()
end
---@param opts? LazyVimOptions
function M.setup(opts)
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
if vim.fn.has("nvim-0.9.0") == 0 then
vim.api.nvim_echo({
M.msg({
{
"LazyVim requires Neovim >= 0.9.0\n",
"ErrorMsg",
},
{ "Press any key to exit", "MoreMsg" },
}, true, {})
vim.fn.getchar()
})
vim.cmd([[quit]])
return
end
if not M.has() then
require("lazy.core.util").error(
"**LazyVim** needs **lazy.nvim** version "
.. M.lazy_version
.. " to work properly.\n"
.. "Please upgrade **lazy.nvim**",
{ title = "LazyVim" }
)
error("Exiting")
M.msg({
{
"LazyVim requires lazy.nvim " .. M.lazy_version .. "\n",
"WarningMsg",
},
{ "Press any key to attempt an upgrade", "MoreMsg" },
})
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
require("lazy").update({ plugins = { "lazy.nvim" }, wait = true })
M.msg({
{
"**lazy.nvim** has been upgraded.\nPlease restart **Neovim**",
"WarningMsg",
},
})
end,
})
end
-- autocmds can be loaded lazily when not opening a file
@ -136,9 +158,12 @@ function M.setup(opts)
end,
})
M.lazy_file()
if M.use_lazy_file then
M.lazy_file()
end
require("lazy.core.util").try(function()
Util.track("colorscheme")
Util.try(function()
if type(M.colorscheme) == "function" then
M.colorscheme()
else
@ -147,39 +172,57 @@ function M.setup(opts)
end, {
msg = "Could not load your colorscheme",
on_error = function(msg)
require("lazy.core.util").error(msg)
Util.error(msg)
vim.cmd.colorscheme("habamax")
end,
})
Util.track()
end
-- Properly load file based plugins without blocking the UI
function M.lazy_file()
local events = {} ---@type {event: string, pattern?: string, buf: number, data?: any}[]
local events = {} ---@type {event: string, buf: number, data?: any}[]
local function load()
if #events == 0 then
return
end
local Event = require("lazy.core.handler.event")
vim.api.nvim_del_augroup_by_name("lazy_file")
Util.track({ event = "LazyVim.lazy_file" })
---@type table<string,string[]>
local skips = {}
for _, event in ipairs(events) do
skips[event.event] = skips[event.event] or Event.get_augroups(event.event)
end
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
for _, event in ipairs(events) do
vim.api.nvim_exec_autocmds(event.event, {
pattern = event.pattern,
modeline = false,
buffer = event.buf,
data = { lazy_file = true },
Event.trigger({
event = event.event,
exclude = skips[event.event],
data = event.data,
buf = event.buf,
})
if vim.bo[event.buf].filetype then
Event.trigger({
event = "FileType",
buf = event.buf,
})
end
end
vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false })
events = {}
Util.track()
end
-- schedule wrap so that nested autocmds are executed
-- and the UI can continue rendering without blocking
load = vim.schedule_wrap(load)
vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "BufNewFile" }, {
vim.api.nvim_create_autocmd(M.lazy_file_events, {
group = vim.api.nvim_create_augroup("lazy_file", { clear = true }),
callback = function(event)
table.insert(events, event)
@ -196,7 +239,6 @@ end
---@param name "autocmds" | "options" | "keymaps"
function M.load(name)
local Util = require("lazy.core.util")
local function _load(mod)
Util.try(function()
require(mod)
@ -228,7 +270,15 @@ M.did_init = false
function M.init()
if not M.did_init then
M.did_init = true
vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir)
local plugin = require("lazy.core.config").spec.plugins.LazyVim
if plugin then
vim.opt.rtp:append(plugin.dir)
end
M.use_lazy_file = M.use_lazy_file and vim.fn.argc(-1) > 0
---@diagnostic disable-next-line: undefined-field
M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil
-- delay notifications till vim.notify was replaced or after 500ms
require("lazyvim.util").lazy_notify()
@ -240,16 +290,32 @@ function M.init()
local add = Plugin.Spec.add
---@diagnostic disable-next-line: duplicate-set-field
Plugin.Spec.add = function(self, plugin, ...)
if type(plugin) == "table" and M.renames[plugin[1]] then
require("lazy.core.util").warn(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1],
M.renames[plugin[1]],
self.importing or "LazyVim"
),
{ title = "LazyVim" }
)
plugin[1] = M.renames[plugin[1]]
if type(plugin) == "table" then
if M.renames[plugin[1]] then
Util.warn(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1],
M.renames[plugin[1]],
self.importing or "LazyVim"
),
{ title = "LazyVim" }
)
plugin[1] = M.renames[plugin[1]]
end
if not M.use_lazy_file and plugin.event then
if plugin.event == "LazyFile" then
plugin.event = M.lazy_file_events
elseif type(plugin.event) == "table" then
local events = {} ---@type string[]
for _, event in ipairs(plugin.event) do
if event == "LazyFile" then
vim.list_extend(events, M.lazy_file_events)
else
events[#events + 1] = event
end
end
end
end
end
return add(self, plugin, ...)
end

View File

@ -1,19 +1,9 @@
-- This file is automatically loaded by lazyvim.config.init
local Util = require("lazyvim.util")
local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the keymap if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
if opts.remap and not vim.g.vscode then
opts.remap = nil
end
vim.keymap.set(mode, lhs, rhs, opts)
end
end
-- DO NOT USE THIS IN YOU OWN CONFIG!!
-- use `vim.keymap.set` instead
local map = Util.safe_keymap_set
-- better up/down
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })

View File

@ -16,7 +16,7 @@ opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep"
opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute
opt.laststatus = 0
opt.laststatus = 3 -- global statusline
opt.list = true -- Show some invisible characters (tabs...
opt.mouse = "a" -- Enable mouse mode
opt.number = true -- Print line number
@ -24,7 +24,7 @@ opt.pumblend = 10 -- Popup blend
opt.pumheight = 10 -- Maximum number of entries in a popup
opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 4 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" }
opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append({ W = true, I = true, c = true, C = true })
@ -43,6 +43,7 @@ opt.timeoutlen = 300
opt.undofile = true
opt.undolevels = 10000
opt.updatetime = 200 -- Save swap file and trigger CursorHold
opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode
opt.wildmode = "longest:full,full" -- Command-line completion mode
opt.winminwidth = 5 -- Minimum window width
opt.wrap = false -- Disable line wrap

View File

@ -66,12 +66,17 @@ return {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-CR>"] = function(fallback)
cmp.abort()
fallback()
end,
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}, {
{ name = "buffer" },
}),
formatting = {
format = function(_, item)
@ -90,6 +95,13 @@ return {
sorting = defaults.sorting,
}
end,
---@param opts cmp.ConfigSchema
config = function(_, opts)
for _, source in ipairs(opts.sources) do
source.group_index = source.group_index or 1
end
require("cmp").setup(opts)
end,
},
-- auto pairs

View File

@ -100,6 +100,18 @@ return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
version = false, -- telescope did only one release, so use HEAD for now
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
enabled = vim.fn.executable("make") == 1,
config = function()
Util.on_load("telescope.nvim", function()
require("telescope").load_extension("fzf")
end)
end,
},
},
keys = {
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
@ -201,6 +213,19 @@ return {
defaults = {
prompt_prefix = "",
selection_caret = "",
-- open files in the first window that is an actual file.
-- use the current window if no other window is available.
get_selection_window = function()
local wins = vim.api.nvim_list_wins()
table.insert(wins, 1, vim.api.nvim_get_current_win())
for _, win in ipairs(wins) do
local buf = vim.api.nvim_win_get_buf(win)
if vim.bo[buf].buftype == "" then
return win
end
end
return 0
end,
mappings = {
i = {
["<c-t>"] = open_with_trouble,
@ -282,7 +307,7 @@ return {
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
["gs"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" },
@ -387,9 +412,27 @@ return {
-- buffer remove
{
"echasnovski/mini.bufremove",
-- stylua: ignore
keys = {
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
{
"<leader>bd",
function()
local bd = require("mini.bufremove").delete
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 1 then -- Yes
vim.cmd.write()
bd(0)
elseif choice == 2 then -- No
bd(0, true)
end
else
bd(0)
end
end,
desc = "Delete Buffer",
},
-- stylua: ignore
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
},

View File

@ -0,0 +1,69 @@
return {
-- codeium cmp source
{
"nvim-cmp",
dependencies = {
-- codeium
{
"Exafunction/codeium.nvim",
cmd = "Codeium",
build = ":Codeium Auth",
opts = {},
},
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "codeium",
group_index = 1,
priority = 100,
})
end,
},
{
"nvim-lualine/lualine.nvim",
optional = true,
event = "VeryLazy",
opts = function(_, opts)
local started = false
local function status()
if not package.loaded["cmp"] then
return
end
for _, s in ipairs(require("cmp").core.sources) do
if s.name == "codeium" then
if s.source:is_available() then
started = true
else
return started and "error" or nil
end
if s.status == s.SourceStatus.FETCHING then
return "pending"
end
return "ok"
end
end
end
local Util = require("lazyvim.util")
local colors = {
ok = Util.fg("Special"),
error = Util.fg("DiagnosticError"),
pending = Util.fg("DiagnosticWarn"),
}
table.insert(opts.sections.lualine_x, 2, {
function()
return require("lazyvim.config").icons.kinds.Codeium
end,
cond = function()
return status() ~= nil
end,
color = function()
return colors[status()] or colors.ok
end,
})
end,
},
}

View File

@ -33,7 +33,13 @@ return {
return icon .. (status.message or "")
end,
cond = function()
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
if not package.loaded["copilot"] then
return
end
local ok, clients = pcall(require("lazyvim.util").get_clients, { name = "copilot", bufnr = 0 })
if not ok then
return false
end
return ok and #clients > 0
end,
color = function()
@ -70,9 +76,11 @@ return {
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize)
table.insert(opts.sources, 1, {
name = "copilot",
group_index = 1,
priority = 100,
})
end,
},
}

View File

@ -6,8 +6,8 @@ return {
"jbyuki/one-small-step-for-vimkind",
-- stylua: ignore
keys = {
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" },
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua" },
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server", ft = "lua" },
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" },
},
config = function()
local dap = require("dap")

View File

@ -0,0 +1,25 @@
return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
table.insert(opts.ensure_installed, "black")
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
table.insert(opts.sources, nls.builtins.formatting.black)
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
["python"] = { "black" },
},
},
},
}

View File

@ -33,6 +33,7 @@ return {
-- You can also define any custom formatters here.
---@type table<string,table>
formatters = {
injected = { options = { ignore_errors = true } },
-- -- Example of using dprint only when a dprint.json file is present
-- dprint = {
-- condition = function(ctx)

View File

@ -33,6 +33,9 @@ return {
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
if vim.fn.executable("credo") == 0 then
return
end
local nls = require("null-ls")
opts.sources = opts.sources or {}
vim.list_extend(opts.sources, {
@ -43,10 +46,13 @@ return {
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
opts = function(_, opts)
if vim.fn.executable("credo") == 0 then
return
end
opts.linters_by_ft = {
elixir = { "credo" },
},
},
}
end,
},
}

View File

@ -7,7 +7,11 @@ return {
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = true,
opts = {
src = {
cmp = { enabled = true },
},
},
},
},
---@param opts cmp.ConfigSchema

View File

@ -4,16 +4,30 @@ return {
opts = {
servers = {
tailwindcss = {
-- exclude a filetype from the default_config
filetypes_exclude = { "markdown" },
-- add additional filetypes to the default_config
filetypes_include = {},
-- to fully override the default_config, change the below
-- filetypes = {}
},
},
setup = {
tailwindcss = function(_, opts)
local tw = require("lspconfig.server_configurations.tailwindcss")
opts.filetypes = opts.filetypes or {}
-- Add default filetypes
vim.list_extend(opts.filetypes, tw.default_config.filetypes)
-- Remove excluded filetypes
--- @param ft string
opts.filetypes = vim.tbl_filter(function(ft)
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
end, tw.default_config.filetypes)
end, opts.filetypes)
-- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include or {})
end,
},
},

View File

@ -35,8 +35,11 @@ return {
},
-- lazy-load schemastore when needed
on_new_config = function(new_config)
new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {}
vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas())
new_config.settings.yaml.schemas = vim.tbl_deep_extend(
"force",
new_config.settings.yaml.schemas or {},
require("schemastore").yaml.schemas()
)
end,
settings = {
redhat = { telemetry = { enabled = false } },

View File

@ -4,10 +4,6 @@ return {
{
"glepnir/dashboard-nvim",
event = "VimEnter",
dependencies = {
-- disable alpha
{ "goolord/alpha-nvim", enabled = false },
},
opts = function()
local logo = [[
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
@ -22,6 +18,11 @@ return {
local opts = {
theme = "doom",
hide = {
-- this is taken care of by lualine
-- enabling this messes up the actual laststatus setting after loading a file
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
@ -37,7 +38,7 @@ return {
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" }
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
@ -56,6 +57,7 @@ return {
end,
})
end
return opts
end,
},

View File

@ -118,6 +118,20 @@ return {
end,
},
-- use edgy's selection window
{
"nvim-telescope/telescope.nvim",
optional = true,
opts = {
defaults = {
get_selection_window = function()
require("edgy").goto_main()
return 0
end,
},
},
},
-- prevent neo-tree from opening files in edgy windows
{
"nvim-neo-tree/neo-tree.nvim",

View File

@ -0,0 +1,62 @@
---@type string
local xdg_config = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config"
---@param path string
local function have(path)
return vim.loop.fs_stat(xdg_config .. "/" .. path) ~= nil
end
return {
-- Add Hyprland Parser
{
"luckasRanarison/tree-sitter-hypr",
enabled = have("hypr"),
event = "BufRead */hypr/*.conf",
config = function()
-- Fix ft detection for hyprland
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hypr" },
})
require("nvim-treesitter.parsers").get_parser_configs().hypr = {
install_info = {
url = "https://github.com/luckasRanarison/tree-sitter-hypr",
files = { "src/parser.c" },
branch = "master",
},
filetype = "hypr",
}
end,
},
-- add some stuff to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
local function add(lang)
if type(opts.ensure_installed) ~= "table" then
table.insert(opts.ensure_installed, lang)
end
end
vim.filetype.add({
extension = { rasi = "rasi" },
pattern = {
[".*/waybar/config"] = "jsonc",
[".*/mako/config"] = "dosini",
[".*/kitty/*.conf"] = "bash",
},
})
add("git_config")
if have("fish") then
add("fish")
end
if have("rofi") or have("wofi") then
add("rasi")
end
end,
},
}

View File

@ -9,7 +9,9 @@ return {
event = "VeryLazy",
config = function(_, opts)
require("project_nvim").setup(opts)
require("telescope").load_extension("projects")
require("lazyvim.util").on_load("telescope.nvim", function()
require("telescope").load_extension("projects")
end)
end,
keys = {
{ "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Projects" },
@ -42,4 +44,17 @@ return {
vim.list_extend(opts.items, items)
end,
},
{
"glepnir/dashboard-nvim",
optional = true,
opts = function(_, opts)
local projects = {
action = "Telescope projects",
desc = " Projects",
icon = "",
key = "p",
}
table.insert(opts.config.center, 3, projects)
end,
},
}

View File

@ -82,7 +82,7 @@ function M.get_formatters(bufnr)
}
---@type lsp.Client[]
local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
local clients = require("lazyvim.util").get_clients({ bufnr = bufnr })
for _, client in ipairs(clients) do
if M.supports_format(client) then
if (#null_ls > 0 and client.name == "null-ls") or #null_ls == 0 then

View File

@ -8,12 +8,6 @@ return {
{ "folke/neodev.nvim", opts = {} },
"mason.nvim",
"williamboman/mason-lspconfig.nvim",
{
"hrsh7th/cmp-nvim-lsp",
cond = function()
return require("lazyvim.util").has("nvim-cmp")
end,
},
},
---@class PluginLspOpts
opts = {
@ -55,7 +49,7 @@ return {
-- 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 LazyKeys[]
---@type LazyKeysSpec[]
-- keys = {},
settings = {
Lua = {

View File

@ -1,12 +1,16 @@
local M = {}
---@type PluginLspKeys
---@type LazyKeysLspSpec[]|nil
M._keys = nil
---@return (LazyKeys|{has?:string})[]
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string}
---@alias LazyKeysLsp LazyKeys|{has?:string}
---@return LazyKeysLspSpec[]
function M.get()
if not M._keys then
---@class PluginLspKeys
if M._keys then
return M._keys
end
-- stylua: ignore
M._keys = {
{ "<leader>cd", vim.diagnostic.open_float, desc = "Line Diagnostics" },
@ -42,20 +46,19 @@ function M.get()
has = "codeAction",
}
}
if require("lazyvim.util").has("inc-rename.nvim") then
M._keys[#M._keys + 1] = {
"<leader>cr",
function()
local inc_rename = require("inc_rename")
return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("<cword>")
end,
expr = true,
desc = "Rename",
has = "rename",
}
else
M._keys[#M._keys + 1] = { "<leader>cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }
end
if require("lazyvim.util").has("inc-rename.nvim") then
M._keys[#M._keys + 1] = {
"<leader>cr",
function()
local inc_rename = require("inc_rename")
return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("<cword>")
end,
expr = true,
desc = "Rename",
has = "rename",
}
else
M._keys[#M._keys + 1] = { "<leader>cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }
end
return M._keys
end
@ -63,7 +66,7 @@ end
---@param method string
function M.has(buffer, method)
method = method:find("/") and method or "textDocument/" .. method
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
local clients = require("lazyvim.util").get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
if client.supports_method(method) then
return true
@ -72,45 +75,33 @@ function M.has(buffer, method)
return false
end
---@return (LazyKeys|{has?:string})[]
function M.resolve(buffer)
local Keys = require("lazy.core.handler.keys")
local keymaps = {} ---@type table<string,LazyKeys|{has?:string}>
local function add(keymap)
local keys = Keys.parse(keymap)
if keys[2] == false then
keymaps[keys.id] = nil
else
keymaps[keys.id] = keys
end
if not Keys.resolve then
return {}
end
for _, keymap in ipairs(M.get()) do
add(keymap)
end
local spec = M.get()
local opts = require("lazyvim.util").opts("nvim-lspconfig")
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
local clients = require("lazyvim.util").get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
for _, keymap in ipairs(maps) do
add(keymap)
end
vim.list_extend(spec, maps)
end
return keymaps
return Keys.resolve(spec)
end
function M.on_attach(client, buffer)
function M.on_attach(_, buffer)
local Keys = require("lazy.core.handler.keys")
local keymaps = M.resolve(buffer)
for _, keys in pairs(keymaps) do
if not keys.has or M.has(buffer, keys.has) then
local opts = Keys.opts(keys)
---@diagnostic disable-next-line: no-unknown
opts.has = nil
opts.silent = opts.silent ~= false
opts.buffer = buffer
vim.keymap.set(keys.mode or "n", keys[1], keys[2], opts)
vim.keymap.set(keys.mode or "n", keys.lhs, keys.rhs, opts)
end
end
end

View File

@ -11,16 +11,26 @@ return {
{
"nvim-treesitter/nvim-treesitter-textobjects",
config = function()
-- Disable class keymaps in diff mode
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function(event)
if vim.wo.diff then
for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do
pcall(vim.keymap.del, "n", key, { buffer = event.buf })
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(q, ...)
end
end,
})
end
end
end,
},
},
@ -30,16 +40,19 @@ return {
{ "<bs>", desc = "Decrement selection", mode = "x" },
},
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
@ -48,6 +61,7 @@ return {
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",

View File

@ -82,16 +82,33 @@ return {
},
},
},
config = function(_, opts)
require("bufferline").setup(opts)
-- Fix bufferline when restoring a session
vim.api.nvim_create_autocmd("BufAdd", {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end,
})
end,
},
-- statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
init = function()
vim.g.lualine_laststatus = vim.o.laststatus
vim.o.laststatus = 0
end,
opts = function()
local icons = require("lazyvim.config").icons
local Util = require("lazyvim.util")
vim.o.laststatus = vim.g.lualine_laststatus
return {
options = {
theme = "auto",
@ -320,6 +337,7 @@ return {
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "AlphaReady",
callback = function()
require("lazy").show()
@ -330,11 +348,18 @@ return {
require("alpha").setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
dashboard.section.footer.val = "⚡ Neovim loaded "
.. stats.loaded
.. "/"
.. stats.count
.. " plugins in "
.. ms
.. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
@ -361,6 +386,7 @@ return {
highlight = true,
depth_limit = 5,
icons = require("lazyvim.config").icons.kinds,
lazy_update_context = true,
}
end,
},

View File

@ -3,12 +3,16 @@ local Util = require("lazy.core.util")
local M = {}
M.root_patterns = { ".git", "lua" }
function M.get_clients(...)
local fn = vim.lsp.get_clients or vim.lsp.get_active_clients
return fn(...)
end
---@param on_attach fun(client, buffer)
function M.on_attach(on_attach)
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf
local buffer = args.buf ---@type number
local client = vim.lsp.get_client_by_id(args.data.client_id)
on_attach(client, buffer)
end,
@ -22,9 +26,11 @@ end
function M.fg(name)
---@type {foreground?:number}?
---@diagnostic disable-next-line: deprecated
local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true)
local fg = hl and hl.fg or hl.foreground
return fg and { fg = string.format("#%06x", fg) }
---@diagnostic disable-next-line: undefined-field
local fg = hl and (hl.fg or hl.foreground)
return fg and { fg = string.format("#%06x", fg) } or nil
end
---@param fn fun()
@ -60,7 +66,7 @@ function M.get_root()
---@type string[]
local roots = {}
if path then
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
for _, client in pairs(M.get_clients({ bufnr = 0 })) do
local workspace = client.config.workspace_folders
local paths = workspace and vim.tbl_map(function(ws)
return vim.uri_to_fname(ws.uri)
@ -227,7 +233,7 @@ function M.lazy_notify()
vim.notify = temp
local timer = vim.loop.new_timer()
local check = vim.loop.new_check()
local check = assert(vim.loop.new_check())
local replay = function()
timer:stop()
@ -253,6 +259,7 @@ function M.lazy_notify()
timer:start(500, 0, replay)
end
---@return _.lspconfig.options
function M.lsp_get_config(server)
local configs = require("lspconfig.configs")
return rawget(configs, server)
@ -263,6 +270,7 @@ end
function M.lsp_disable(server, cond)
local util = require("lspconfig.util")
local def = M.lsp_get_config(server)
---@diagnostic disable-next-line: undefined-field
def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir)
if cond(root_dir, config) then
config.enabled = false
@ -275,9 +283,7 @@ end
function M.on_load(name, fn)
local Config = require("lazy.core.config")
if Config.plugins[name] and Config.plugins[name]._.loaded then
vim.schedule(function()
fn(name)
end)
fn(name)
else
vim.api.nvim_create_autocmd("User", {
pattern = "LazyLoad",
@ -302,9 +308,10 @@ end
---@param from string
---@param to string
function M.on_rename(from, to)
local clients = vim.lsp.get_active_clients()
local clients = M.get_clients()
for _, client in ipairs(clients) do
if client:supports_method("workspace/willRenameFiles") then
if client.supports_method("workspace/willRenameFiles") then
---@diagnostic disable-next-line: invisible
local resp = client.request_sync("workspace/willRenameFiles", {
files = {
{
@ -312,7 +319,7 @@ function M.on_rename(from, to)
newUri = vim.uri_from_fname(to),
},
},
}, 1000)
}, 1000, 0)
if resp and resp.result ~= nil then
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
end
@ -320,4 +327,28 @@ function M.on_rename(from, to)
end
end
-- Wrapper around vim.keymap.set that will
-- not create a keymap if a lazy key handler exists.
-- It will also set `silent` to true by default.
function M.safe_keymap_set(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
local modes = type(mode) == "string" and { mode } or mode
---@param m string
modes = vim.tbl_filter(function(m)
return not (keys.have and keys:have(lhs, m))
end, modes)
-- do not create the keymap if a lazy keys handler exists
if #modes > 0 then
opts = opts or {}
opts.silent = opts.silent ~= false
if opts.remap and not vim.g.vscode then
opts.remap = nil
end
vim.keymap.set(modes, lhs, rhs, opts)
end
end
return M

View File

@ -1,15 +1,44 @@
local M = {}
---@alias Sign {name:string, text:string, texthl:string}
---@alias Sign {name:string, text:string, texthl:string, priority:number}
-- Returns a list of regular and extmark signs sorted by priority (low to high)
---@return Sign[]
---@param buf number
---@param lnum number
function M.get_signs(buf, lnum)
---@diagnostic disable-next-line: no-unknown
return vim.tbl_map(function(sign)
return vim.fn.sign_getdefined(sign.name)[1]
-- Get regular signs
---@type Sign[]
local signs = vim.tbl_map(function(sign)
---@type Sign
local ret = vim.fn.sign_getdefined(sign.name)[1]
ret.priority = sign.priority
return ret
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs)
-- Get extmark signs
local extmarks = vim.api.nvim_buf_get_extmarks(
buf,
-1,
{ lnum - 1, 0 },
{ lnum - 1, -1 },
{ details = true, type = "sign" }
)
for _, extmark in pairs(extmarks) do
signs[#signs + 1] = {
name = extmark[4].sign_hl_group or "",
text = extmark[4].sign_text,
texthl = extmark[4].sign_hl_group,
priority = extmark[4].priority,
}
end
-- Sort by priority
table.sort(signs, function(a, b)
return (a.priority or 0) < (b.priority or 0)
end)
return signs
end
---@return Sign?
@ -64,9 +93,9 @@ function M.statuscolumn()
---@type Sign?,Sign?,Sign?
local left, right, fold
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name:find("GitSign") then
if s.name and s.name:find("GitSign") then
right = s
elseif not left then
else
left = s
end
end

Some files were not shown because too many files have changed in this diff Show More