Sync from upstream to main (#2)

* fix(dot): treesitter for hypr was renamed to hyprlang

* feat(autocmds): dont use conceal for json files

* chore(build): auto-generate vimdoc

* feat(lsp): add diagnostic signs to lsp options (#2192)

Co-authored-by: Gary Murray <gamurray@fanatics.com>

* feat(test): Add <leader>tl to neotest.run_last() (#1968)

* feat(gitsigns): update gitsigns.nvim preview command (#2178)

* chores(format.lua): Fix typo

* Change gitsigns.nvim hunk preview shortcut

Change `preview_hunk` to recently added `preview_hunk_inline` command

* feat(keymaps): add function to toggle between light/dark backgrounds (#2088)

* fix(eslint): correct working directories name (#2071)

* feat(neo-tree): Adds copy file name command to Neo-Tree with 'Y' binding (#2137)

Co-authored-by: Ricardo Rebelo <ricardo.rebelo@siemens.com>

* chore(main): release 10.9.0 (#2391)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: fixup for #2137

* chore(main): release 10.9.1 (#2399)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* docs: typo in init.lua (#2365)

* docs(README-DE): remove .txt extension (#2321)

Probably some windows editor that added this automatically + known extensions hidden.

* fix(autocmds): avoid checktime when buftype=nofile (#2270)

It triggered an 'E11: Invalid in command-line window; <CR> executes,
CTRL-C quits' error when Neovim was in Command Line window and
FocusGained.

* fix(typescript): don't hardcode values in lua table (#2254)

* fix(typescript): don't hardcode values in lua table

When a user changes `vim.opt.shiftwidth` with some auto-command, it's
not taken into account. Make `opts` a function, so that values get
evaluated when `lspconfig` loads instead.

* fix(typescript): remove format settings entirely

* fix(typescript): add back comment and Lua annotations

* fix(typescript): bring back function call completion snippets

* fix(options): change default conceal level to 2 (#2053)

3 hides all concealed text, even if there are replacement chars defined

e.g. : for Markdown, 3 hides list item markers, dots for asterisk lists
and em-dashes for dash lists

If replacements are defined as defaults in a plugin, the "Laziest™"
config would seem to be displaying them.

Level 1 only seems useful when alignment really matters.

* feat(toggle): use `vim.diagnostic.is_disabled` when available (#2217)

* feat(toggle-diagnostics): change logic based on `vim.diagnostic.is_disabled`

After discussion in #2215, I thought maybe it would be beneficial if we
could change the logic of the `toggle-diagnostics` function based on if
the user has disabled diagnostics in his own configuration.

* feat(toggle-diagnostics): revert to `enable` instead of `status`

* fix(toggle): use vim.diagnostics enabled state when possible

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>

* fix(neo-tree): better copy file name with `Y`

* fix(hyprlang): use lazyvim way to install (#2404)

* chore(build): auto-generate vimdoc

* fix(rust): avoid resetting cmp group_index to 1 (#2332)

For example, 'buffer' source by default has group_index = 2 [1], however
if we take all the sources plus crates and run them through
cmp.config.sources() again, since it's a one-dimensional list, all
group_indexes will be reset to 1.

[1] 879e29504d/lua/lazyvim/plugins/coding.lua (L74-L80)

* feat: added `LazyHealth` that loads all plugins and runs `:checkhealth`

* feat(snippets): added extra to use native snippets instead of LuaSnip.

* feat(telescope): add <leader>fg for finding files using git-files (#2353)

I found this to be more useful than the current <leader>ff and <leader>fF

* fix(autocmds): apply conceal level change to local buffer options (#2409)

* chore(build): auto-generate vimdoc

* chore(main): release 10.10.0 (#2400)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore(build): auto-generate vimdoc

* fix(dot): remove hyprlang plugin (#2623)

* chore(build): auto-generate vimdoc

* fix(neo-tree): Add description to "Y" in Neo-Tree (#2642)

It copies the path of the file/directory

* fix(autocmds): nvim already binds q to close for man-files (#2594)

* fix(options): don't lower timeoutlen when in VS Code (#2568)

Avoid lowering timeoutlen when running in VS Code, to avoid
unwanted timeouts from key mappings.

The lower value of 300ms (down from Neovim's default of 1000ms)
works great outside of VS Code, where it helps trigger the which-key UI
quickly, and where which-key prevents timeouts from occuring.

But in VS Code (where which-key isn't applicable), the lower value
makes it difficult to perform some key mappings in time,
such as `]p`, which requires shifting hand position.

* fix(yanky): properly disable sqlite.lua on Windows (#2543)

When directly modifying its `enabled` property, the plugin will remain
disabled even if required by another plugin.

* feat(hipatterns): add shorthand hex color support (#2562)

* feat(lang) replace rust-tools.nvim with rustacean.nvim - fixes #2113 (#2198)

* feat(lang) - move to rustacean.nvim, fixes #2113

* update rustacean plugin

* PR comment for lsp settings

* fix(telescope): dont use git_files when .ignore or .rgignore file is present

* feat(lang): add ansible support (#1218)

* feat(treesitter): add xml to `ensure_installed` (#1962)

* chore(treesitter.lua): fix typo (#2026)

* fix typo

* fix typo

* fix(telescope): anonymous keymap (#1879)

* fix(telescope): anonymous keymap

* fix(telescope): add desc

* fix(telescope): function name

* fix(telescope): update description

* fix(telescope): diagnostic disable

* feat(lang): add Haskell config (#2052)

* feat(util) create gitui extension (#2238)

* feat(symbols-outline): use outline.nvim instead of symbols-outline.nvim (#2535)

* feat(extras): Add scala support using nvim-metals (#1347)

* Add scala support using nvim-metals

nvim-metals:
https://github.com/scalameta/nvim-metals

minimal example configuration from their documentation:
https://github.com/scalameta/nvim-metals/discussions/39

* add treesitter syntax highlighting

* feat(lang): add support for helm chart templates (#2273)

* feat(lang): add support for helm chart templates

* fix(helm): stop yamlls and disable autostart

* fix(helm): stop yaml & docker compose lsp on helm file types

Revert disabling `autostart` since that kills the LSP globally even when
opening a standard yaml file, like GitHub Workflow file.

* fix(helm): remove docker compose lsp overrides

Since docker compose LSP does not seem to be triggered or started by
opening *.yaml helm files, the config overrides were removed to simplify
Helm config.

* fix(helm): ensure mason installs helm lsp

* feat(omnisharp): add `nvim-dap` configuration (#2532)

* feat(omnisharp): add `nvim-dap` configuration

* chore(omnisharp): add `netcoredbg` to `ensure_installed`

* chore: simplify get `netcoredbg` path

* fix(util.ui.fg): Add `link=false` to show effective definition (#2542)

Fixes #2540 by showing the effective definition instead of the linked
group name.

* feat(extras): Enable project-specific plugin specs using local .lazy.lua (#2115)

* feat(extras): Enable project-specific plugin specs using .lazy.lua

* added a warning when extra lazyrc is not the last plugin spec

* feat(lang): add telescope terraform integrations (#2235)

* feat(lang): add telescope terraform integrations

Closes #2234

Add telescope integrations for:
- https://github.com/ANGkeith/telescope-terraform-doc.nvim
- https://github.com/cappyzawa/telescope-terraform.nvim

* fix(lang): remove event from terraform telescope extensions

* style: formatting

* feat(autocmds): added support for copy/paste through ssh. Needs Neovim >= 0.10.0

* feat(extras): add harpoon2 (#2455)

* feat(extras): add harpoon2

* Update lua/lazyvim/plugins/extras/editor/harpoon2.lua

Co-authored-by: Iordanis Petkakis <dpetka2001@gmail.com>

* chore: formatting

---------

Co-authored-by: Iordanis Petkakis <dpetka2001@gmail.com>

* feat(ui): dashboard files searches git files if in git repo (#2240)

just like `<leader>ff` keymap for telescope

* fix(lang): Change `rustacean` keymaps to `vim.keymap.set` instead of `which-key` (#2660)

Based on this [comment](https://github.com/LazyVim/LazyVim/pull/2198#pullrequestreview-1873658780).

* fix(ansible): incorrect key spec

* feat(lsp): added native codelens support. Enable in lsp settings. (disabled by default). Fixes #2656

* feat(java): allow opts for setup_dap_main_class_configs() (#2581)

[1] 382b9f6258/doc/jdtls.txt (L206-L210)

* fix(go): adding opts recursive_run (#2520)

Adding opts recursive_run to fix the error 'no Go files in /path/project.' This issue is caused by a recent change in the 'nvim-neotest/neotest-go' project, which now [defaults to non-recursive behavior](https://github.com/nvim-neotest/neotest-go/pull/72)

* fix(util): clear buffer root cache when cwd change (#2502)

* chore(main): release 10.11.0 (#2659)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(extras): show rename of symbols-outline => outline

* chore(main): release 10.11.1 (#2664)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat(lang): replace rust-tools.nvim with rustacean.nvim #2198

dummy commit to trigger changelog.
original commit message was not correct and didnt get picked up by the changelog

* fix(extras): set correct priority for outline extra. Fixes #2666

* chore(main): release 10.12.0 (#2667)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(haskell): Make Haskell-snippets lazy load for performance (#2676)

* fix(haskell): add filetype to haskell-snippets for lazy load

* format haskell.lua

---------

Co-authored-by: Uthman Mohamed <83053931+1239uth@users.noreply.github.com>

* chore(build): auto-generate vimdoc

* fix(hi-patterns): correct regex for shorthand hex colors. See ##2562

* fix(extras): automatically rename extra symbols-outline => outline. Fixes #2675

* fix(extras): prevent duplicate extra imports

* chore(main): release 10.12.1 (#2677)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(terraform-extra): Drop unnecessary commentstring config for terraform (#2680)

* fix(terraform-extra): Drop unnecessary commentstring config for terraform

The commentstring for terraform and hcl files is now handled by nvim-ts-context-commentstring:

JoosepAlviste/nvim-ts-context-commentstring#94

* Fixed terraform.lua issues. I'm bad.

* chore(build): auto-generate vimdoc

* feat(lualine): add more hl options to pretty_path (#2687)

* feat(lualine): add more hl options to pretty_path

Adds two additional options to pretty_path: filename_hl and dirpath_hl.

This allows users to customize the highlight group of both the directory
component of the path name and the filenname independently. modified_hl
is still used when the buffer has been modified.

Thanks to dpetka2001 (Iordanis Petkakis) for the changes to the format
function.

* feat: cleanup

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>

* chore(build): auto-generate vimdoc

* fix(options): dont set clipboard in an SSH session, so that OSC52 can be enabled (when supported)

* chore(build): auto-generate vimdoc

* feat(git): add <leader>gf for lazygit commit history on current file (#2728)

* Add <leader>gf for lazygit commit history on current file

* Change root dir to git root using git command

* refactor: cleanup

---------

Co-authored-by: Uthman Mohamed <83053931+1239uth@users.noreply.github.com>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>

* chore(build): auto-generate vimdoc

* fix(rust): don't overwrite `vim.g.rustaceanvim` if it is defined (#2720)

* fix(conform): make `lsp_fallback` option user configurable (#2616)

* chore(build): auto-generate vimdoc

* fix(markdown): disable headlines.nvim in insert mode. Fixes #2717

* fix(markdown): disable headlines.nvim bullets for now

* fix(mini.files): description for `g.` keybinding in mini.files (#2693)

If you press `g` in a mini.files menu, the `.` key shows up but doesn't have a description. This adds a desc attribute to the binding so the menu shows a correct description.

* fix(which-key): add group description for folds (#2496)

Signed-off-by: Jeff Davis <mr.jefedavis@gmail.com>

* chore(main): release 10.13.0 (#2684)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(git): use compatible function for windows and linux (#2740)

* chore(build): auto-generate vimdoc

* fix(lazygit): make sure we start lazygit in a valid git root

* chore(build): auto-generate vimdoc

* fix(neotest): add required nvim-nio to test and dap extra (neotest and nvim-dap-ui respectively) (#2763)

* Adding required nvim-nio to neotest in test-core

neotest now requires nvim-neotest/nvim-nio to be
installed as per BREAKING CHANGE: https://github.com/nvim-neotest/neotest/pull/337

* Adding nvim-nio as dependency

nvim-dap-ui now requires  nvim-neotest/nvim-nio as a dependency as of recent changes

* chore(build): auto-generate vimdoc

* fix(extras): accept symlinks in User `extras` directory (#2745)

* feat(lualine): add `modified_sign` to `pretty_path` (#2754)

Closes #2752

I left the initial text blank on purpose, so that it doesn't change
anything stylistically and let the user decide what he wants to add
in his personal configuration for `lualine` spec.

* fix(format): format injected langs does not wait 300ms (#2737)

* feat(mini.ai): add more objects d,e,g,u,U (#2769)

* chore(main): release 10.14.0 (#2741)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(lsp): dont auto install disabled lsp servers

* feat(python): added option to configure basedpyright as lsp. Check the python extra docs. Fixes #2787

* chore(build): auto-generate vimdoc

* chore(main): release 10.15.0 (#2790)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(util.telescope): make `show_untracked` configurable (#2789)

* feat: added LazyVim global. Will refactor specs later to use that

* fix(python): basedpyright is now supported by mason-lspconfig

* chore(build): auto-generate vimdoc

* fix(format): Don't leak bufnr into opts tables (#2794)

* chore(build): auto-generate vimdoc

* feat: use `vim.uv` everywhere instead of `vim.loop`

* feat: use LazyVim everywhere instead of `require("lazyvim.util")`

* feat(lazyterm): optional shell setup, mainly for pwsh. Fixes #2151

* fix(java): dont error when not using cmp. Fixes #2038

* feat(telescope-fzf-native): added support for building with cmake. Fixes #2132

* fix(cmake): lazy load cmake-tools. Fixes #2767

* fix: add shim for vim.uv just in case someone upgrades lazyvim before lazy

* chore(main): release 10.16.0 (#2791)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat(options): Disable foldtext for nightly (#2447)

* chores(format.lua): Fix typo

* Change gitsigns.nvim hunk preview shortcut

Change `preview_hunk` to recently added `preview_hunk_inline` command

* feat(options): remove redundant commented line

* feat(options): use native folding

see https://github.com/neovim/neovim/pull/20750

* feat(neo-tree): add mapping "O" to open with system default (#2758)

* feat(neo-tree): add mapping "O" to open with system default

* feat(neo-tree): add OS checks for system default open commands

* Use `vim.ui.open` if exists

* update OS checks

* Just use vim.ui.open or throw error if doesn't exist

* Make "O" undefined mapping if vim.ui.open isn't available

* fix: use lazy's util.open instead

---------

Co-authored-by: Uthman Mohamed <83053931+1239uth@users.noreply.github.com>
Co-authored-by: saeedahsan <ahsan02@gmail.com>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>

* chore(build): auto-generate vimdoc

* feat(python): allow configuring other python lsp servers than pyright, basedpyright

* chore(build): auto-generate vimdoc

* feat(util): added util function to get a fg/bg color from the active colorscheme

* feat(lazygit): lazygit now automatically uses colors from your Neovim colorscheme

Disable by setting `vim.g.lazygit_theme = false` in your `options.lua`

* chore(main): release 10.17.0 (#2805)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(lazygit): allow overriding default terminal options

* chore(main): release 10.17.1 (#2827)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(lazygit): dont error when setting ansi color fails. Fixes #2829

* chore(main): release 10.17.2 (#2831)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* perf(notify): disable animation notifications. too big impact on performance for too little benefit

To keep using animations, you can set stages = fade_in_slide_out for the
nvim-notify plugin

* chore(main): release 10.17.3 (#2833)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat(lazygit): configure lazygit nvim-remote as editor and enable nerdfont icons

can be disabled with `vim.g.lazygit_config = false`

* fix(terminal): dont use backdrop for edgy terminal windows

* feat(extras): add dial extra (#2798)

* feat: add dial extra

* refactor: removed print statements

* fix(extras): early return for dial extra

* refactor: dials_by_ft like conform, nvim-lint. Simplified buffer specific groups

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>

* chore(main): release 10.18.0 (#2834)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* refactor: use `LazyVim.is_win()`

* fix(autocmds): auto create directory on windows for uris. Fixes #2442

* fix(keymaps): update all keymap descriptions to be Title Case (#2844)

* chore(build): auto-generate vimdoc

* fix(lazygit): error handling for getting lazygit's config path

* fix(lazygit): use `Visual` instead of `CursorLine` for selected line. Fixes #2846

* feat(lazygit): allow customizing the lazygit theme. Check the code to change the hl group mapping. Fixes #2846

* fix(python-semshi): better highlights (#2839)

* chore(main): release 10.19.0 (#2835)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(config): type filter was broken for telescope symbols

* fix(nvim-lint): don't duplicate linters. Fixes #2852

* feat(cmp): added option `auto_brackets` that adds brackets to functions/methods in configured filetypes

* feat(python): enable auto_brackets for python, since pyright and basedpyright dont support this natively

* chore(build): auto-generate vimdoc

* feat(extras): added extra for the `trouble.nvim` v3 beta

* fix(trouble): show message if use hasnt updated with Lazy yet after enabling the extra

* fix(statuscolumn): right align signs when virtnum > 0

* feat(extras): added extra for mini.diff

* feat(extras): use mini.move instead of native move (#2865)

* chore(main): release 10.20.0 (#2849)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(trouble-v3): use the filtered symbols list for lualine

* chore(main): release 10.20.1 (#2869)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(mini.move): default mini.move setup already maps the correct keys

* feat(trouble): added `<leader>cS` to open a trouble list of all references / definitions / ... of the item under the cursor

* feat(trouble): enabled edgy

* chore(build): auto-generate vimdoc

* fix(tex): don't override conceallevel for tex. Not sure why that was added

* chore(main): release 10.21.0 (#2870)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(native_snippets): don't try to enable native snippets on Neovim < 0.10.0 and show warning

* fix: merge conflict

* fix(lsp): dont define diagnostics signs on >= 0.10.0

* fix(lsp): better support for diagnostics icons on Neovim nightly/stable

* chore(main): release 10.21.1 (#2873)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(harpoon): optimizes harpoon keys (#2877)

* feat(dot): add bashls and shellcheck (#2879)

---------

Signed-off-by: Jeff Davis <mr.jefedavis@gmail.com>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gary Murray <garymjr@gmail.com>
Co-authored-by: Gary Murray <gamurray@fanatics.com>
Co-authored-by: Samuel Abreu <sdepaula@gmail.com>
Co-authored-by: Sergey Kochetkov <skoch13@pm.me>
Co-authored-by: NickSager <121263610+NickSager@users.noreply.github.com>
Co-authored-by: Nick Hester <nickhstr@gmail.com>
Co-authored-by: pr3c0g <precogster@gmail.com>
Co-authored-by: Ricardo Rebelo <ricardo.rebelo@siemens.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pablo <52180403+pablos123@users.noreply.github.com>
Co-authored-by: tippfehlr <tippfehlr@tippfehlr.eu>
Co-authored-by: Frederick Zhang <frederick888@tsundere.moe>
Co-authored-by: Iordanis Petkakis <dpetka2001@gmail.com>
Co-authored-by: Adrian Wilkins <adrian.wilkins@gmail.com>
Co-authored-by: Binh Duc Tran <binhtran432k@gmail.com>
Co-authored-by: Yi <yzhuang@users.noreply.github.com>
Co-authored-by: Michael Olson <48652773+m0lson84@users.noreply.github.com>
Co-authored-by: Luckas <luckasranarison@gmail.com>
Co-authored-by: Aman9das <39594914+Aman9das@users.noreply.github.com>
Co-authored-by: Dennis Eriksen <796800+dennisse@users.noreply.github.com>
Co-authored-by: mbhutton <mbhutton@gmail.com>
Co-authored-by: MoetaYuko <loli@yuko.moe>
Co-authored-by: Daniel Mata <100956688+matadaniel@users.noreply.github.com>
Co-authored-by: Andreas Gerlach <appelgriebsch@users.noreply.github.com>
Co-authored-by: Jakub Kozłowicz <ja.kozlowicz@gmail.com>
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
Co-authored-by: Frederik Buchlák <30214087+fbuchlak@users.noreply.github.com>
Co-authored-by: André Freitas <andrecfreitas58@gmail.com>
Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
Co-authored-by: Alafate <alafate.abulimiti@gmail.com>
Co-authored-by: Christian Kleinbölting <seakayone@users.noreply.github.com>
Co-authored-by: Peter Benjamin <petermbenjamin@gmail.com>
Co-authored-by: Võ Quang Chiến <87252943+2giosangmitom@users.noreply.github.com>
Co-authored-by: abeldekat <58370433+abeldekat@users.noreply.github.com>
Co-authored-by: Nybkox <nybkox@gmail.com>
Co-authored-by: Pedro Cattori <pcattori@gmail.com>
Co-authored-by: Wellington Lopes Souza <wellington.lopess@mercadolivre.com>
Co-authored-by: Tang-Tang Zhou <tangtang2995@gmail.com>
Co-authored-by: Uthman Mohamed <83053931+uthmanmoh@users.noreply.github.com>
Co-authored-by: Uthman Mohamed <83053931+1239uth@users.noreply.github.com>
Co-authored-by: Adam Stracener <6558867+NeckBeardPrince@users.noreply.github.com>
Co-authored-by: Pete Kazmier <pete@kazmier.com>
Co-authored-by: Marc Jakobi <marc.jakobi@tiko.energy>
Co-authored-by: Dusty Phillips <86920+dusty-phillips@users.noreply.github.com>
Co-authored-by: Jeff Davis <mr.jefedavis@gmail.com>
Co-authored-by: craempler <74294267+msMatix@users.noreply.github.com>
Co-authored-by: Stefan Krüger <stefan@standa.de>
Co-authored-by: Phúc H. Lê Khắc <phuc.lkh@gmail.com>
Co-authored-by: Alexander Arvidsson <alexander@arvidson.nu>
Co-authored-by: saeedahsan <ahsan02@gmail.com>
Co-authored-by: Feliche-Demian Netliukh <51330172+Demianeen@users.noreply.github.com>
Co-authored-by: Kevin Traver <kevintraver@kevintraver.com>
Co-authored-by: ammon134 <113684938+ammon134@users.noreply.github.com>
Co-authored-by: Rubin Bhandari <roobin.bhandari@gmail.com>
This commit is contained in:
Anjo Tadena 2024-04-09 08:10:35 +08:00 committed by GitHub
parent 7dda2e98e3
commit ddbcc31c62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 2105 additions and 613 deletions

View file

@ -1,5 +1,298 @@
# Changelog # Changelog
## [10.21.1](https://github.com/LazyVim/LazyVim/compare/v10.21.0...v10.21.1) (2024-03-29)
### Bug Fixes
* **lsp:** better support for diagnostics icons on Neovim nightly/stable ([aaa10e7](https://github.com/LazyVim/LazyVim/commit/aaa10e717dbe76c5b6b0ab302698f1d151863dc6))
* **lsp:** dont define diagnostics signs on &gt;= 0.10.0 ([64f8614](https://github.com/LazyVim/LazyVim/commit/64f86147f9f4c67548185798f755c80e03c2098a))
* merge conflict ([349ae03](https://github.com/LazyVim/LazyVim/commit/349ae03f0997d20aa6b4a23315e62dfeab77d559))
* **native_snippets:** don't try to enable native snippets on Neovim &lt; 0.10.0 and show warning ([f308867](https://github.com/LazyVim/LazyVim/commit/f3088675703986b6d37061ebcf0a417c132fd45f))
## [10.21.0](https://github.com/LazyVim/LazyVim/compare/v10.20.1...v10.21.0) (2024-03-29)
### Features
* **trouble:** added `&lt;leader&gt;cS` to open a trouble list of all references / definitions / ... of the item under the cursor ([7544675](https://github.com/LazyVim/LazyVim/commit/754467525b420c85150f13b2cd9e280570c7556c))
* **trouble:** enabled edgy ([80a8b18](https://github.com/LazyVim/LazyVim/commit/80a8b18be6577dcea35748eb563ebef7cf1b3c15))
### Bug Fixes
* **mini.move:** default mini.move setup already maps the correct keys ([3166236](https://github.com/LazyVim/LazyVim/commit/3166236ff88a13e7e5b7579ae780b682f2356d62))
* **tex:** don't override conceallevel for tex. Not sure why that was added ([914f26d](https://github.com/LazyVim/LazyVim/commit/914f26d04e6b9a61f7d4fc80ad433d75dac3f14b))
## [10.20.1](https://github.com/LazyVim/LazyVim/compare/v10.20.0...v10.20.1) (2024-03-28)
### Bug Fixes
* **trouble-v3:** use the filtered symbols list for lualine ([4ca0bf6](https://github.com/LazyVim/LazyVim/commit/4ca0bf69dd1e4a359af6894490f794bd5fc12cf0))
## [10.20.0](https://github.com/LazyVim/LazyVim/compare/v10.19.0...v10.20.0) (2024-03-28)
### Features
* **cmp:** added option `auto_brackets` that adds brackets to functions/methods in configured filetypes ([bf8ce80](https://github.com/LazyVim/LazyVim/commit/bf8ce8076e283ecabce6b2f2a04995b3deeeb593))
* **extras:** added extra for mini.diff ([e29c7ac](https://github.com/LazyVim/LazyVim/commit/e29c7acd2d149da8166f2f44c920cc7d5c89971a))
* **extras:** added extra for the `trouble.nvim` v3 beta ([bb6aa98](https://github.com/LazyVim/LazyVim/commit/bb6aa98cbfe0547150be89dc42f35e3b3eef8b5d))
* **extras:** use mini.move instead of native move ([#2865](https://github.com/LazyVim/LazyVim/issues/2865)) ([8f1fb60](https://github.com/LazyVim/LazyVim/commit/8f1fb60f0a78cb2e83b485e1f946822812c5ff50))
* **python:** enable auto_brackets for python, since pyright and basedpyright dont support this natively ([d95c2ba](https://github.com/LazyVim/LazyVim/commit/d95c2ba1dc75307b154c870aa808f322debc6070))
### Bug Fixes
* **config:** type filter was broken for telescope symbols ([e3075b0](https://github.com/LazyVim/LazyVim/commit/e3075b05ef9646e07639ae896bd8896f68ad5d5f))
* **nvim-lint:** don't duplicate linters. Fixes [#2852](https://github.com/LazyVim/LazyVim/issues/2852) ([cfbd358](https://github.com/LazyVim/LazyVim/commit/cfbd3582736286433ee5532e1ea3a8d05a1e2649))
* **statuscolumn:** right align signs when virtnum &gt; 0 ([a786c47](https://github.com/LazyVim/LazyVim/commit/a786c471df5c048690618b6ff17fa2bc9648891d))
* **trouble:** show message if use hasnt updated with Lazy yet after enabling the extra ([9a2f773](https://github.com/LazyVim/LazyVim/commit/9a2f7730907fd9124ec536f8dc2ad0a253f18f36))
## [10.19.0](https://github.com/LazyVim/LazyVim/compare/v10.18.0...v10.19.0) (2024-03-27)
### Features
* **lazygit:** allow customizing the lazygit theme. Check the code to change the hl group mapping. Fixes [#2846](https://github.com/LazyVim/LazyVim/issues/2846) ([bb1480a](https://github.com/LazyVim/LazyVim/commit/bb1480a6b9ca9e524450192423eac88ba2a32e18))
### Bug Fixes
* **autocmds:** auto create directory on windows for uris. Fixes [#2442](https://github.com/LazyVim/LazyVim/issues/2442) ([7d570fa](https://github.com/LazyVim/LazyVim/commit/7d570fad7949288711c6238468add594963cabaa))
* **keymaps:** update all keymap descriptions to be Title Case ([#2844](https://github.com/LazyVim/LazyVim/issues/2844)) ([eb9f9a8](https://github.com/LazyVim/LazyVim/commit/eb9f9a8862983abe1c7dd51f5f6bf2bd6978346f))
* **lazygit:** error handling for getting lazygit's config path ([ce5917a](https://github.com/LazyVim/LazyVim/commit/ce5917a58965b47ed09462ddb5d160dee2b130ae))
* **lazygit:** use `Visual` instead of `CursorLine` for selected line. Fixes [#2846](https://github.com/LazyVim/LazyVim/issues/2846) ([6ed771d](https://github.com/LazyVim/LazyVim/commit/6ed771de9dd3b14de78e83ed1c62b4f4fcee3c03))
* **python-semshi:** better highlights ([#2839](https://github.com/LazyVim/LazyVim/issues/2839)) ([d945137](https://github.com/LazyVim/LazyVim/commit/d945137a323c6c0200af50444981c7d05ed93f3f))
## [10.18.0](https://github.com/LazyVim/LazyVim/compare/v10.17.3...v10.18.0) (2024-03-26)
### Features
* **extras:** add dial extra ([#2798](https://github.com/LazyVim/LazyVim/issues/2798)) ([76b037d](https://github.com/LazyVim/LazyVim/commit/76b037dcc1105f23b92fe6211d747f97705413fa))
* **lazygit:** configure lazygit nvim-remote as editor and enable nerdfont icons ([426cd3e](https://github.com/LazyVim/LazyVim/commit/426cd3ed91b90e5304802904d14dc3826da317c9))
### Bug Fixes
* **terminal:** dont use backdrop for edgy terminal windows ([fd0677f](https://github.com/LazyVim/LazyVim/commit/fd0677fb9a512c4a4a6bae534a018f361a9bfe30))
## [10.17.3](https://github.com/LazyVim/LazyVim/compare/v10.17.2...v10.17.3) (2024-03-26)
### Performance Improvements
* **notify:** disable animation notifications. too big impact on performance for too little benefit ([f3655c3](https://github.com/LazyVim/LazyVim/commit/f3655c33a3239b67ce9c5e5a8cc384691fd8126c))
## [10.17.2](https://github.com/LazyVim/LazyVim/compare/v10.17.1...v10.17.2) (2024-03-26)
### Bug Fixes
* **lazygit:** dont error when setting ansi color fails. Fixes [#2829](https://github.com/LazyVim/LazyVim/issues/2829) ([a26ca7b](https://github.com/LazyVim/LazyVim/commit/a26ca7bf56790f6bc35134a5037df0405437a1be))
## [10.17.1](https://github.com/LazyVim/LazyVim/compare/v10.17.0...v10.17.1) (2024-03-26)
### Bug Fixes
* **lazygit:** allow overriding default terminal options ([bfe8c60](https://github.com/LazyVim/LazyVim/commit/bfe8c608a33255511fa3e79bf77fd7257022a525))
## [10.17.0](https://github.com/LazyVim/LazyVim/compare/v10.16.0...v10.17.0) (2024-03-26)
### Features
* **lazygit:** lazygit now automatically uses colors from your Neovim colorscheme ([7d0dbc6](https://github.com/LazyVim/LazyVim/commit/7d0dbc6dedc2d6cb4c3bc77fa296dc07ce5927c9))
* **neo-tree:** add mapping "O" to open with system default ([#2758](https://github.com/LazyVim/LazyVim/issues/2758)) ([b74ef23](https://github.com/LazyVim/LazyVim/commit/b74ef23a27dc4efc1cf76f14eb5ecced963d694d))
* **options:** Disable foldtext for nightly ([#2447](https://github.com/LazyVim/LazyVim/issues/2447)) ([7ab6285](https://github.com/LazyVim/LazyVim/commit/7ab628501150b6dbaa6daae4a8ac7b864318677f))
* **python:** allow configuring other python lsp servers than pyright, basedpyright ([3e5a5dd](https://github.com/LazyVim/LazyVim/commit/3e5a5dd621438cff4dbe29df227585b46ede7e44))
* **util:** added util function to get a fg/bg color from the active colorscheme ([c00e3aa](https://github.com/LazyVim/LazyVim/commit/c00e3aa6b1d053e5bea7bfdfbfd3b5aedb6cb5be))
## [10.16.0](https://github.com/LazyVim/LazyVim/compare/v10.15.0...v10.16.0) (2024-03-22)
### Features
* added LazyVim global. Will refactor specs later to use that ([6e57e86](https://github.com/LazyVim/LazyVim/commit/6e57e86c9952986a0e90055e13aa86dcde5e478e))
* **lazyterm:** optional shell setup, mainly for pwsh. Fixes [#2151](https://github.com/LazyVim/LazyVim/issues/2151) ([3d4ab4e](https://github.com/LazyVim/LazyVim/commit/3d4ab4eb2634c9280676a7efdfb2753e5b2f8536))
* **telescope-fzf-native:** added support for building with cmake. Fixes [#2132](https://github.com/LazyVim/LazyVim/issues/2132) ([1c13a5c](https://github.com/LazyVim/LazyVim/commit/1c13a5c10b745f741ebbb08d3963862e9d4e307e))
* use `vim.uv` everywhere instead of `vim.loop` ([3a87c08](https://github.com/LazyVim/LazyVim/commit/3a87c08cdadb23ae88bd6eb193e8392e986df6bb))
* use LazyVim everywhere instead of `require("lazyvim.util")` ([7a5dbea](https://github.com/LazyVim/LazyVim/commit/7a5dbeae75b553b489af8074e9a87207edf1395c))
### Bug Fixes
* add shim for vim.uv just in case someone upgrades lazyvim before lazy ([4b8fe44](https://github.com/LazyVim/LazyVim/commit/4b8fe44c08610be7a0603d84ae03ca81a98cbeee))
* **cmake:** lazy load cmake-tools. Fixes [#2767](https://github.com/LazyVim/LazyVim/issues/2767) ([69aedc2](https://github.com/LazyVim/LazyVim/commit/69aedc265724c71711753333e3b7506fbeab78ef))
* **format:** Don't leak bufnr into opts tables ([#2794](https://github.com/LazyVim/LazyVim/issues/2794)) ([213493e](https://github.com/LazyVim/LazyVim/commit/213493e766df7a5405050205f6050ff24e5a2d6d))
* **java:** dont error when not using cmp. Fixes [#2038](https://github.com/LazyVim/LazyVim/issues/2038) ([8d31bf2](https://github.com/LazyVim/LazyVim/commit/8d31bf230cf9ad872ad50251d405ed628c9e69ae))
* **python:** basedpyright is now supported by mason-lspconfig ([4187417](https://github.com/LazyVim/LazyVim/commit/4187417158a22ff80a059a73f2eddb113f59c113))
* **util.telescope:** make `show_untracked` configurable ([#2789](https://github.com/LazyVim/LazyVim/issues/2789)) ([1661759](https://github.com/LazyVim/LazyVim/commit/1661759d3358dbaa4be834f0022d53071b6fb21c))
## [10.15.0](https://github.com/LazyVim/LazyVim/compare/v10.14.0...v10.15.0) (2024-03-20)
### Features
* **python:** added option to configure basedpyright as lsp. Check the python extra docs. Fixes [#2787](https://github.com/LazyVim/LazyVim/issues/2787) ([f055265](https://github.com/LazyVim/LazyVim/commit/f055265bff24f047320bca1a402ab55a32b35111))
### Bug Fixes
* **lsp:** dont auto install disabled lsp servers ([fa0e538](https://github.com/LazyVim/LazyVim/commit/fa0e538838f2bd3b429a98a6d676dacb7b0916af))
## [10.14.0](https://github.com/LazyVim/LazyVim/compare/v10.13.0...v10.14.0) (2024-03-19)
### Features
* **lualine:** add `modified_sign` to `pretty_path` ([#2754](https://github.com/LazyVim/LazyVim/issues/2754)) ([ed44b24](https://github.com/LazyVim/LazyVim/commit/ed44b246b443939ca7755bef1522c68df94c2a76))
* **mini.ai:** add more objects d,e,g,u,U ([#2769](https://github.com/LazyVim/LazyVim/issues/2769)) ([f655139](https://github.com/LazyVim/LazyVim/commit/f65513928127ec4e2e4187af36ec49255bd0f5fb))
### Bug Fixes
* **extras:** accept symlinks in User `extras` directory ([#2745](https://github.com/LazyVim/LazyVim/issues/2745)) ([6a37171](https://github.com/LazyVim/LazyVim/commit/6a37171df6391482a3440cf607c173525bc875ba))
* **format:** format injected langs does not wait 300ms ([#2737](https://github.com/LazyVim/LazyVim/issues/2737)) ([52ee7ef](https://github.com/LazyVim/LazyVim/commit/52ee7ef6962f499114f8e91230ef5558444e3a0c))
* **git:** use compatible function for windows and linux ([#2740](https://github.com/LazyVim/LazyVim/issues/2740)) ([42a7e79](https://github.com/LazyVim/LazyVim/commit/42a7e79d5a09936ee521cab29d601d336c396c18))
* **lazygit:** make sure we start lazygit in a valid git root ([d8d380a](https://github.com/LazyVim/LazyVim/commit/d8d380a60e7dc396fcf2fee90ace77760585d685))
* **neotest:** add required nvim-nio to test and dap extra (neotest and nvim-dap-ui respectively) ([#2763](https://github.com/LazyVim/LazyVim/issues/2763)) ([393a9c7](https://github.com/LazyVim/LazyVim/commit/393a9c7c7ab2c37a69a9b5da609c27fa2fd3816c))
## [10.13.0](https://github.com/LazyVim/LazyVim/compare/v10.12.1...v10.13.0) (2024-03-14)
### Features
* **git:** add &lt;leader&gt;gf for lazygit commit history on current file ([#2728](https://github.com/LazyVim/LazyVim/issues/2728)) ([0ec7a90](https://github.com/LazyVim/LazyVim/commit/0ec7a9040b60943597649940619f23bfa4b46990))
* **lualine:** add more hl options to pretty_path ([#2687](https://github.com/LazyVim/LazyVim/issues/2687)) ([d3761ed](https://github.com/LazyVim/LazyVim/commit/d3761eded733b5f00e1ee14fef3fb2ce0dfb7dd0))
### Bug Fixes
* **conform:** make `lsp_fallback` option user configurable ([#2616](https://github.com/LazyVim/LazyVim/issues/2616)) ([afca0b7](https://github.com/LazyVim/LazyVim/commit/afca0b7876abf9022ee0754270f603e981ea42a5))
* **markdown:** disable headlines.nvim bullets for now ([843032e](https://github.com/LazyVim/LazyVim/commit/843032ef1c751abf732b6f1d989584c199f049fb))
* **markdown:** disable headlines.nvim in insert mode. Fixes [#2717](https://github.com/LazyVim/LazyVim/issues/2717) ([0ba731a](https://github.com/LazyVim/LazyVim/commit/0ba731a87977e98f2420e2c6d2c4cabbcedaff60))
* **mini.files:** description for `g.` keybinding in mini.files ([#2693](https://github.com/LazyVim/LazyVim/issues/2693)) ([9915234](https://github.com/LazyVim/LazyVim/commit/991523431ff779b3bfe8ae133fa8109d8950d361))
* **options:** dont set clipboard in an SSH session, so that OSC52 can be enabled (when supported) ([1c9f416](https://github.com/LazyVim/LazyVim/commit/1c9f4160a22dbdca2db36169460fcf28641607e7))
* **rust:** don't overwrite `vim.g.rustaceanvim` if it is defined ([#2720](https://github.com/LazyVim/LazyVim/issues/2720)) ([2a666ac](https://github.com/LazyVim/LazyVim/commit/2a666ac5f2d91f0a1f1b711281dd72725f9759a1))
* **terraform-extra:** Drop unnecessary commentstring config for terraform ([#2680](https://github.com/LazyVim/LazyVim/issues/2680)) ([b12e742](https://github.com/LazyVim/LazyVim/commit/b12e7424580d4b524755eec33006d4517fa3182e))
* **which-key:** add group description for folds ([#2496](https://github.com/LazyVim/LazyVim/issues/2496)) ([623297e](https://github.com/LazyVim/LazyVim/commit/623297efa688283b54f1b9ad169feca69aaaae67))
## [10.12.1](https://github.com/LazyVim/LazyVim/compare/v10.12.0...v10.12.1) (2024-03-08)
### Bug Fixes
* **extras:** automatically rename extra symbols-outline =&gt; outline. Fixes [#2675](https://github.com/LazyVim/LazyVim/issues/2675) ([ee2e876](https://github.com/LazyVim/LazyVim/commit/ee2e876252c82458d47617b6d87d827ea442ddcd))
* **extras:** prevent duplicate extra imports ([935bc22](https://github.com/LazyVim/LazyVim/commit/935bc2283f9968a8fb1fc2466a14618a838cb904))
* **haskell:** Make Haskell-snippets lazy load for performance ([#2676](https://github.com/LazyVim/LazyVim/issues/2676)) ([04bc571](https://github.com/LazyVim/LazyVim/commit/04bc5718a51364dddf365ba9163b2a1c7d74071d))
* **hi-patterns:** correct regex for shorthand hex colors. See #[#2562](https://github.com/LazyVim/LazyVim/issues/2562) ([7415231](https://github.com/LazyVim/LazyVim/commit/7415231855f8173e9664c035a1a631da8c664948))
## [10.12.0](https://github.com/LazyVim/LazyVim/compare/v10.11.1...v10.12.0) (2024-03-07)
### Features
* **lang:** replace rust-tools.nvim with rustacean.nvim [#2198](https://github.com/LazyVim/LazyVim/issues/2198) ([139c41c](https://github.com/LazyVim/LazyVim/commit/139c41c18ed7bde8dbaf5ef18afc063a96092954))
### Bug Fixes
* **extras:** set correct priority for outline extra. Fixes [#2666](https://github.com/LazyVim/LazyVim/issues/2666) ([4745314](https://github.com/LazyVim/LazyVim/commit/474531407454cb69f1d09e4bc1120b9571dc8697))
## [10.11.1](https://github.com/LazyVim/LazyVim/compare/v10.11.0...v10.11.1) (2024-03-07)
### Bug Fixes
* **extras:** show rename of symbols-outline =&gt; outline ([c6736ef](https://github.com/LazyVim/LazyVim/commit/c6736ef2b8962a9b0a8d5cb5916f1b11835ac090))
## [10.11.0](https://github.com/LazyVim/LazyVim/compare/v10.10.0...v10.11.0) (2024-03-07)
### Features
* **autocmds:** added support for copy/paste through ssh. Needs Neovim &gt;= 0.10.0 ([21ca466](https://github.com/LazyVim/LazyVim/commit/21ca466db13e68740aa3348c7406369c53062a9e))
* **extras:** add harpoon2 ([#2455](https://github.com/LazyVim/LazyVim/issues/2455)) ([cae22ba](https://github.com/LazyVim/LazyVim/commit/cae22baf082dcf68c5a4074ca4f6534589d80f8d))
* **extras:** Add scala support using nvim-metals ([#1347](https://github.com/LazyVim/LazyVim/issues/1347)) ([d250261](https://github.com/LazyVim/LazyVim/commit/d2502613ff0fe8116a3a8891006b1a880834be15))
* **extras:** Enable project-specific plugin specs using local .lazy.lua ([#2115](https://github.com/LazyVim/LazyVim/issues/2115)) ([b949835](https://github.com/LazyVim/LazyVim/commit/b949835de50555b8a1c15b24361d6abb73d30808))
* **hipatterns:** add shorthand hex color support ([#2562](https://github.com/LazyVim/LazyVim/issues/2562)) ([a8eeb1b](https://github.com/LazyVim/LazyVim/commit/a8eeb1b75d9df360f2b63f0f52708f24172990e5))
* **java:** allow opts for setup_dap_main_class_configs() ([#2581](https://github.com/LazyVim/LazyVim/issues/2581)) ([a7c16f8](https://github.com/LazyVim/LazyVim/commit/a7c16f8efd145122869ffb272d70a1229907a823))
* **lang:** add ansible support ([#1218](https://github.com/LazyVim/LazyVim/issues/1218)) ([b7da44c](https://github.com/LazyVim/LazyVim/commit/b7da44caaed0bf7da0fd81d56f00428ff8df59d2))
* **lang:** add Haskell config ([#2052](https://github.com/LazyVim/LazyVim/issues/2052)) ([c6c584f](https://github.com/LazyVim/LazyVim/commit/c6c584f7c3263e685e064fb84f69e58d9b625f23))
* **lang:** add support for helm chart templates ([#2273](https://github.com/LazyVim/LazyVim/issues/2273)) ([de01a37](https://github.com/LazyVim/LazyVim/commit/de01a37cb68c3ddfb64e9576df0878a4373a6dcb))
* **lang:** add telescope terraform integrations ([#2235](https://github.com/LazyVim/LazyVim/issues/2235)) ([d57817d](https://github.com/LazyVim/LazyVim/commit/d57817d79b18a2e9aa39db129056be3adf3c8371))
* **lsp:** added native codelens support. Enable in lsp settings. (disabled by default). Fixes [#2656](https://github.com/LazyVim/LazyVim/issues/2656) ([780b9bb](https://github.com/LazyVim/LazyVim/commit/780b9bb337dc57bcd7f2bf4dc8bb5be62a6ce92b))
* **omnisharp:** add `nvim-dap` configuration ([#2532](https://github.com/LazyVim/LazyVim/issues/2532)) ([f23d3ce](https://github.com/LazyVim/LazyVim/commit/f23d3cee422a8b77572a8db6fe915d374625453f))
* **symbols-outline:** use outline.nvim instead of symbols-outline.nvim ([#2535](https://github.com/LazyVim/LazyVim/issues/2535)) ([a48b14e](https://github.com/LazyVim/LazyVim/commit/a48b14eb3e4ff03e55796dc50e08b6c8a42cccf4))
* **treesitter:** add xml to `ensure_installed` ([#1962](https://github.com/LazyVim/LazyVim/issues/1962)) ([1b0b899](https://github.com/LazyVim/LazyVim/commit/1b0b899ab361cdabf74395449ff3c622ef74dcb1))
* **ui:** dashboard files searches git files if in git repo ([#2240](https://github.com/LazyVim/LazyVim/issues/2240)) ([66b3c0a](https://github.com/LazyVim/LazyVim/commit/66b3c0a19fe3024d4bf1da563f7ca5a9aff58dec))
### Bug Fixes
* **ansible:** incorrect key spec ([b2a0ae6](https://github.com/LazyVim/LazyVim/commit/b2a0ae6d0d03270697359399bc33418493079a3d))
* **autocmds:** nvim already binds q to close for man-files ([#2594](https://github.com/LazyVim/LazyVim/issues/2594)) ([16d6ac2](https://github.com/LazyVim/LazyVim/commit/16d6ac234a3fa813ed920d5e3a5fb2a8e35c20d6))
* **dot:** remove hyprlang plugin ([#2623](https://github.com/LazyVim/LazyVim/issues/2623)) ([796112e](https://github.com/LazyVim/LazyVim/commit/796112e1707ce1a693cd76a95b84dda5529fc990))
* **go:** adding opts recursive_run ([#2520](https://github.com/LazyVim/LazyVim/issues/2520)) ([e8e7d22](https://github.com/LazyVim/LazyVim/commit/e8e7d22f56f2a2dc2ca0c28b02884c0356df2015))
* **lang:** Change `rustacean` keymaps to `vim.keymap.set` instead of `which-key` ([#2660](https://github.com/LazyVim/LazyVim/issues/2660)) ([ed135e6](https://github.com/LazyVim/LazyVim/commit/ed135e6ffdd8dc9a43dabe62573688934e7a1bb0))
* **neo-tree:** Add description to "Y" in Neo-Tree ([#2642](https://github.com/LazyVim/LazyVim/issues/2642)) ([1a41743](https://github.com/LazyVim/LazyVim/commit/1a417430fc388b9a0b063017188a92d8ad14534f))
* **options:** don't lower timeoutlen when in VS Code ([#2568](https://github.com/LazyVim/LazyVim/issues/2568)) ([29ed06e](https://github.com/LazyVim/LazyVim/commit/29ed06e0007d645d7c26b22df1346150b8e28b7f))
* **telescope:** anonymous keymap ([#1879](https://github.com/LazyVim/LazyVim/issues/1879)) ([36ae421](https://github.com/LazyVim/LazyVim/commit/36ae4213b89191e040405c5515c24d8021f277d2))
* **telescope:** dont use git_files when .ignore or .rgignore file is present ([e7a58d9](https://github.com/LazyVim/LazyVim/commit/e7a58d94847e6f1b282a6a717794cc454fe51faa))
* **util.ui.fg:** Add `link=false` to show effective definition ([#2542](https://github.com/LazyVim/LazyVim/issues/2542)) ([5012d7d](https://github.com/LazyVim/LazyVim/commit/5012d7d839beede3d223c361449d0d8cb00fa098))
* **util:** clear buffer root cache when cwd change ([#2502](https://github.com/LazyVim/LazyVim/issues/2502)) ([8386d23](https://github.com/LazyVim/LazyVim/commit/8386d23c817a3e3e4ee6302bd8e2902f7e297cf5))
* **yanky:** properly disable sqlite.lua on Windows ([#2543](https://github.com/LazyVim/LazyVim/issues/2543)) ([d9f5e6d](https://github.com/LazyVim/LazyVim/commit/d9f5e6db165167c80fe80ede68b0e1815a81cc43))
## [10.10.0](https://github.com/LazyVim/LazyVim/compare/v10.9.1...v10.10.0) (2024-01-23)
### Features
* added `LazyHealth` that loads all plugins and runs `:checkhealth` ([d928739](https://github.com/LazyVim/LazyVim/commit/d9287391b7ca7153320d4654e148c33463eba3a6))
* **snippets:** added extra to use native snippets instead of LuaSnip. ([7f92191](https://github.com/LazyVim/LazyVim/commit/7f9219162b54a717b7da5cb543ab1e778c9a124b))
* **telescope:** add &lt;leader&gt;fg for finding files using git-files ([#2353](https://github.com/LazyVim/LazyVim/issues/2353)) ([54ae77e](https://github.com/LazyVim/LazyVim/commit/54ae77e164e62ae9f45e864dfd727bfe1809a419))
* **toggle:** use `vim.diagnostic.is_disabled` when available ([#2217](https://github.com/LazyVim/LazyVim/issues/2217)) ([93342f1](https://github.com/LazyVim/LazyVim/commit/93342f15badc6e7a3c213e27979b2ff31e0b393e))
### Bug Fixes
* **autocmds:** apply conceal level change to local buffer options ([#2409](https://github.com/LazyVim/LazyVim/issues/2409)) ([591f850](https://github.com/LazyVim/LazyVim/commit/591f850f8a30a08066022392fe3b23eb217dbb81))
* **autocmds:** avoid checktime when buftype=nofile ([#2270](https://github.com/LazyVim/LazyVim/issues/2270)) ([8e2046f](https://github.com/LazyVim/LazyVim/commit/8e2046f3d02a80558802b6cbcd4c8f7d44f7b6b4))
* **hyprlang:** use lazyvim way to install ([#2404](https://github.com/LazyVim/LazyVim/issues/2404)) ([1dffb1d](https://github.com/LazyVim/LazyVim/commit/1dffb1d853df39e2232fd39d3cf47ba3da2e8b6c))
* **neo-tree:** better copy file name with `Y` ([eccf3b5](https://github.com/LazyVim/LazyVim/commit/eccf3b5e68035516c879b3e2b4d6bf8512c87976))
* **options:** change default conceal level to 2 ([#2053](https://github.com/LazyVim/LazyVim/issues/2053)) ([a43d8cf](https://github.com/LazyVim/LazyVim/commit/a43d8cf35857fae4aaf1ebbd3c280cdf5b5f9d10))
* **rust:** avoid resetting cmp group_index to 1 ([#2332](https://github.com/LazyVim/LazyVim/issues/2332)) ([f799b39](https://github.com/LazyVim/LazyVim/commit/f799b39eafedf58cdd7b123870a2c87d96eddb68))
* **typescript:** don't hardcode values in lua table ([#2254](https://github.com/LazyVim/LazyVim/issues/2254)) ([cbd9d70](https://github.com/LazyVim/LazyVim/commit/cbd9d700dc964cf8c90759f8482911d03c72edc4))
## [10.9.1](https://github.com/LazyVim/LazyVim/compare/v10.9.0...v10.9.1) (2024-01-21)
### Bug Fixes
* fixup for [#2137](https://github.com/LazyVim/LazyVim/issues/2137) ([fbe478a](https://github.com/LazyVim/LazyVim/commit/fbe478ae3f84ff842d18ff880af5842a50ee8e50))
## [10.9.0](https://github.com/LazyVim/LazyVim/compare/v10.8.2...v10.9.0) (2024-01-21)
### Features
* **autocmds:** dont use conceal for json files ([23fe52a](https://github.com/LazyVim/LazyVim/commit/23fe52acd78c8e8f7c35c3ce4c1bae830adfa357))
* **gitsigns:** update gitsigns.nvim preview command ([#2178](https://github.com/LazyVim/LazyVim/issues/2178)) ([f4ddb16](https://github.com/LazyVim/LazyVim/commit/f4ddb16b262e5ba14b417dc53bfd09d5b21f8a73))
* **keymaps:** add function to toggle between light/dark backgrounds ([#2088](https://github.com/LazyVim/LazyVim/issues/2088)) ([fa6158a](https://github.com/LazyVim/LazyVim/commit/fa6158a59500c816b652e0fcb4c343270be54b6c))
* **lsp:** add diagnostic signs to lsp options ([#2192](https://github.com/LazyVim/LazyVim/issues/2192)) ([33830f1](https://github.com/LazyVim/LazyVim/commit/33830f1e7d2e5a54fec676ce6e43a4a61882aaa9))
* **neo-tree:** Adds copy file name command to Neo-Tree with 'Y' binding ([#2137](https://github.com/LazyVim/LazyVim/issues/2137)) ([5296d42](https://github.com/LazyVim/LazyVim/commit/5296d42e6ab4f6df80e801542382a3d774298364))
* **test:** Add &lt;leader&gt;tl to neotest.run_last() ([#1968](https://github.com/LazyVim/LazyVim/issues/1968)) ([b71feb7](https://github.com/LazyVim/LazyVim/commit/b71feb7e45420a6e6dcac2f4491b73b70c32e5c7))
### Bug Fixes
* **dot:** treesitter for hypr was renamed to hyprlang ([979bb95](https://github.com/LazyVim/LazyVim/commit/979bb952a69d7dafac125da69cb27b70d5403f52))
* **eslint:** correct working directories name ([#2071](https://github.com/LazyVim/LazyVim/issues/2071)) ([71a73e8](https://github.com/LazyVim/LazyVim/commit/71a73e8334a3692c549a09169e0f7a33923520f1))
## [10.8.2](https://github.com/LazyVim/LazyVim/compare/v10.8.1...v10.8.2) (2023-11-30) ## [10.8.2](https://github.com/LazyVim/LazyVim/compare/v10.8.1...v10.8.2) (2023-11-30)

33
NEWS.md
View file

@ -2,6 +2,39 @@
## 10.x ## 10.x
- added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md)
This is a plugin similar to gitsigns but with a neat diff overlay
that can be toggled with `<leader>go`.
- **trouble.nvim** has been rewritten from scratch and is now in beta.
I've added a new extra for it (`trouble-v3`) for those of you who want to try it out.
You can find the updated docs [here](https://github.com/folke/trouble.nvim/tree/dev)
- The **lazygit** integration now configures:
- the theme based on the colorscheme
- nerd font icons (v3)
- editor preset is set to `nvim-remote` for better interop with Neovim
- The option `vim.g.lazygit_theme` was renamed to `vim.g.lazygit_config`
- **lazygit** now automatically uses the colors of your current colorscheme.
This is enabled by default. To disable, add the below to your `options.lua`:
```lua
vim.g.lazygit_config = false
```
- Added support for `basedpyright` to the **python** extra.
Enable in your `options.lua` with:
```lua
vim.g.lazyvim_python_lsp = "basedpyright"
```
Be aware that `basedpyright` is still in development and
may not work exactly the same as `pyright`.
- User extras under `lua/plugins/extras` can now also be managed - User extras under `lua/plugins/extras` can now also be managed
with **LazyExtras** with **LazyExtras**

View file

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 30 *LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 March 29
============================================================================== ==============================================================================
Table of Contents *LazyVim-table-of-contents* Table of Contents *LazyVim-table-of-contents*
@ -8,6 +8,7 @@ Table of Contents *LazyVim-table-of-contents*
- Getting Started |LazyVim-getting-started| - Getting Started |LazyVim-getting-started|
- File Structure |LazyVim-file-structure| - File Structure |LazyVim-file-structure|
- Configuration |LazyVim-configuration| - Configuration |LazyVim-configuration|
1. Links |LazyVim-links|
Install Install
· ·

View file

@ -7,7 +7,11 @@ end
-- Check if we need to reload the file when it changed -- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
group = augroup("checktime"), group = augroup("checktime"),
command = "checktime", callback = function()
if vim.o.buftype ~= "nofile" then
vim.cmd("checktime")
end
end,
}) })
-- Highlight on yank -- Highlight on yank
@ -53,7 +57,6 @@ vim.api.nvim_create_autocmd("FileType", {
"PlenaryTestPopup", "PlenaryTestPopup",
"help", "help",
"lspinfo", "lspinfo",
"man",
"notify", "notify",
"qf", "qf",
"query", "query",
@ -71,6 +74,15 @@ vim.api.nvim_create_autocmd("FileType", {
end, end,
}) })
-- make it easier to close man-files when opened inline
vim.api.nvim_create_autocmd("FileType", {
group = augroup("man_unlisted"),
pattern = { "man" },
callback = function(event)
vim.bo[event.buf].buflisted = false
end,
})
-- wrap and check for spell in text filetypes -- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"), group = augroup("wrap_spell"),
@ -81,14 +93,23 @@ vim.api.nvim_create_autocmd("FileType", {
end, end,
}) })
-- Fix conceallevel for json files
vim.api.nvim_create_autocmd({ "FileType" }, {
group = augroup("json_conceal"),
pattern = { "json", "jsonc", "json5" },
callback = function()
vim.opt_local.conceallevel = 0
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist -- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"), group = augroup("auto_create_dir"),
callback = function(event) callback = function(event)
if event.match:match("^%w%w+://") then if event.match:match("^%w%w+:[\\/][\\/]") then
return return
end end
local file = vim.loop.fs_realpath(event.match) or event.match local file = vim.uv.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end, end,
}) })

View file

@ -1,9 +1,10 @@
local Util = require("lazyvim.util") _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions ---@class LazyVimConfig: LazyVimOptions
local M = {} local M = {}
M.version = "10.8.2" -- x-release-please-version M.version = "10.21.1" -- x-release-please-version
LazyVim.config = M
---@class LazyVimOptions ---@class LazyVimOptions
local defaults = { local defaults = {
@ -131,7 +132,7 @@ local defaults = {
} }
M.json = { M.json = {
version = 2, version = 3,
data = { data = {
version = nil, ---@type string? version = nil, ---@type string?
news = {}, ---@type table<string, string> news = {}, ---@type table<string, string>
@ -149,7 +150,7 @@ function M.json.load()
if ok then if ok then
M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {}) M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {})
if M.json.data.version ~= M.json.version then if M.json.data.version ~= M.json.version then
Util.json.migrate() LazyVim.json.migrate()
end end
end end
end end
@ -178,18 +179,23 @@ function M.setup(opts)
end end
M.load("keymaps") M.load("keymaps")
Util.format.setup() LazyVim.format.setup()
Util.news.setup() LazyVim.news.setup()
Util.root.setup() LazyVim.root.setup()
vim.api.nvim_create_user_command("LazyExtras", function() vim.api.nvim_create_user_command("LazyExtras", function()
Util.extras.show() LazyVim.extras.show()
end, { desc = "Manage LazyVim extras" }) end, { desc = "Manage LazyVim extras" })
vim.api.nvim_create_user_command("LazyHealth", function()
vim.cmd([[Lazy! load all]])
vim.cmd([[checkhealth]])
end, { desc = "Load all plugins and run :checkhealth" })
end, end,
}) })
Util.track("colorscheme") LazyVim.track("colorscheme")
Util.try(function() LazyVim.try(function()
if type(M.colorscheme) == "function" then if type(M.colorscheme) == "function" then
M.colorscheme() M.colorscheme()
else else
@ -198,11 +204,11 @@ function M.setup(opts)
end, { end, {
msg = "Could not load your colorscheme", msg = "Could not load your colorscheme",
on_error = function(msg) on_error = function(msg)
Util.error(msg) LazyVim.error(msg)
vim.cmd.colorscheme("habamax") vim.cmd.colorscheme("habamax")
end, end,
}) })
Util.track() LazyVim.track()
end end
---@param buf? number ---@param buf? number
@ -216,6 +222,9 @@ function M.get_kind_filter(buf)
if M.kind_filter[ft] == false then if M.kind_filter[ft] == false then
return return
end end
if type(M.kind_filter[ft]) == "table" then
return M.kind_filter[ft]
end
---@diagnostic disable-next-line: return-type-mismatch ---@diagnostic disable-next-line: return-type-mismatch
return type(M.kind_filter) == "table" and type(M.kind_filter.default) == "table" and M.kind_filter.default or nil return type(M.kind_filter) == "table" and type(M.kind_filter.default) == "table" and M.kind_filter.default or nil
end end
@ -224,7 +233,7 @@ end
function M.load(name) function M.load(name)
local function _load(mod) local function _load(mod)
if require("lazy.core.cache").find(mod)[1] then if require("lazy.core.cache").find(mod)[1] then
Util.try(function() LazyVim.try(function()
require(mod) require(mod)
end, { msg = "Failed loading " .. mod }) end, { msg = "Failed loading " .. mod })
end end
@ -254,19 +263,19 @@ function M.init()
end end
package.preload["lazyvim.plugins.lsp.format"] = function() package.preload["lazyvim.plugins.lsp.format"] = function()
Util.deprecate([[require("lazyvim.plugins.lsp.format")]], [[require("lazyvim.util").format]]) LazyVim.deprecate([[require("lazyvim.plugins.lsp.format")]], [[LazyVim.format]])
return Util.format return LazyVim.format
end end
-- delay notifications till vim.notify was replaced or after 500ms -- delay notifications till vim.notify was replaced or after 500ms
require("lazyvim.util").lazy_notify() LazyVim.lazy_notify()
-- load options here, before lazy init while sourcing plugin modules -- load options here, before lazy init while sourcing plugin modules
-- this is needed to make sure options will be correctly applied -- this is needed to make sure options will be correctly applied
-- after installing missing plugins -- after installing missing plugins
M.load("options") M.load("options")
Util.plugin.setup() LazyVim.plugin.setup()
M.json.load() M.json.load()
end end

View file

@ -1,9 +1,8 @@
-- This file is automatically loaded by lazyvim.config.init -- This file is automatically loaded by lazyvim.config.init
local Util = require("lazyvim.util")
-- DO NOT USE THIS IN YOU OWN CONFIG!! -- DO NOT USE THIS IN YOU OWN CONFIG!!
-- use `vim.keymap.set` instead -- use `vim.keymap.set` instead
local map = Util.safe_keymap_set local map = LazyVim.safe_keymap_set
-- better up/down -- better up/down
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
@ -12,35 +11,35 @@ map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true
map({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) map({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
-- Move to window using the <ctrl> hjkl keys -- Move to window using the <ctrl> hjkl keys
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true }) map("n", "<C-h>", "<C-w>h", { desc = "Go to Left Window", remap = true })
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true }) map("n", "<C-j>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true }) map("n", "<C-k>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true }) map("n", "<C-l>", "<C-w>l", { desc = "Go to Right Window", remap = true })
-- Resize window using <ctrl> arrow keys -- Resize window using <ctrl> arrow keys
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" }) map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase Window Height" })
map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" }) map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease Window Height" })
map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" }) map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease Window Width" })
map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" }) map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase Window Width" })
-- Move Lines -- Move Lines
map("n", "<A-j>", "<cmd>m .+1<cr>==", { desc = "Move down" }) map("n", "<A-j>", "<cmd>m .+1<cr>==", { desc = "Move Down" })
map("n", "<A-k>", "<cmd>m .-2<cr>==", { desc = "Move up" }) map("n", "<A-k>", "<cmd>m .-2<cr>==", { desc = "Move Up" })
map("i", "<A-j>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" }) map("i", "<A-j>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move Down" })
map("i", "<A-k>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" }) map("i", "<A-k>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move Up" })
map("v", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move down" }) map("v", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move Down" })
map("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move up" }) map("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move Up" })
-- buffers -- buffers
map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" }) map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" }) map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
map("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev buffer" }) map("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
map("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" }) map("n", "]b", "<cmd>bnext<cr>", { desc = "Next Buffer" })
map("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" }) map("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
map("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" }) map("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
-- Clear search with <esc> -- Clear search with <esc>
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" }) map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and Clear hlsearch" })
-- Clear search, diff update and redraw -- Clear search, diff update and redraw
-- taken from runtime/lua/_editor.lua -- taken from runtime/lua/_editor.lua
@ -48,16 +47,16 @@ map(
"n", "n",
"<leader>ur", "<leader>ur",
"<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>", "<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>",
{ desc = "Redraw / clear hlsearch / diff update" } { desc = "Redraw / Clear hlsearch / Diff Update" }
) )
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next Search Result" })
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next Search Result" })
map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next Search Result" })
map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev Search Result" })
map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev Search Result" })
map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev Search Result" })
-- Add undo break-points -- Add undo break-points
map("i", ",", ",<c-g>u") map("i", ",", ",<c-g>u")
@ -65,7 +64,7 @@ map("i", ".", ".<c-g>u")
map("i", ";", ";<c-g>u") map("i", ";", ";<c-g>u")
-- save file -- save file
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" }) map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save File" })
--keywordprg --keywordprg
map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" }) map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" })
@ -83,12 +82,12 @@ map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
map("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" }) map("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" })
map("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" }) map("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" })
map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) map("n", "[q", vim.cmd.cprev, { desc = "Previous Quickfix" })
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) map("n", "]q", vim.cmd.cnext, { desc = "Next Quickfix" })
-- formatting -- formatting
map({ "n", "v" }, "<leader>cf", function() map({ "n", "v" }, "<leader>cf", function()
Util.format({ force = true }) LazyVim.format({ force = true })
end, { desc = "Format" }) end, { desc = "Format" })
-- diagnostic -- diagnostic
@ -110,56 +109,62 @@ map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
-- stylua: ignore start -- stylua: ignore start
-- toggle options -- toggle options
map("n", "<leader>uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" }) map("n", "<leader>uf", function() LazyVim.format.toggle() end, { desc = "Toggle Auto Format (Global)" })
map("n", "<leader>uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" }) map("n", "<leader>uF", function() LazyVim.format.toggle(true) end, { desc = "Toggle Auto Format (Buffer)" })
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" }) map("n", "<leader>us", function() LazyVim.toggle("spell") end, { desc = "Toggle Spelling" })
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" }) map("n", "<leader>uw", function() LazyVim.toggle("wrap") end, { desc = "Toggle Word Wrap" })
map("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" }) map("n", "<leader>uL", function() LazyVim.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
map("n", "<leader>ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" }) map("n", "<leader>ul", function() LazyVim.toggle.number() end, { desc = "Toggle Line Numbers" })
map("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" }) map("n", "<leader>ud", function() LazyVim.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) map("n", "<leader>uc", function() LazyVim.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
map( "n", "<leader>uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) map( "n", "<leader>uh", function() LazyVim.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
end end
map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" })
map("n", "<leader>ub", function() LazyVim.toggle("background", false, {"light", "dark"}) end, { desc = "Toggle Background" })
-- lazygit -- lazygit
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) map("n", "<leader>gg", function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
map("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) map("n", "<leader>gG", function() LazyVim.lazygit() end, { desc = "Lazygit (cwd)" })
map("n", "<leader>gf", function()
local git_path = vim.api.nvim_buf_get_name(0)
LazyVim.lazygit({args = { "-f", vim.trim(git_path) }})
end, { desc = "Lazygit Current File History" })
-- quit -- quit
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" }) map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })
-- highlights under cursor -- highlights under cursor
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" }) map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
-- LazyVim Changelog -- LazyVim Changelog
map("n", "<leader>L", function() Util.news.changelog() end, { desc = "LazyVim Changelog" }) map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" })
-- floating terminal -- floating terminal
local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end local lazyterm = function() LazyVim.terminal(nil, { cwd = LazyVim.root() }) end
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" }) map("n", "<leader>ft", lazyterm, { desc = "Terminal (Root Dir)" })
map("n", "<leader>fT", function() Util.terminal() end, { desc = "Terminal (cwd)" }) map("n", "<leader>fT", function() LazyVim.terminal() end, { desc = "Terminal (cwd)" })
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" }) map("n", "<c-/>", lazyterm, { desc = "Terminal (Root Dir)" })
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" }) map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })
-- Terminal Mappings -- Terminal Mappings
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" }) map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" }) map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to Left Window" })
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" }) map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to Lower Window" })
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" }) map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to Upper Window" })
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" }) map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to Right Window" })
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" }) map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" }) map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
-- windows -- windows
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true }) map("n", "<leader>ww", "<C-W>p", { desc = "Other Window", remap = true })
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true }) map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true }) map("n", "<leader>w-", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true }) map("n", "<leader>w|", "<C-W>v", { desc = "Split Window Right", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true }) map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true }) map("n", "<leader>|", "<C-W>v", { desc = "Split Window Right", remap = true })
-- tabs -- tabs
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" }) map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })

View file

@ -12,12 +12,31 @@ vim.g.autoformat = true
-- * a function with signature `function(buf) -> string|string[]` -- * a function with signature `function(buf) -> string|string[]`
vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
-- LazyVim automatically configures lazygit:
-- * theme, based on the active colorscheme.
-- * editorPreset to nvim-remote
-- * enables nerd font icons
-- Set to false to disable.
vim.g.lazygit_config = true
-- Optionally setup the terminal to use
-- This sets `vim.o.shell` and does some additional configuration for:
-- * pwsh
-- * powershell
-- LazyVim.terminal.setup("pwsh")
local opt = vim.opt local opt = vim.opt
opt.autowrite = true -- Enable auto write opt.autowrite = true -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
if not vim.env.SSH_TTY then
-- only set clipboard if not in ssh, to make sure the OSC 52
-- integration works automatically. Requires Neovim >= 0.10.0
opt.clipboard = "unnamedplus" -- Sync with system clipboard
end
opt.completeopt = "menu,menuone,noselect" opt.completeopt = "menu,menuone,noselect"
opt.conceallevel = 3 -- Hide * markup for bold and italic opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions
opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.confirm = true -- Confirm to save changes before exiting modified buffer
opt.cursorline = true -- Enable highlighting of the current line opt.cursorline = true -- Enable highlighting of the current line
opt.expandtab = true -- Use spaces instead of tabs opt.expandtab = true -- Use spaces instead of tabs
@ -49,7 +68,9 @@ opt.splitkeep = "screen"
opt.splitright = true -- Put new windows right of current opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support opt.termguicolors = true -- True color support
opt.timeoutlen = 300 if not vim.g.vscode then
opt.timeoutlen = 300 -- Lower than default (1000) to quickly trigger which-key
end
opt.undofile = true opt.undofile = true
opt.undolevels = 10000 opt.undolevels = 10000
opt.updatetime = 200 -- Save swap file and trigger CursorHold opt.updatetime = 200 -- Save swap file and trigger CursorHold
@ -60,7 +81,6 @@ opt.wrap = false -- Disable line wrap
opt.fillchars = { opt.fillchars = {
foldopen = "", foldopen = "",
foldclose = "", foldclose = "",
-- fold = "⸱",
fold = " ", fold = " ",
foldsep = " ", foldsep = " ",
diff = "", diff = "",
@ -73,16 +93,18 @@ end
-- Folding -- Folding
vim.opt.foldlevel = 99 vim.opt.foldlevel = 99
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
if vim.fn.has("nvim-0.9.0") == 1 then if vim.fn.has("nvim-0.9.0") == 1 then
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]] vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]]
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
end end
-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
if vim.fn.has("nvim-0.10") == 1 then if vim.fn.has("nvim-0.10") == 1 then
vim.opt.foldmethod = "expr" vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
vim.opt.foldtext = ""
vim.opt.fillchars = "fold: "
else else
vim.opt.foldmethod = "indent" vim.opt.foldmethod = "indent"
end end

View file

@ -1,3 +1,5 @@
vim.uv = vim.uv or vim.loop
local M = {} local M = {}
---@param opts? LazyVimConfig ---@param opts? LazyVimConfig

View file

@ -1,35 +1,5 @@
return { return {
-- snippets
{
"L3MON4D3/LuaSnip",
build = (not jit.os:find("Windows"))
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
or nil,
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
opts = {
history = true,
delete_check_events = "TextChanged",
},
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true, silent = true, mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
-- auto completion -- auto completion
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -39,21 +9,26 @@ return {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
}, },
-- Not all LSP servers add brackets when completing a function.
-- To better deal with this, LazyVim adds a custom option to cmp,
-- that you can configure. For example:
--
-- ```lua
-- opts = {
-- auto_brackets = { "python" }
-- }
-- ```
opts = function() opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp") local cmp = require("cmp")
local defaults = require("cmp.config.default")() local defaults = require("cmp.config.default")()
return { return {
auto_brackets = {}, -- configure any filetype to auto add brackets
completion = { completion = {
completeopt = "menu,menuone,noinsert", completeopt = "menu,menuone,noinsert",
}, },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
@ -73,7 +48,6 @@ return {
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" }, { name = "path" },
}, { }, {
{ name = "buffer" }, { name = "buffer" },
@ -95,15 +69,74 @@ return {
sorting = defaults.sorting, sorting = defaults.sorting,
} }
end, end,
---@param opts cmp.ConfigSchema ---@param opts cmp.ConfigSchema | {auto_brackets?: string[]}
config = function(_, opts) config = function(_, opts)
for _, source in ipairs(opts.sources) do for _, source in ipairs(opts.sources) do
source.group_index = source.group_index or 1 source.group_index = source.group_index or 1
end end
require("cmp").setup(opts) 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) then
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
vim.api.nvim_feedkeys(keys, "i", true)
end
end)
end, end,
}, },
-- snippets
{
"L3MON4D3/LuaSnip",
build = (not LazyVim.is_win())
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
or nil,
dependencies = {
{
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{
"nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
},
opts = function(_, opts)
opts.snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
}
table.insert(opts.sources, { name = "luasnip" })
end,
},
},
opts = {
history = true,
delete_check_events = "TextChanged",
},
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true, silent = true, mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
-- auto pairs -- auto pairs
{ {
"echasnovski/mini.pairs", "echasnovski/mini.pairs",
@ -113,15 +146,14 @@ return {
{ {
"<leader>up", "<leader>up",
function() function()
local Util = require("lazy.core.util")
vim.g.minipairs_disable = not vim.g.minipairs_disable vim.g.minipairs_disable = not vim.g.minipairs_disable
if vim.g.minipairs_disable then if vim.g.minipairs_disable then
Util.warn("Disabled auto pairs", { title = "Option" }) LazyVim.warn("Disabled auto pairs", { title = "Option" })
else else
Util.info("Enabled auto pairs", { title = "Option" }) LazyVim.info("Enabled auto pairs", { title = "Option" })
end end
end, end,
desc = "Toggle auto pairs", desc = "Toggle Auto Pairs",
}, },
}, },
}, },
@ -137,12 +169,12 @@ return {
local plugin = require("lazy.core.config").spec.plugins["mini.surround"] local plugin = require("lazy.core.config").spec.plugins["mini.surround"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false) local opts = require("lazy.core.plugin").values(plugin, "opts", false)
local mappings = { local mappings = {
{ opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } }, { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } },
{ opts.mappings.delete, desc = "Delete surrounding" }, { opts.mappings.delete, desc = "Delete Surrounding" },
{ opts.mappings.find, desc = "Find right surrounding" }, { opts.mappings.find, desc = "Find Right Surrounding" },
{ opts.mappings.find_left, desc = "Find left surrounding" }, { opts.mappings.find_left, desc = "Find Left Surrounding" },
{ opts.mappings.highlight, desc = "Highlight surrounding" }, { opts.mappings.highlight, desc = "Highlight Surrounding" },
{ opts.mappings.replace, desc = "Replace surrounding" }, { opts.mappings.replace, desc = "Replace Surrounding" },
{ opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
} }
mappings = vim.tbl_filter(function(m) mappings = vim.tbl_filter(function(m)
@ -203,13 +235,33 @@ return {
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" }, t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" },
d = { "%f[%d]%d+" }, -- digits
e = { -- Word with case
{
"%u[%l%d]+%f[^%l%d]",
"%f[%S][%l%d]+%f[^%l%d]",
"%f[%P][%l%d]+%f[^%l%d]",
"^[%l%d]+%f[^%l%d]",
},
"^().*()$",
},
g = function() -- Whole buffer, similar to `gg` and 'G' motion
local from = { line = 1, col = 1 }
local to = {
line = vim.fn.line("$"),
col = math.max(vim.fn.getline("$"):len(), 1),
}
return { from = from, to = to }
end,
u = ai.gen_spec.function_call(), -- u for "Usage"
U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name
}, },
} }
end, end,
config = function(_, opts) config = function(_, opts)
require("mini.ai").setup(opts) require("mini.ai").setup(opts)
-- register all text objects with which-key -- register all text objects with which-key
require("lazyvim.util").on_load("which-key.nvim", function() LazyVim.on_load("which-key.nvim", function()
---@type table<string, string|table> ---@type table<string, string|table>
local i = { local i = {
[" "] = "Whitespace", [" "] = "Whitespace",
@ -229,10 +281,15 @@ return {
a = "Argument", a = "Argument",
b = "Balanced ), ], }", b = "Balanced ), ], }",
c = "Class", c = "Class",
d = "Digit(s)",
e = "Word in CamelCase & snake_case",
f = "Function", f = "Function",
g = "Entire file",
o = "Block, conditional, loop", o = "Block, conditional, loop",
q = "Quote `, \", '", q = "Quote `, \", '",
t = "Tag", t = "Tag",
u = "Use/call function & method",
U = "Use/call without dot in name",
} }
local a = vim.deepcopy(i) local a = vim.deepcopy(i)
for k, v in pairs(a) do for k, v in pairs(a) do

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
return { return {
-- file explorer -- file explorer
@ -11,32 +9,32 @@ return {
{ {
"<leader>fe", "<leader>fe",
function() function()
require("neo-tree.command").execute({ toggle = true, dir = Util.root() }) require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
end, end,
desc = "Explorer NeoTree (root dir)", desc = "Explorer NeoTree (Root Dir)",
}, },
{ {
"<leader>fE", "<leader>fE",
function() function()
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() }) require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
end, end,
desc = "Explorer NeoTree (cwd)", desc = "Explorer NeoTree (cwd)",
}, },
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (root dir)", remap = true }, { "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true }, { "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
{ {
"<leader>ge", "<leader>ge",
function() function()
require("neo-tree.command").execute({ source = "git_status", toggle = true }) require("neo-tree.command").execute({ source = "git_status", toggle = true })
end, end,
desc = "Git explorer", desc = "Git Explorer",
}, },
{ {
"<leader>be", "<leader>be",
function() function()
require("neo-tree.command").execute({ source = "buffers", toggle = true }) require("neo-tree.command").execute({ source = "buffers", toggle = true })
end, end,
desc = "Buffer explorer", desc = "Buffer Explorer",
}, },
}, },
deactivate = function() deactivate = function()
@ -44,7 +42,7 @@ return {
end, end,
init = function() init = function()
if vim.fn.argc(-1) == 1 then if vim.fn.argc(-1) == 1 then
local stat = vim.loop.fs_stat(vim.fn.argv(0)) local stat = vim.uv.fs_stat(vim.fn.argv(0))
if stat and stat.type == "directory" then if stat and stat.type == "directory" then
require("neo-tree") require("neo-tree")
end end
@ -61,6 +59,20 @@ return {
window = { window = {
mappings = { mappings = {
["<space>"] = "none", ["<space>"] = "none",
["Y"] = {
function(state)
local node = state.tree:get_node()
local path = node:get_id()
vim.fn.setreg("+", path, "c")
end,
desc = "Copy Path to Clipboard",
},
["O"] = {
function(state)
require("lazy.util").open(state.tree:get_node().path, { system = true })
end,
desc = "Open with System Application",
},
}, },
}, },
default_component_configs = { default_component_configs = {
@ -74,7 +86,7 @@ return {
}, },
config = function(_, opts) config = function(_, opts)
local function on_move(data) local function on_move(data)
Util.lsp.on_rename(data.source, data.destination) LazyVim.lsp.on_rename(data.source, data.destination)
end end
local events = require("neo-tree.events") local events = require("neo-tree.events")
@ -103,7 +115,7 @@ return {
opts = { open_cmd = "noswapfile vnew" }, opts = { open_cmd = "noswapfile vnew" },
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" }, { "<leader>sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" },
}, },
}, },
@ -118,10 +130,11 @@ return {
dependencies = { dependencies = {
{ {
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
build = "make", build = vim.fn.executable("make") == 1 and "make"
enabled = vim.fn.executable("make") == 1, or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
enabled = vim.fn.executable("make") == 1 or vim.fn.executable("cmake") == 1,
config = function() config = function()
Util.on_load("telescope.nvim", function() LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("fzf") require("telescope").load_extension("fzf")
end) end)
end, end,
@ -133,41 +146,45 @@ return {
"<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>",
desc = "Switch Buffer", desc = "Switch Buffer",
}, },
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { "<leader>/", LazyVim.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" }, { "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" }, { "<leader><space>", LazyVim.telescope("files"), desc = "Find Files (root dir)" },
{ "<leader>/", LazyVim.telescope("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.telescope("files"), desc = "Find Files (Root Dir)" },
-- find -- find
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" }, { "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", Util.telescope.config_files(), desc = "Find Config File" }, { "<leader>fc", LazyVim.telescope.config_files(), desc = "Find Config File" },
{ "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" }, { "<leader>ff", LazyVim.telescope("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, { "<leader>fF", LazyVim.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" }, { "<leader>fg", "<cmd>Telescope git_files<cr>", desc = "Find Files (git-files)" },
{ "<leader>fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" }, { "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", LazyVim.telescope("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },
-- git -- git
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" }, { "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Commits" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" }, { "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Status" },
-- search -- search
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" }, { '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" }, { "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" }, { "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" }, { "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" }, { "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" }, { "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document Diagnostics" },
{ "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" }, { "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace Diagnostics" },
{ "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { "<leader>sg", LazyVim.telescope("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, { "<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 help_tags<cr>", desc = "Help Pages" },
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" }, { "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" }, { "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" }, { "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" }, { "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" }, { "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" }, { "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
{ "<leader>sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" }, { "<leader>sw", LazyVim.telescope("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" }, { "<leader>sW", LazyVim.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
{ "<leader>sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" }, { "<leader>sw", LazyVim.telescope("grep_string"), mode = "v", desc = "Selection (Root Dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" }, { "<leader>sW", LazyVim.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" },
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" }, { "<leader>uC", LazyVim.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
{ {
"<leader>ss", "<leader>ss",
function() function()
@ -199,12 +216,12 @@ return {
local find_files_no_ignore = function() local find_files_no_ignore = function()
local action_state = require("telescope.actions.state") local action_state = require("telescope.actions.state")
local line = action_state.get_current_line() local line = action_state.get_current_line()
Util.telescope("find_files", { no_ignore = true, default_text = line })() LazyVim.telescope("find_files", { no_ignore = true, default_text = line })()
end end
local find_files_with_hidden = function() local find_files_with_hidden = function()
local action_state = require("telescope.actions.state") local action_state = require("telescope.actions.state")
local line = action_state.get_current_line() local line = action_state.get_current_line()
Util.telescope("find_files", { hidden = true, default_text = line })() LazyVim.telescope("find_files", { hidden = true, default_text = line })()
end end
return { return {
@ -268,7 +285,7 @@ return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
optional = true, optional = true,
opts = function(_, opts) opts = function(_, opts)
if not Util.has("flash.nvim") then if not LazyVim.has("flash.nvim") then
return return
end end
local function flash(prompt_bufnr) local function flash(prompt_bufnr)
@ -306,6 +323,7 @@ return {
mode = { "n", "v" }, mode = { "n", "v" },
["g"] = { name = "+goto" }, ["g"] = { name = "+goto" },
["gs"] = { name = "+surround" }, ["gs"] = { name = "+surround" },
["z"] = { name = "+fold" },
["]"] = { name = "+next" }, ["]"] = { name = "+next" },
["["] = { name = "+prev" }, ["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" }, ["<leader><tab>"] = { name = "+tabs" },
@ -358,7 +376,7 @@ return {
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer") map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer") map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk") map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk Inline")
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line") map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "<leader>ghd", gs.diffthis, "Diff This") map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~") map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
@ -457,7 +475,7 @@ return {
end end
end end
end, end,
desc = "Previous trouble/quickfix item", desc = "Previous Trouble/Quickfix Item",
}, },
{ {
"]q", "]q",
@ -471,7 +489,7 @@ return {
end end
end end
end, end,
desc = "Next trouble/quickfix item", desc = "Next Trouble/Quickfix Item",
}, },
}, },
}, },
@ -485,12 +503,12 @@ return {
config = true, config = true,
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" },
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" }, { "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" }, { "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" }, { "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" }, { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
}, },
}, },
} }

View file

@ -27,7 +27,7 @@ return {
optional = true, optional = true,
event = "VeryLazy", event = "VeryLazy",
opts = function(_, opts) opts = function(_, opts)
table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("codeium")) table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium"))
end, end,
}, },
} }

View file

@ -19,12 +19,11 @@ return {
optional = true, optional = true,
event = "VeryLazy", event = "VeryLazy",
opts = function(_, opts) opts = function(_, opts)
local Util = require("lazyvim.util")
local colors = { local colors = {
[""] = Util.ui.fg("Special"), [""] = LazyVim.ui.fg("Special"),
["Normal"] = Util.ui.fg("Special"), ["Normal"] = LazyVim.ui.fg("Special"),
["Warning"] = Util.ui.fg("DiagnosticError"), ["Warning"] = LazyVim.ui.fg("DiagnosticError"),
["InProgress"] = Util.ui.fg("DiagnosticWarn"), ["InProgress"] = LazyVim.ui.fg("DiagnosticWarn"),
} }
table.insert(opts.sections.lualine_x, 2, { table.insert(opts.sections.lualine_x, 2, {
function() function()
@ -36,7 +35,7 @@ return {
if not package.loaded["copilot"] then if not package.loaded["copilot"] then
return return
end end
local ok, clients = pcall(require("lazyvim.util").lsp.get_clients, { name = "copilot", bufnr = 0 }) local ok, clients = pcall(LazyVim.lsp.get_clients, { name = "copilot", bufnr = 0 })
if not ok then if not ok then
return false return false
end end
@ -66,7 +65,7 @@ return {
copilot_cmp.setup(opts) copilot_cmp.setup(opts)
-- attach cmp source whenever copilot attaches -- attach cmp source whenever copilot attaches
-- fixes lazy-loading issues with the copilot cmp source -- fixes lazy-loading issues with the copilot cmp source
require("lazyvim.util").lsp.on_attach(function(client) LazyVim.lsp.on_attach(function(client)
if client.name == "copilot" then if client.name == "copilot" then
copilot_cmp._on_insert_enter({}) copilot_cmp._on_insert_enter({})
end end

View file

@ -0,0 +1,64 @@
if not vim.snippet then
LazyVim.warn("Native snippets are only supported on Neovim >= 0.10.0")
return {}
end
return {
desc = "Use native snippets instead of LuaSnip. Only works on Neovim >= 0.10!",
{
"L3MON4D3/LuaSnip",
enabled = false,
},
{
"nvim-cmp",
opts = {
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
},
keys = {
{
"<Tab>",
function()
if vim.snippet.jumpable(1) then
vim.schedule(function()
vim.snippet.jump(1)
end)
return
end
return "<Tab>"
end,
expr = true,
silent = true,
mode = "i",
},
{
"<Tab>",
function()
vim.schedule(function()
vim.snippet.jump(1)
end)
end,
silent = true,
mode = "s",
},
{
"<S-Tab>",
function()
if vim.snippet.jumpable(-1) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
return
end
return "<S-Tab>"
end,
expr = true,
silent = true,
mode = { "i", "s" },
},
},
},
}

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
return { return {
-- Tabnine cmp source -- Tabnine cmp source
{ {
@ -8,7 +6,7 @@ return {
{ {
"tzachar/cmp-tabnine", "tzachar/cmp-tabnine",
build = { build = {
Util.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh", LazyVim.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh",
":CmpTabnineHub", ":CmpTabnineHub",
}, },
dependencies = "hrsh7th/nvim-cmp", dependencies = "hrsh7th/nvim-cmp",
@ -30,7 +28,7 @@ return {
priority = 100, priority = 100,
}) })
opts.formatting.format = Util.inject.args(opts.formatting.format, function(entry, item) opts.formatting.format = LazyVim.inject.args(opts.formatting.format, function(entry, item)
-- Hide percentage in the menu -- Hide percentage in the menu
if entry.source.name == "cmp_tabnine" then if entry.source.name == "cmp_tabnine" then
item.menu = "" item.menu = ""
@ -45,7 +43,7 @@ return {
event = "VeryLazy", event = "VeryLazy",
opts = function(_, opts) opts = function(_, opts)
local icon = require("lazyvim.config").icons.kinds.TabNine local icon = require("lazyvim.config").icons.kinds.TabNine
table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("cmp_tabnine", icon)) table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("cmp_tabnine", icon))
end, end,
}, },
} }

View file

@ -2,31 +2,31 @@ return {
-- better yank/paste -- better yank/paste
{ {
"gbprod/yanky.nvim", "gbprod/yanky.nvim",
dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } }, dependencies = not LazyVim.is_win() and { "kkharji/sqlite.lua" } or {},
opts = { opts = {
highlight = { timer = 250 }, highlight = { timer = 250 },
ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" }, ring = { storage = LazyVim.is_win() and "shada" or "sqlite" },
}, },
keys = { keys = {
-- stylua: ignore -- stylua: ignore
{ "<leader>p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" }, { "<leader>p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" },
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" }, { "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" },
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" }, { "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Cursor" },
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" }, { "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Cursor" },
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" }, { "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Yanked Text After Selection" },
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" }, { "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Yanked Text Before Selection" },
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" }, { "[y", "<Plug>(YankyCycleForward)", desc = "Cycle Forward Through Yank History" },
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" }, { "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, { "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, { "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, { "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, { "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" }, { ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" },
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" }, { "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" },
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" }, { ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" },
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" }, { "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" },
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" }, { "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put After Applying a Filter" },
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" }, { "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" },
}, },
}, },
} }

View file

@ -18,6 +18,7 @@ return {
-- fancy UI for the debugger -- fancy UI for the debugger
{ {
"rcarriga/nvim-dap-ui", "rcarriga/nvim-dap-ui",
dependencies = { "nvim-neotest/nvim-nio" },
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, { "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
@ -89,7 +90,7 @@ return {
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" }, { "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
{ "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, { "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, { "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" }, { "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" }, { "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
{ "<leader>dj", function() require("dap").down() end, desc = "Down" }, { "<leader>dj", function() require("dap").down() end, desc = "Down" },
{ "<leader>dk", function() require("dap").up() end, desc = "Up" }, { "<leader>dk", function() require("dap").up() end, desc = "Up" },

View file

@ -1,5 +1,4 @@
local Config = require("lazyvim.config") local Config = require("lazyvim.config")
local Util = require("lazyvim.util")
return { return {
desc = "Aerial Symbol Browser", desc = "Aerial Symbol Browser",
@ -55,7 +54,7 @@ return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
optional = true, optional = true,
opts = function() opts = function()
Util.on_load("telescope.nvim", function() LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("aerial") require("telescope").load_extension("aerial")
end) end)
end, end,
@ -73,11 +72,11 @@ return {
"folke/edgy.nvim", "folke/edgy.nvim",
optional = true, optional = true,
opts = function(_, opts) opts = function(_, opts)
local edgy_idx = Util.plugin.extra_idx("ui.edgy") local edgy_idx = LazyVim.plugin.extra_idx("ui.edgy")
local aerial_idx = Util.plugin.extra_idx("editor.aerial") local aerial_idx = LazyVim.plugin.extra_idx("editor.aerial")
if edgy_idx and edgy_idx > aerial_idx then if edgy_idx and edgy_idx > aerial_idx then
Util.warn("The `edgy.nvim` extra must be **imported** before the `aerial.nvim` extra to work properly.", { LazyVim.warn("The `edgy.nvim` extra must be **imported** before the `aerial.nvim` extra to work properly.", {
title = "LazyVim", title = "LazyVim",
}) })
end end

View file

@ -0,0 +1,171 @@
local M = {}
---@type table<string, table<string, string[]>>
M.dials_by_ft = {}
---@param increment boolean
---@param g? boolean
function M.dial(increment, g)
local is_visual = vim.fn.mode(true):sub(1, 1) == "v"
local func = (increment and "inc" or "dec") .. (g and "_g" or "_") .. (is_visual and "visual" or "normal")
local group = M.dials_by_ft[vim.bo.filetype] or "default"
return require("dial.map")[func](group)
end
return {
"monaqa/dial.nvim",
-- stylua: ignore
keys = {
{ "<C-a>", function() return M.dial(true) end, expr = true, desc = "Increment", mode = {"n", "v"} },
{ "<C-x>", function() return M.dial(false) end, expr = true, desc = "Decrement", mode = {"n", "v"} },
{ "g<C-a>", function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "v"} },
{ "g<C-x>", function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "v"} },
},
opts = function()
local augend = require("dial.augend")
local logical_alias = augend.constant.new({
elements = { "&&", "||" },
word = false,
cyclic = true,
})
local ordinal_numbers = augend.constant.new({
-- elements through which we cycle. When we increment, we go down
-- On decrement we go up
elements = {
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eighth",
"ninth",
"tenth",
},
-- if true, it only matches strings with word boundary. firstDate wouldn't work for example
word = false,
-- do we cycle back and forth (tenth to first on increment, first to tenth on decrement).
-- Otherwise nothing will happen when there are no further values
cyclic = true,
})
local weekdays = augend.constant.new({
elements = {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
},
word = true,
cyclic = true,
})
local months = augend.constant.new({
elements = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
},
word = true,
cyclic = true,
})
local capitalized_boolean = augend.constant.new({
elements = {
"True",
"False",
},
word = true,
cyclic = true,
})
return {
dials_by_ft = {
css = "css",
javascript = "typescript",
javascriptreact = "typescript",
json = "json",
lua = "lua",
markdown = "markdown",
python = "python",
sass = "css",
scss = "css",
typescript = "typescript",
typescriptreact = "typescript",
},
groups = {
default = {
augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...)
augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.)
augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.)
},
typescript = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
logical_alias,
augend.constant.new({ elements = { "let", "const" } }),
ordinal_numbers,
weekdays,
months,
},
css = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.hexcolor.new({
case = "lower",
}),
augend.hexcolor.new({
case = "upper",
}),
},
markdown = {
augend.misc.alias.markdown_header,
ordinal_numbers,
weekdays,
months,
},
json = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.semver.alias.semver, -- versioning (v1.1.2)
},
lua = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
augend.constant.new({
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and".
}),
ordinal_numbers,
weekdays,
months,
},
python = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
capitalized_boolean,
logical_alias,
ordinal_numbers,
weekdays,
months,
},
},
}
end,
config = function(_, opts)
require("dial.config").augends:register_group(opts.groups)
M.dials_by_ft = opts.dials_by_ft
end,
}

View file

@ -0,0 +1,39 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
opts = {
menu = {
width = vim.api.nvim_win_get_width(0) - 4,
},
},
keys = function()
local keys = {
{
"<leader>H",
function()
require("harpoon"):list():append()
end,
desc = "Harpoon File",
},
{
"<leader>h",
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end,
desc = "Harpoon Quick Menu",
}
}
for i = 1, 5 do
table.insert(keys, {
"<leader>" .. i,
function()
require("harpoon"):list():select(i)
end,
desc = "Harpoon to File " .. i,
})
end
return keys
end
}

View file

@ -20,9 +20,9 @@ return {
"ggandor/leap.nvim", "ggandor/leap.nvim",
enabled = true, enabled = true,
keys = { keys = {
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" }, { "s", mode = { "n", "x", "o" }, desc = "Leap Forward to" },
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" }, { "S", mode = { "n", "x", "o" }, desc = "Leap Backward to" },
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" }, { "gs", mode = { "n", "x", "o" }, desc = "Leap from Windows" },
}, },
config = function(_, opts) config = function(_, opts)
local leap = require("leap") local leap = require("leap")

View file

@ -0,0 +1,54 @@
return {
-- disable gitsigns.nvim
{
"lewis6991/gitsigns.nvim",
enabled = false,
},
-- setup mini.diff
{
"echasnovski/mini.diff",
event = "VeryLazy",
keys = {
{
"<leader>go",
function()
require("mini.diff").toggle_overlay(0)
end,
desc = "Toggle mini.diff overlay",
},
},
opts = {
view = {
style = "sign",
signs = {
add = "",
change = "",
delete = "",
},
},
},
},
-- lualine integration
{
"nvim-lualine/lualine.nvim",
opts = function(_, opts)
local x = opts.sections.lualine_x
for _, comp in ipairs(x) do
if comp[1] == "diff" then
comp.source = function()
local summary = vim.b.minidiff_summary
return summary
and {
added = summary.add,
modified = summary.change,
removed = summary.delete,
}
end
break
end
end
end,
},
}

View file

@ -18,12 +18,12 @@ return {
function() function()
require("mini.files").open(vim.api.nvim_buf_get_name(0), true) require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
end, end,
desc = "Open mini.files (directory of current file)", desc = "Open mini.files (Directory of Current File)",
}, },
{ {
"<leader>fM", "<leader>fM",
function() function()
require("mini.files").open(vim.loop.cwd(), true) require("mini.files").open(vim.uv.cwd(), true)
end, end,
desc = "Open mini.files (cwd)", desc = "Open mini.files (cwd)",
}, },
@ -50,14 +50,14 @@ return {
callback = function(args) callback = function(args)
local buf_id = args.data.buf_id local buf_id = args.data.buf_id
-- Tweak left-hand side of mapping to your liking -- Tweak left-hand side of mapping to your liking
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id }) vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id, desc = "Toggle Hidden Files" })
end, end,
}) })
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesActionRename", pattern = "MiniFilesActionRename",
callback = function(event) callback = function(event)
require("lazyvim.util").lsp.on_rename(event.data.from, event.data.to) LazyVim.lsp.on_rename(event.data.from, event.data.to)
end, end,
}) })
end, end,

View file

@ -0,0 +1,7 @@
return {
{
"echasnovski/mini.move",
event = "VeryLazy",
opts = {},
},
}

View file

@ -7,7 +7,7 @@ return {
lazy = true, lazy = true,
init = function() init = function()
vim.g.navic_silence = true vim.g.navic_silence = true
require("lazyvim.util").lsp.on_attach(function(client, buffer) LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/documentSymbol") then if client.supports_method("textDocument/documentSymbol") then
require("nvim-navic").attach(client, buffer) require("nvim-navic").attach(client, buffer)
end end

View file

@ -1,13 +1,11 @@
local Util = require("lazyvim.util")
return { return {
{ {
"simrat39/symbols-outline.nvim", "hedyhli/outline.nvim",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } }, keys = { { "<leader>cs", "<cmd>Outline<cr>", desc = "Toggle Outline" } },
cmd = "SymbolsOutline", cmd = "Outline",
opts = function() opts = function()
local Config = require("lazyvim.config") local Config = require("lazyvim.config")
local defaults = require("symbols-outline.config").defaults local defaults = require("outline.config").defaults
local opts = { local opts = {
symbols = {}, symbols = {},
symbol_blacklist = {}, symbol_blacklist = {},
@ -37,24 +35,22 @@ return {
"folke/edgy.nvim", "folke/edgy.nvim",
optional = true, optional = true,
opts = function(_, opts) opts = function(_, opts)
local edgy_idx = Util.plugin.extra_idx("ui.edgy") local edgy_idx = LazyVim.plugin.extra_idx("ui.edgy")
local symbols_idx = Util.plugin.extra_idx("editor.symbols-outline") local symbols_idx = LazyVim.plugin.extra_idx("editor.outline")
if edgy_idx and edgy_idx > symbols_idx then if edgy_idx and edgy_idx > symbols_idx then
Util.warn( LazyVim.warn(
"The `edgy.nvim` extra must be **imported** before the `symbols-outline.nvim` extra to work properly.", "The `edgy.nvim` extra must be **imported** before the `outline.nvim` extra to work properly.",
{ { title = "LazyVim" }
title = "LazyVim",
}
) )
end end
opts.right = opts.right or {} opts.right = opts.right or {}
table.insert(opts.right, { table.insert(opts.right, {
title = "Symbols Outline", title = "Outline",
ft = "Outline", ft = "Outline",
pinned = true, pinned = true,
open = "SymbolsOutline", open = "Outline",
}) })
end, end,
}, },

View file

@ -0,0 +1,77 @@
local Config = require("lazyvim.config")
for _, other in ipairs({ "aerial", "outline" }) do
local extra = "lazyvim.plugins.extras.editor." .. other
if vim.tbl_contains(Config.json.data.extras, extra) then
other = other:gsub("^%l", string.upper)
LazyVim.error({
"**Trouble v3** includes support for document symbols.",
("You currently have the **%s** extra enabled."):format(other),
"Please disable it in your config.",
})
end
end
return {
{
"folke/trouble.nvim",
branch = "dev",
keys = {
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
{ "<leader>cs", "<cmd>Trouble symbols toggle focus=false<cr>", desc = "Symbols (Trouble)" },
{
"<leader>cS",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP references/definitions/... (Trouble)",
},
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
},
},
-- lualine integration
{
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
local trouble = require("trouble")
if not trouble.statusline then
LazyVim.error("You have enabled the **trouble-v3** extra,\nbut still need to update it with `:Lazy`")
return
end
local symbols = trouble.statusline({
mode = "symbols",
groups = {},
title = false,
filter = { range = true },
format = "{kind_icon}{symbol.name:Normal}",
})
table.insert(opts.sections.lualine_c, {
symbols.get,
cond = symbols.has,
})
end,
},
{
"folke/edgy.nvim",
optional = true,
opts = function(_, opts)
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
opts[pos] = opts[pos] or {}
table.insert(opts[pos], {
ft = "trouble",
filter = function(_buf, win)
return vim.w[win].trouble
and vim.w[win].trouble.position == pos
and vim.w[win].trouble.type == "split"
and vim.w[win].trouble.relative == "editor"
and not vim.w[win].trouble_preview
end,
})
end
end,
},
}

View file

@ -0,0 +1,38 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "yaml" })
end
end,
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
-- for ansiblels validation
vim.list_extend(opts.ensure_installed, { "ansible-lint" })
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
ansiblels = {},
},
},
},
{
"mfussenegger/nvim-ansible",
keys = {
{
"<leader>tr",
function()
require("ansible").run()
end,
silent = true,
},
},
},
}

View file

@ -85,7 +85,7 @@ return {
}, },
setup = { setup = {
clangd = function(_, opts) clangd = function(_, opts)
local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim") local clangd_ext_opts = LazyVim.opts("clangd_extensions.nvim")
require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts })) require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
return false return false
end, end,

View file

@ -43,7 +43,25 @@ return {
}, },
{ {
"Civitasv/cmake-tools.nvim", "Civitasv/cmake-tools.nvim",
lazy = true,
init = function()
local loaded = false
local function check()
local cwd = vim.uv.cwd()
if vim.fn.filereadable(cwd .. "/CMakeLists.txt") == 1 then
require("lazy").load({ plugins = { "cmake-tools.nvim" } })
loaded = true
end
end
check()
vim.api.nvim_create_autocmd("DirChanged", {
callback = function()
if not loaded then
check()
end
end,
})
end,
opts = {}, opts = {},
event = "LazyFile",
}, },
} }

View file

@ -61,7 +61,7 @@ return {
gopls = function(_, opts) gopls = function(_, opts)
-- workaround for gopls not supporting semanticTokensProvider -- workaround for gopls not supporting semanticTokensProvider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242 -- https://github.com/golang/go/issues/54531#issuecomment-1464982242
require("lazyvim.util").lsp.on_attach(function(client, _) LazyVim.lsp.on_attach(function(client, _)
if client.name == "gopls" then if client.name == "gopls" then
if not client.server_capabilities.semanticTokensProvider then if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens local semantic = client.config.capabilities.textDocument.semanticTokens
@ -148,6 +148,7 @@ return {
["neotest-go"] = { ["neotest-go"] = {
-- Here we can set options for neotest-go, e.g. -- Here we can set options for neotest-go, e.g.
-- args = { "-tags=integration" } -- args = { "-tags=integration" }
recursive_run = true,
}, },
}, },
}, },

View file

@ -0,0 +1,99 @@
return {
-- Add Haskell to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "haskell" })
end
end,
},
{
"mrcjkb/haskell-tools.nvim",
version = "^3",
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
dependencies = {
{ "nvim-telescope/telescope.nvim", optional = true },
},
config = function()
local ok, telescope = pcall(require, "telescope")
if ok then
telescope.load_extension("ht")
end
end,
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-language-server" })
end,
},
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-debug-adapter" })
end,
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
{ "mrcjkb/neotest-haskell" },
},
opts = {
adapters = {
["neotest-haskell"] = {},
},
},
},
{
"mrcjkb/haskell-snippets.nvim",
dependencies = { "L3MON4D3/LuaSnip" },
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
config = function()
local haskell_snippets = require("haskell-snippets").all
require("luasnip").add_snippets("haskell", haskell_snippets, { key = "haskell" })
end,
},
{
"luc-tielen/telescope_hoogle",
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
dependencies = {
{ "nvim-telescope/telescope.nvim" },
},
config = function()
local ok, telescope = pcall(require, "telescope")
if ok then
telescope.load_extension("hoogle")
end
end,
},
-- Make sure lspconfig doesn't start hls,
-- as it conflicts with haskell-tools
{
"neovim/nvim-lspconfig",
opts = {
setup = {
hls = function()
return true
end,
},
},
},
}

View file

@ -0,0 +1,30 @@
LazyVim.lsp.on_attach(function(client, buffer)
if client.name == "yamlls" then
if vim.api.nvim_get_option_value("filetype", { buf = buffer }) == "helm" then
vim.schedule(function()
vim.cmd("LspStop ++force yamlls")
end)
end
end
end)
return {
{ "towolf/vim-helm", ft = "helm" },
{
"neovim/nvim-lspconfig",
opts = {
servers = {
yamlls = {},
helm_ls = {},
},
},
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"helm-ls",
})
end,
},
}

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
-- This is the same as in lspconfig.server_configurations.jdtls, but avoids -- This is the same as in lspconfig.server_configurations.jdtls, but avoids
-- needing to require that when this module loads. -- needing to require that when this module loads.
local java_filetypes = { "java" } local java_filetypes = { "java" }
@ -104,17 +102,18 @@ return {
-- These depend on nvim-dap, but can additionally be disabled by setting false here. -- These depend on nvim-dap, but can additionally be disabled by setting false here.
dap = { hotcodereplace = "auto", config_overrides = {} }, dap = { hotcodereplace = "auto", config_overrides = {} },
dap_main = {},
test = true, test = true,
} }
end, end,
config = function() config = function()
local opts = Util.opts("nvim-jdtls") or {} local opts = LazyVim.opts("nvim-jdtls") or {}
-- Find the extra bundles that should be passed on the jdtls command-line -- Find the extra bundles that should be passed on the jdtls command-line
-- if nvim-dap is enabled with java debug/test. -- if nvim-dap is enabled with java debug/test.
local mason_registry = require("mason-registry") local mason_registry = require("mason-registry")
local bundles = {} ---@type string[] local bundles = {} ---@type string[]
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
local java_dbg_path = java_dbg_pkg:get_install_path() local java_dbg_path = java_dbg_pkg:get_install_path()
local jar_patterns = { local jar_patterns = {
@ -146,7 +145,7 @@ return {
bundles = bundles, bundles = bundles,
}, },
-- enable CMP capabilities -- enable CMP capabilities
capabilities = require("cmp_nvim_lsp").default_capabilities(), capabilities = LazyVim.has("cmp-nvim-lsp") and require("cmp_nvim_lsp").default_capabilities() or nil,
}, opts.jdtls) }, opts.jdtls)
-- Existing server will be reused if the root_dir matches. -- Existing server will be reused if the root_dir matches.
@ -195,10 +194,10 @@ return {
}, },
}, { mode = "v", buffer = args.buf }) }, { mode = "v", buffer = args.buf })
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
-- custom init for Java debugger -- custom init for Java debugger
require("jdtls").setup_dap(opts.dap) require("jdtls").setup_dap(opts.dap)
require("jdtls.dap").setup_dap_main_class_configs() require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
-- Java Test require Java debugger to work -- Java Test require Java debugger to work
if opts.test and mason_registry.is_installed("java-test") then if opts.test and mason_registry.is_installed("java-test") then

View file

@ -69,6 +69,8 @@ return {
for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do
opts[ft] = { opts[ft] = {
headline_highlights = {}, headline_highlights = {},
-- disable bullets for now. See https://github.com/lukas-reineke/headlines.nvim/issues/66
bullets = {},
} }
for i = 1, 6 do for i = 1, 6 do
local hl = "Headline" .. i local hl = "Headline" .. i

View file

@ -35,8 +35,9 @@ return {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
opts = function(_, opts) opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {} if type(opts.ensure_installed) == "table" then
table.insert(opts.ensure_installed, "csharpier") vim.list_extend(opts.ensure_installed, { "netcoredbg", "csharpier" })
end
end, end,
}, },
{ {
@ -65,4 +66,34 @@ return {
}, },
}, },
}, },
{
"mfussenegger/nvim-dap",
optional = true,
opts = function()
local dap = require("dap")
if not dap.adapters["netcoredbg"] then
require("dap").adapters["netcoredbg"] = {
type = "executable",
command = vim.fn.exepath("netcoredbg"),
args = { "--interpreter=vscode" },
}
end
for _, lang in ipairs({ "cs", "fsharp", "vb" }) do
if not dap.configurations[lang] then
dap.configurations[lang] = {
{
type = "netcoredbg",
name = "Launch file",
request = "launch",
---@diagnostic disable-next-line: redundant-parameter
program = function()
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
},
}
end
end
end,
},
} }

View file

@ -16,15 +16,16 @@ return {
callback = function() callback = function()
-- Only add style, inherit or link to the LSP's colors -- Only add style, inherit or link to the LSP's colors
vim.cmd([[ vim.cmd([[
highlight! semshiGlobal gui=italic highlight! link semshiGlobal @none
highlight! link semshiImported @none highlight! link semshiImported @none
highlight! link semshiParameter @lsp.type.parameter highlight! link semshiParameter @lsp.type.parameter
highlight! link semshiParameterUnused DiagnosticUnnecessary
highlight! link semshiBuiltin @function.builtin highlight! link semshiBuiltin @function.builtin
highlight! link semshiAttribute @field highlight! link semshiAttribute @field
highlight! link semshiSelf @lsp.type.selfKeyword highlight! link semshiSelf @lsp.type.selfKeyword
highlight! link semshiUnresolved @lsp.type.unresolvedReference highlight! link semshiUnresolved @none
highlight! link semshiFree @none highlight! link semshiFree @none
highlight! link semshiAttribute @none
highlight! link semshiParameterUnused @none
]]) ]])
end, end,
}) })

View file

@ -1,3 +1,11 @@
if lazyvim_docs then
-- LSP Server to use for Python.
-- Set to "basedpyright" to use basedpyright instead of pyright.
vim.g.lazyvim_python_lsp = "pyright"
end
local lsp = vim.g.lazyvim_python_lsp or "pyright"
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@ -11,7 +19,15 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
pyright = {}, pyright = {
enabled = lsp == "pyright",
},
basedpyright = {
enabled = lsp == "basedpyright",
},
[lsp] = {
enabled = true,
},
ruff_lsp = { ruff_lsp = {
keys = { keys = {
{ {
@ -32,7 +48,7 @@ return {
}, },
setup = { setup = {
ruff_lsp = function() ruff_lsp = function()
require("lazyvim.util").lsp.on_attach(function(client, _) LazyVim.lsp.on_attach(function(client, _)
if client.name == "ruff_lsp" then if client.name == "ruff_lsp" then
-- Disable hover in favor of Pyright -- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false client.server_capabilities.hoverProvider = false
@ -78,7 +94,7 @@ return {
"linux-cultist/venv-selector.nvim", "linux-cultist/venv-selector.nvim",
cmd = "VenvSelect", cmd = "VenvSelect",
opts = function(_, opts) opts = function(_, opts)
if require("lazyvim.util").has("nvim-dap-python") then if LazyVim.has("nvim-dap-python") then
opts.dap_enabled = true opts.dap_enabled = true
end end
return vim.tbl_deep_extend("force", opts, { return vim.tbl_deep_extend("force", opts, {
@ -92,4 +108,11 @@ return {
end, end,
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } }, keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
}, },
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
opts.auto_brackets = opts.auto_brackets or {}
table.insert(opts.auto_brackets, "python")
end,
},
} }

View file

@ -16,10 +16,8 @@ return {
}, },
---@param opts cmp.ConfigSchema ---@param opts cmp.ConfigSchema
opts = function(_, opts) opts = function(_, opts)
local cmp = require("cmp") opts.sources = opts.sources or {}
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { table.insert(opts.sources, { name = "crates" })
{ name = "crates" },
}))
end, end,
}, },
@ -27,9 +25,8 @@ return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
opts = function(_, opts) opts = function(_, opts)
if type(opts.ensure_installed) == "table" then opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" }) vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
end
end, end,
}, },
@ -38,51 +35,54 @@ return {
"williamboman/mason.nvim", "williamboman/mason.nvim",
optional = true, optional = true,
opts = function(_, opts) opts = function(_, opts)
if type(opts.ensure_installed) == "table" then opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "codelldb" }) vim.list_extend(opts.ensure_installed, { "codelldb" })
end
end, end,
}, },
{ {
"simrat39/rust-tools.nvim", "mrcjkb/rustaceanvim",
lazy = true, version = "^4", -- Recommended
opts = function() ft = { "rust" },
local ok, mason_registry = pcall(require, "mason-registry") opts = {
local adapter ---@type any server = {
if ok then on_attach = function(_, bufnr)
-- rust tools configuration for debugging support vim.keymap.set("n", "<leader>cR", function()
local codelldb = mason_registry.get_package("codelldb") vim.cmd.RustLsp("codeAction")
local extension_path = codelldb:get_install_path() .. "/extension/" end, { desc = "Code Action", buffer = bufnr })
local codelldb_path = extension_path .. "adapter/codelldb" vim.keymap.set("n", "<leader>dr", function()
local liblldb_path = "" vim.cmd.RustLsp("debuggables")
if vim.loop.os_uname().sysname:find("Windows") then end, { desc = "Rust Debuggables", buffer = bufnr })
liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll" end,
elseif vim.fn.has("mac") == 1 then default_settings = {
liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" -- rust-analyzer language server configuration
else ["rust-analyzer"] = {
liblldb_path = extension_path .. "lldb/lib/liblldb.so" cargo = {
end allFeatures = true,
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) loadOutDirsFromCheck = true,
end runBuildScripts = true,
return { },
dap = { -- Add clippy lints for Rust.
adapter = adapter, checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
}, },
tools = { },
on_initialized = function() },
vim.cmd([[ config = function(_, opts)
augroup RustLSP vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight()
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references()
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
augroup END
]])
end,
},
}
end, end,
config = function() end,
}, },
-- Correctly setup lspconfig for Rust 🚀 -- Correctly setup lspconfig for Rust 🚀
@ -90,37 +90,7 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
-- Ensure mason installs the server rust_analyzer = {},
rust_analyzer = {
keys = {
{ "K", "<cmd>RustHoverActions<cr>", desc = "Hover Actions (Rust)" },
{ "<leader>cR", "<cmd>RustCodeAction<cr>", desc = "Code Action (Rust)" },
{ "<leader>dr", "<cmd>RustDebuggables<cr>", desc = "Run Debuggables (Rust)" },
},
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
taplo = { taplo = {
keys = { keys = {
{ {
@ -138,9 +108,7 @@ return {
}, },
}, },
setup = { setup = {
rust_analyzer = function(_, opts) rust_analyzer = function()
local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts }))
return true return true
end, end,
}, },
@ -150,13 +118,11 @@ return {
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",
optional = true, optional = true,
dependencies = { opts = function(_, opts)
"rouge8/neotest-rust", opts.adapters = opts.adapters or {}
}, vim.list_extend(opts.adapters, {
opts = { require("rustaceanvim.neotest"),
adapters = { })
["neotest-rust"] = {}, end,
},
},
}, },
} }

View file

@ -0,0 +1,74 @@
-- NOTE: This setup does not define any lsp or dap specific key bindings
-- It is recommended that the LazyVim extras dap-core is imported "lazyvim.plugins.extras.dap.core"
-- If you like you can setup your own key bindings.
-- For minimalistic setup have a look at https://github.com/scalameta/nvim-metals/discussions/39
return {
{
"hrsh7th/nvim-cmp",
requires = {
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-vsnip" },
{ "hrsh7th/vim-vsnip" },
},
},
{
"scalameta/nvim-metals",
dependencies = {
"nvim-lua/plenary.nvim",
"mfussenegger/nvim-dap",
},
ft = { "scala", "sbt", "java" },
init = function()
local metals_config = require("metals").bare_config()
metals_config.init_options.statusBarProvider = "on"
metals_config.settings = {
showImplicitArguments = true,
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
}
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
metals_config.on_attach = function(client, bufnr)
require("metals").setup_dap()
end
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
-- NOTE: You may or may not want java included here. You will need it if you
-- want basic Java support but it may also conflict if you are using
-- something like nvim-jdtls which also works on a java filetype autocmd.
pattern = { "scala", "sbt", "java" },
callback = function()
require("metals").initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})
-- Debug settings
local dap = require("dap")
dap.configurations.scala = {
{
type = "scala",
request = "launch",
name = "RunOrTest",
metals = {
runType = "runOrTestFile",
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
},
},
{
type = "scala",
request = "launch",
name = "Test Target",
metals = {
runType = "testTarget",
},
},
}
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "scala" })
end,
},
}

View file

@ -1,9 +1,3 @@
vim.api.nvim_create_autocmd("FileType", {
pattern = { "hcl", "terraform" },
desc = "terraform/hcl commentstring configuration",
command = "setlocal commentstring=#\\ %s",
})
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@ -56,4 +50,25 @@ return {
}, },
}, },
}, },
{
"nvim-telescope/telescope.nvim",
dependencies = {
{
"ANGkeith/telescope-terraform-doc.nvim",
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform_doc")
end)
end,
},
{
"cappyzawa/telescope-terraform.nvim",
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform")
end)
end,
},
},
},
} }

View file

@ -28,14 +28,6 @@ return {
"lervag/vimtex", "lervag/vimtex",
lazy = false, -- lazy-loading will disable inverse search lazy = false, -- lazy-loading will disable inverse search
config = function() config = function()
vim.api.nvim_create_autocmd({ "FileType" }, {
group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }),
pattern = { "bib", "tex" },
callback = function()
vim.wo.conceallevel = 2
end,
})
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
end, end,

View file

@ -46,21 +46,8 @@ return {
desc = "Remove Unused Imports", desc = "Remove Unused Imports",
}, },
}, },
---@diagnostic disable-next-line: missing-fields
settings = { settings = {
typescript = {
format = {
indentSize = vim.o.shiftwidth,
convertTabsToSpaces = vim.o.expandtab,
tabSize = vim.o.tabstop,
},
},
javascript = {
format = {
indentSize = vim.o.shiftwidth,
convertTabsToSpaces = vim.o.expandtab,
tabSize = vim.o.tabstop,
},
},
completions = { completions = {
completeFunctionCalls = true, completeFunctionCalls = true,
}, },
@ -69,6 +56,7 @@ return {
}, },
}, },
}, },
{ {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
optional = true, optional = true,

View file

@ -64,7 +64,7 @@ return {
yamlls = function() yamlls = function()
-- Neovim < 0.10 does not have dynamic registration for formatting -- Neovim < 0.10 does not have dynamic registration for formatting
if vim.fn.has("nvim-0.10") == 0 then if vim.fn.has("nvim-0.10") == 0 then
require("lazyvim.util").lsp.on_attach(function(client, _) LazyVim.lsp.on_attach(function(client, _)
if client.name == "yamlls" then if client.name == "yamlls" then
client.server_capabilities.documentFormattingProvider = true client.server_capabilities.documentFormattingProvider = true
end end

View file

@ -0,0 +1,38 @@
--[[
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

@ -8,17 +8,17 @@ return {
eslint = { eslint = {
settings = { settings = {
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root -- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
workingDirectory = { mode = "auto" }, workingDirectories = { mode = "auto" },
}, },
}, },
}, },
setup = { setup = {
eslint = function() eslint = function()
local function get_client(buf) local function get_client(buf)
return require("lazyvim.util").lsp.get_clients({ name = "eslint", bufnr = buf })[1] return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1]
end end
local formatter = require("lazyvim.util").lsp.formatter({ local formatter = LazyVim.lsp.formatter({
name = "eslint: lsp", name = "eslint: lsp",
primary = false, primary = false,
priority = 200, priority = 200,
@ -44,7 +44,7 @@ return {
end end
-- register the formatter with LazyVim -- register the formatter with LazyVim
require("lazyvim.util").format.register(formatter) LazyVim.format.register(formatter)
end, end,
}, },
}, },

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
return { return {
-- none-ls -- none-ls
{ {
@ -7,14 +5,14 @@ return {
event = "LazyFile", event = "LazyFile",
dependencies = { "mason.nvim" }, dependencies = { "mason.nvim" },
init = function() init = function()
Util.on_very_lazy(function() LazyVim.on_very_lazy(function()
-- register the formatter with LazyVim -- register the formatter with LazyVim
require("lazyvim.util").format.register({ LazyVim.format.register({
name = "none-ls.nvim", name = "none-ls.nvim",
priority = 200, -- set higher than conform, the builtin formatter priority = 200, -- set higher than conform, the builtin formatter
primary = true, primary = true,
format = function(buf) format = function(buf)
return Util.lsp.format({ return LazyVim.lsp.format({
bufnr = buf, bufnr = buf,
filter = function(client) filter = function(client)
return client.name == "null-ls" return client.name == "null-ls"

View file

@ -10,6 +10,7 @@ return {
}, },
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",
dependencies = { "nvim-neotest/nvim-nio" },
opts = { opts = {
-- Can be a list of adapters like what neotest expects, -- Can be a list of adapters like what neotest expects,
-- or a list of adapter names, -- or a list of adapter names,
@ -26,7 +27,7 @@ return {
output = { open_on_run = true }, output = { open_on_run = true },
quickfix = { quickfix = {
open = function() open = function()
if require("lazyvim.util").has("trouble.nvim") then if LazyVim.has("trouble.nvim") then
require("trouble").open({ mode = "quickfix", focus = false }) require("trouble").open({ mode = "quickfix", focus = false })
else else
vim.cmd("copen") vim.cmd("copen")
@ -46,7 +47,7 @@ return {
}, },
}, neotest_ns) }, neotest_ns)
if require("lazyvim.util").has("trouble.nvim") then if LazyVim.has("trouble.nvim") then
opts.consumers = opts.consumers or {} opts.consumers = opts.consumers or {}
-- Refresh and auto close trouble after running tests -- Refresh and auto close trouble after running tests
---@type neotest.Consumer ---@type neotest.Consumer
@ -108,8 +109,9 @@ return {
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, { "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>tT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, { "<leader>tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" },
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, { "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, { "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },

View file

@ -40,12 +40,6 @@ return {
end, end,
}, },
"Trouble", "Trouble",
{
ft = "trouble",
filter = function(buf, win)
return vim.api.nvim_win_get_config(win).relative == ""
end,
},
{ ft = "qf", title = "QuickFix" }, { ft = "qf", title = "QuickFix" },
{ {
ft = "help", ft = "help",

View file

@ -3,35 +3,27 @@ local xdg_config = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config"
---@param path string ---@param path string
local function have(path) local function have(path)
return vim.loop.fs_stat(xdg_config .. "/" .. path) ~= nil return vim.uv.fs_stat(xdg_config .. "/" .. path) ~= nil
end end
return { return {
-- Add Hyprland Parser
{ {
"luckasRanarison/tree-sitter-hypr", "neovim/nvim-lspconfig",
enabled = function() opts = {
return have("hypr") servers = {
end, bashls = {},
event = "BufRead */hypr/*.conf", },
build = ":TSUpdate hypr", },
config = function() },
-- Fix ft detection for hyprland {
vim.filetype.add({ "williamboman/mason.nvim",
pattern = { [".*/hypr/.*%.conf"] = "hypr" }, opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, {
"shfmt",
"shellcheck",
}) })
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, end,
}, },
-- add some stuff to treesitter -- add some stuff to treesitter
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@ -48,11 +40,16 @@ return {
[".*/waybar/config"] = "jsonc", [".*/waybar/config"] = "jsonc",
[".*/mako/config"] = "dosini", [".*/mako/config"] = "dosini",
[".*/kitty/*.conf"] = "bash", [".*/kitty/*.conf"] = "bash",
[".*/hypr/.*%.conf"] = "hyprlang",
}, },
}) })
add("git_config") add("git_config")
if have("hypr") then
add("hyprlang")
end
if have("fish") then if have("fish") then
add("fish") add("fish")
end end

View file

@ -0,0 +1,23 @@
return {
-- Ensure GitUI tool is installed
{
"williamboman/mason.nvim",
keys = {
{ "<leader>gG",
function()
LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false })
end,
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)" }
},
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gitui" })
end,
},
}

View file

@ -19,6 +19,18 @@ M.plugin = {
}, },
highlighters = { highlighters = {
hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }), hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }),
shorthand = {
pattern = "()#%x%x%x()%f[^%x%w]",
group = function(_, _, data)
---@type string
local match = data.full_match
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
local hex_color = "#" .. r .. r .. g .. g .. b .. b
return MiniHipatterns.compute_hex_color_group(hex_color, "bg")
end,
extmark_opts = { priority = 2000 },
},
}, },
} }
end, end,

View file

@ -11,7 +11,7 @@ return {
event = "VeryLazy", event = "VeryLazy",
config = function(_, opts) config = function(_, opts)
require("project_nvim").setup(opts) require("project_nvim").setup(opts)
require("lazyvim.util").on_load("telescope.nvim", function() LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("projects") require("telescope").load_extension("projects")
end) end)
end, end,

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
local M = {} local M = {}
---@param opts ConformOpts ---@param opts ConformOpts
@ -10,14 +8,17 @@ function M.setup(_, opts)
if formatter.extra_args then if formatter.extra_args then
---@diagnostic disable-next-line: undefined-field ---@diagnostic disable-next-line: undefined-field
formatter.prepend_args = formatter.extra_args formatter.prepend_args = formatter.extra_args
Util.deprecate(("opts.formatters.%s.extra_args"):format(name), ("opts.formatters.%s.prepend_args"):format(name)) LazyVim.deprecate(
("opts.formatters.%s.extra_args"):format(name),
("opts.formatters.%s.prepend_args"):format(name)
)
end end
end end
end end
for _, key in ipairs({ "format_on_save", "format_after_save" }) do for _, key in ipairs({ "format_on_save", "format_after_save" }) do
if opts[key] then if opts[key] then
Util.warn( LazyVim.warn(
("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format( ("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format(
key key
) )
@ -39,7 +40,7 @@ return {
{ {
"<leader>cF", "<leader>cF",
function() function()
require("conform").format({ formatters = { "injected" } }) require("conform").format({ formatters = { "injected" }, timeout_ms = 3000 })
end, end,
mode = { "n", "v" }, mode = { "n", "v" },
desc = "Format Injected Langs", desc = "Format Injected Langs",
@ -47,8 +48,8 @@ return {
}, },
init = function() init = function()
-- Install the conform formatter on VeryLazy -- Install the conform formatter on VeryLazy
require("lazyvim.util").on_very_lazy(function() LazyVim.on_very_lazy(function()
require("lazyvim.util").format.register({ LazyVim.format.register({
name = "conform.nvim", name = "conform.nvim",
priority = 100, priority = 100,
primary = true, primary = true,
@ -56,7 +57,7 @@ return {
local plugin = require("lazy.core.config").plugins["conform.nvim"] local plugin = require("lazy.core.config").plugins["conform.nvim"]
local Plugin = require("lazy.core.plugin") local Plugin = require("lazy.core.plugin")
local opts = Plugin.values(plugin, "opts", false) local opts = Plugin.values(plugin, "opts", false)
require("conform").format(Util.merge(opts.format, { bufnr = buf })) require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf }))
end, end,
sources = function(buf) sources = function(buf)
local ret = require("conform").list_formatters(buf) local ret = require("conform").list_formatters(buf)
@ -71,7 +72,7 @@ return {
opts = function() opts = function()
local plugin = require("lazy.core.config").plugins["conform.nvim"] local plugin = require("lazy.core.config").plugins["conform.nvim"]
if plugin.config ~= M.setup then if plugin.config ~= M.setup then
Util.error({ LazyVim.error({
"Don't set `plugin.config` for `conform.nvim`.\n", "Don't set `plugin.config` for `conform.nvim`.\n",
"This will break **LazyVim** formatting.\n", "This will break **LazyVim** formatting.\n",
"Please refer to the docs at https://www.lazyvim.org/plugins/formatting", "Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
@ -84,6 +85,7 @@ return {
timeout_ms = 3000, timeout_ms = 3000,
async = false, -- not recommended to change async = false, -- not recommended to change
quiet = false, -- not recommended to change quiet = false, -- not recommended to change
lsp_fallback = true, -- not recommended to change
}, },
---@type table<string, conform.FormatterUnit[]> ---@type table<string, conform.FormatterUnit[]>
formatters_by_ft = { formatters_by_ft = {

View file

@ -11,6 +11,7 @@ return {
-- ['*'] = { 'global linter' }, -- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured. -- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' }, -- ['_'] = { 'fallback linter' },
-- ["*"] = { "typos" },
}, },
-- LazyVim extension to easily override linter options -- LazyVim extension to easily override linter options
-- or add custom linters. -- or add custom linters.
@ -27,8 +28,6 @@ return {
}, },
}, },
config = function(_, opts) config = function(_, opts)
local Util = require("lazyvim.util")
local M = {} local M = {}
local lint = require("lint") local lint = require("lint")
@ -42,7 +41,7 @@ return {
lint.linters_by_ft = opts.linters_by_ft lint.linters_by_ft = opts.linters_by_ft
function M.debounce(ms, fn) function M.debounce(ms, fn)
local timer = vim.loop.new_timer() local timer = vim.uv.new_timer()
return function(...) return function(...)
local argv = { ... } local argv = { ... }
timer:start(ms, 0, function() timer:start(ms, 0, function()
@ -59,6 +58,9 @@ return {
-- * this differs from conform.nvim which only uses the first filetype that has a formatter -- * this differs from conform.nvim which only uses the first filetype that has a formatter
local names = lint._resolve_linter_by_ft(vim.bo.filetype) local names = lint._resolve_linter_by_ft(vim.bo.filetype)
-- Create a copy of the names table to avoid modifying the original.
names = vim.list_extend({}, names)
-- Add fallback linters. -- Add fallback linters.
if #names == 0 then if #names == 0 then
vim.list_extend(names, lint.linters_by_ft["_"] or {}) vim.list_extend(names, lint.linters_by_ft["_"] or {})
@ -73,7 +75,7 @@ return {
names = vim.tbl_filter(function(name) names = vim.tbl_filter(function(name)
local linter = lint.linters[name] local linter = lint.linters[name]
if not linter then if not linter then
Util.warn("Linter not found: " .. name, { title = "nvim-lint" }) LazyVim.warn("Linter not found: " .. name, { title = "nvim-lint" })
end end
return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx))
end, names) end, names)

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
return { return {
-- lspconfig -- lspconfig
{ {
@ -14,6 +12,7 @@ return {
---@class PluginLspOpts ---@class PluginLspOpts
opts = { opts = {
-- options for vim.diagnostic.config() -- options for vim.diagnostic.config()
---@type vim.diagnostic.Opts
diagnostics = { diagnostics = {
underline = true, underline = true,
update_in_insert = false, update_in_insert = false,
@ -26,6 +25,14 @@ return {
-- prefix = "icons", -- prefix = "icons",
}, },
severity_sort = true, 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 -- 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 -- Be aware that you also will need to properly configure your LSP server to
@ -33,6 +40,12 @@ return {
inlay_hints = { inlay_hints = {
enabled = false, enabled = false,
}, },
-- 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,
},
-- add any global capabilities here -- add any global capabilities here
capabilities = {}, capabilities = {},
-- options for vim.lsp.buf.format -- options for vim.lsp.buf.format
@ -56,6 +69,9 @@ return {
workspace = { workspace = {
checkThirdParty = false, checkThirdParty = false,
}, },
codeLens = {
enable = true,
},
completion = { completion = {
callSnippet = "Replace", callSnippet = "Replace",
}, },
@ -78,47 +94,58 @@ return {
}, },
---@param opts PluginLspOpts ---@param opts PluginLspOpts
config = function(_, opts) config = function(_, opts)
if Util.has("neoconf.nvim") then if LazyVim.has("neoconf.nvim") then
local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"] local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"]
require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false)) require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false))
end end
-- setup autoformat -- setup autoformat
Util.format.register(Util.lsp.formatter()) LazyVim.format.register(LazyVim.lsp.formatter())
-- deprectaed options
if opts.autoformat ~= nil then
vim.g.autoformat = opts.autoformat
Util.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat")
end
-- setup keymaps -- setup keymaps
Util.lsp.on_attach(function(client, buffer) LazyVim.lsp.on_attach(function(client, buffer)
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
end) end)
local register_capability = vim.lsp.handlers["client/registerCapability"] local register_capability = vim.lsp.handlers["client/registerCapability"]
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
---@diagnostic disable-next-line: no-unknown
local ret = register_capability(err, res, ctx) local ret = register_capability(err, res, ctx)
local client_id = ctx.client_id local client = vim.lsp.get_client_by_id(ctx.client_id)
---@type lsp.Client
local client = vim.lsp.get_client_by_id(client_id)
local buffer = vim.api.nvim_get_current_buf() local buffer = vim.api.nvim_get_current_buf()
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
return ret return ret
end end
-- diagnostics -- diagnostics signs
for name, icon in pairs(require("lazyvim.config").icons.diagnostics) do if vim.fn.has("nvim-0.10.0") == 0 then
name = "DiagnosticSign" .. name for severity, icon in pairs(opts.diagnostics.signs.text) do
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper)
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
end end
-- inlay hints
if opts.inlay_hints.enabled then if opts.inlay_hints.enabled then
Util.lsp.on_attach(function(client, buffer) LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/inlayHint") then if client.supports_method("textDocument/inlayHint") then
Util.toggle.inlay_hints(buffer, true) LazyVim.toggle.inlay_hints(buffer, true)
end
end)
end
-- 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 end
end) end)
end end
@ -178,7 +205,7 @@ return {
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
setup(server) setup(server)
else elseif server_opts.enabled ~= false then
ensure_installed[#ensure_installed + 1] = server ensure_installed[#ensure_installed + 1] = server
end end
end end
@ -188,10 +215,10 @@ return {
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } }) mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
end end
if Util.lsp.get_config("denols") and Util.lsp.get_config("tsserver") then if LazyVim.lsp.get_config("denols") and LazyVim.lsp.get_config("tsserver") then
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc") local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
Util.lsp.disable("tsserver", is_deno) LazyVim.lsp.disable("tsserver", is_deno)
Util.lsp.disable("denols", function(root_dir) LazyVim.lsp.disable("denols", function(root_dir)
return not is_deno(root_dir) return not is_deno(root_dir)
end) end)
end end

View file

@ -23,6 +23,8 @@ function M.get()
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, { "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, { "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, { "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" },
{ "<leader>cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" },
{ "<leader>cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" },
{ {
"<leader>cA", "<leader>cA",
function() function()
@ -39,7 +41,7 @@ function M.get()
has = "codeAction", has = "codeAction",
} }
} }
if require("lazyvim.util").has("inc-rename.nvim") then if LazyVim.has("inc-rename.nvim") then
M._keys[#M._keys + 1] = { M._keys[#M._keys + 1] = {
"<leader>cr", "<leader>cr",
function() function()
@ -59,7 +61,7 @@ end
---@param method string ---@param method string
function M.has(buffer, method) function M.has(buffer, method)
method = method:find("/") and method or "textDocument/" .. method method = method:find("/") and method or "textDocument/" .. method
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer }) local clients = LazyVim.lsp.get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
if client.supports_method(method) then if client.supports_method(method) then
return true return true
@ -75,8 +77,8 @@ function M.resolve(buffer)
return {} return {}
end end
local spec = M.get() local spec = M.get()
local opts = require("lazyvim.util").opts("nvim-lspconfig") local opts = LazyVim.opts("nvim-lspconfig")
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer }) local clients = LazyVim.lsp.get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {} local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
vim.list_extend(spec, maps) vim.list_extend(spec, maps)

View file

@ -10,8 +10,8 @@ return {
init = function(plugin) init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer trigger the **nvim-treeitter** module to be loaded in time. -- no longer trigger the **nvim-treesitter** module to be loaded in time.
-- Luckily, the only thins that those plugins need are the custom queries, which we make available -- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup. -- during startup.
require("lazy.core.loader").add_to_rtp(plugin) require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates") require("nvim-treesitter.query_predicates")
@ -45,8 +45,8 @@ return {
}, },
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
keys = { keys = {
{ "<c-space>", desc = "Increment selection" }, { "<c-space>", desc = "Increment Selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" }, { "<bs>", desc = "Decrement Selection", mode = "x" },
}, },
---@type TSConfig ---@type TSConfig
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@ -75,6 +75,7 @@ return {
"typescript", "typescript",
"vim", "vim",
"vimdoc", "vimdoc",
"xml",
"yaml", "yaml",
}, },
incremental_selection = { incremental_selection = {
@ -123,13 +124,12 @@ return {
{ {
"<leader>ut", "<leader>ut",
function() function()
local Util = require("lazyvim.util")
local tsc = require("treesitter-context") local tsc = require("treesitter-context")
tsc.toggle() tsc.toggle()
if Util.inject.get_upvalue(tsc.toggle, "enabled") then if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
Util.info("Enabled Treesitter Context", { title = "Option" }) LazyVim.info("Enabled Treesitter Context", { title = "Option" })
else else
Util.warn("Disabled Treesitter Context", { title = "Option" }) LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
end end
end, end,
desc = "Toggle Treesitter Context", desc = "Toggle Treesitter Context",

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
return { return {
-- Better `vim.notify()` -- Better `vim.notify()`
{ {
@ -10,10 +8,11 @@ return {
function() function()
require("notify").dismiss({ silent = true, pending = true }) require("notify").dismiss({ silent = true, pending = true })
end, end,
desc = "Dismiss all Notifications", desc = "Dismiss All Notifications",
}, },
}, },
opts = { opts = {
stages = "static",
timeout = 3000, timeout = 3000,
max_height = function() max_height = function()
return math.floor(vim.o.lines * 0.75) return math.floor(vim.o.lines * 0.75)
@ -27,8 +26,8 @@ return {
}, },
init = function() init = function()
-- when noice is not enabled, install notify on VeryLazy -- when noice is not enabled, install notify on VeryLazy
if not Util.has("noice.nvim") then if not LazyVim.has("noice.nvim") then
Util.on_very_lazy(function() LazyVim.on_very_lazy(function()
vim.notify = require("notify") vim.notify = require("notify")
end) end)
end end
@ -59,15 +58,15 @@ return {
"akinsho/bufferline.nvim", "akinsho/bufferline.nvim",
event = "VeryLazy", event = "VeryLazy",
keys = { keys = {
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle pin" }, { "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle Pin" },
{ "<leader>bP", "<Cmd>BufferLineGroupClose ungrouped<CR>", desc = "Delete non-pinned buffers" }, { "<leader>bP", "<Cmd>BufferLineGroupClose ungrouped<CR>", desc = "Delete Non-Pinned Buffers" },
{ "<leader>bo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete other buffers" }, { "<leader>bo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>br", "<Cmd>BufferLineCloseRight<CR>", desc = "Delete buffers to the right" }, { "<leader>br", "<Cmd>BufferLineCloseRight<CR>", desc = "Delete Buffers to the Right" },
{ "<leader>bl", "<Cmd>BufferLineCloseLeft<CR>", desc = "Delete buffers to the left" }, { "<leader>bl", "<Cmd>BufferLineCloseLeft<CR>", desc = "Delete Buffers to the Left" },
{ "<S-h>", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev buffer" }, { "<S-h>", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev Buffer" },
{ "<S-l>", "<cmd>BufferLineCycleNext<cr>", desc = "Next buffer" }, { "<S-l>", "<cmd>BufferLineCycleNext<cr>", desc = "Next Buffer" },
{ "[b", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev buffer" }, { "[b", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev Buffer" },
{ "]b", "<cmd>BufferLineCycleNext<cr>", desc = "Next buffer" }, { "]b", "<cmd>BufferLineCycleNext<cr>", desc = "Next Buffer" },
}, },
opts = { opts = {
options = { options = {
@ -140,7 +139,7 @@ return {
lualine_b = { "branch" }, lualine_b = { "branch" },
lualine_c = { lualine_c = {
Util.lualine.root_dir(), LazyVim.lualine.root_dir(),
{ {
"diagnostics", "diagnostics",
symbols = { symbols = {
@ -151,31 +150,31 @@ return {
}, },
}, },
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ Util.lualine.pretty_path() }, { LazyVim.lualine.pretty_path() },
}, },
lualine_x = { lualine_x = {
-- stylua: ignore -- stylua: ignore
{ {
function() return require("noice").api.status.command.get() end, function() return require("noice").api.status.command.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
color = Util.ui.fg("Statement"), color = LazyVim.ui.fg("Statement"),
}, },
-- stylua: ignore -- stylua: ignore
{ {
function() return require("noice").api.status.mode.get() end, function() return require("noice").api.status.mode.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
color = Util.ui.fg("Constant"), color = LazyVim.ui.fg("Constant"),
}, },
-- stylua: ignore -- stylua: ignore
{ {
function() return "" .. require("dap").status() end, function() return "" .. require("dap").status() end,
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
color = Util.ui.fg("Debug"), color = LazyVim.ui.fg("Debug"),
}, },
{ {
require("lazy.status").updates, require("lazy.status").updates,
cond = require("lazy.status").has_updates, cond = require("lazy.status").has_updates,
color = Util.ui.fg("Special"), color = LazyVim.ui.fg("Special"),
}, },
{ {
"diff", "diff",
@ -278,7 +277,7 @@ return {
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
opts = function(_, opts) opts = function(_, opts)
if require("lazyvim.util").has("noice.nvim") then if LazyVim.has("noice.nvim") then
opts.defaults["<leader>sn"] = { name = "+noice" } opts.defaults["<leader>sn"] = { name = "+noice" }
end end
end, end,
@ -323,8 +322,8 @@ return {
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" }, { "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" }, { "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
{ "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, { "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
{ "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, { "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll Forward", mode = {"i", "n", "s"} },
{ "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, { "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll Backward", mode = {"i", "n", "s"}},
}, },
}, },
@ -338,7 +337,7 @@ return {
"goolord/alpha-nvim", "goolord/alpha-nvim",
optional = true, optional = true,
enabled = function() enabled = function()
require("lazyvim.util").warn({ LazyVim.warn({
"`dashboard.nvim` is now the default LazyVim starter plugin.", "`dashboard.nvim` is now the default LazyVim starter plugin.",
"", "",
"To keep using `alpha.nvim`, please enable the `lazyvim.plugins.extras.ui.alpha` extra.", "To keep using `alpha.nvim`, please enable the `lazyvim.plugins.extras.ui.alpha` extra.",
@ -373,11 +372,11 @@ return {
header = vim.split(logo, "\n"), header = vim.split(logo, "\n"),
-- stylua: ignore -- stylua: ignore
center = { center = {
{ action = "Telescope find_files", desc = " Find file", icon = "", key = "f" }, { action = LazyVim.telescope("files"), desc = " Find File", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New file", icon = "", key = "n" }, { action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent files", icon = "", key = "r" }, { action = "Telescope oldfiles", desc = " Recent Files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find text", icon = "", key = "g" }, { action = "Telescope live_grep", desc = " Find Text", icon = "", key = "g" },
{ action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = "", key = "c" }, { action = [[lua LazyVim.telescope.config_files()()]], desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" }, { action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },

View file

@ -3,11 +3,23 @@ local Config = require("lazyvim.config")
-- Some extras need to be loaded before others -- Some extras need to be loaded before others
local prios = { local prios = {
["lazyvim.plugins.extras.editor.aerial"] = 100, ["lazyvim.plugins.extras.editor.aerial"] = 100,
["lazyvim.plugins.extras.editor.symbols-outline"] = 100, ["lazyvim.plugins.extras.editor.outline"] = 100,
["lazyvim.plugins.extras.editor.trouble-v3"] = 100,
["lazyvim.plugins.extras.test.core"] = 1, ["lazyvim.plugins.extras.test.core"] = 1,
["lazyvim.plugins.extras.dap.core"] = 1, ["lazyvim.plugins.extras.dap.core"] = 1,
} }
local used = {} ---@type table<string, boolean>
---@type string[]
Config.json.data.extras = vim.tbl_filter(function(extra)
if used[extra] then
return false
end
used[extra] = true
return true
end, Config.json.data.extras)
table.sort(Config.json.data.extras, function(a, b) table.sort(Config.json.data.extras, function(a, b)
local pa = prios[a] or 10 local pa = prios[a] or 10
local pb = prios[b] or 10 local pb = prios[b] or 10

4
lua/lazyvim/types.lua Normal file
View file

@ -0,0 +1,4 @@
---@class LazyVimGlobals
vim.g = {}
_G.lazyvim_docs = true

View file

@ -3,7 +3,6 @@ local Float = require("lazy.view.float")
local LazyConfig = require("lazy.core.config") local LazyConfig = require("lazy.core.config")
local Plugin = require("lazy.core.plugin") local Plugin = require("lazy.core.plugin")
local Text = require("lazy.view.text") local Text = require("lazy.view.text")
local Util = require("lazyvim.util")
---@class LazyExtraSource ---@class LazyExtraSource
---@field name string ---@field name string
@ -39,10 +38,10 @@ function M.get()
M.state = M.state or LazyConfig.spec.modules M.state = M.state or LazyConfig.spec.modules
local extras = {} ---@type LazyExtra[] local extras = {} ---@type LazyExtra[]
for _, source in ipairs(M.sources) do for _, source in ipairs(M.sources) do
local root = Util.find_root(source.module) local root = LazyVim.find_root(source.module)
if root then if root then
Util.walk(root, function(path, name, type) LazyVim.walk(root, function(path, name, type)
if type == "file" and name:match("%.lua$") then if (type == "file" or type == "link") and name:match("%.lua$") then
name = path:sub(#root + 2, -5):gsub("/", ".") name = path:sub(#root + 2, -5):gsub("/", ".")
local ok, extra = pcall(M.get_extra, source, source.module .. "." .. name) local ok, extra = pcall(M.get_extra, source, source.module .. "." .. name)
if ok then if ok then
@ -119,7 +118,7 @@ function X:toggle()
for _, extra in ipairs(self.extras) do for _, extra in ipairs(self.extras) do
if extra.row == pos[1] then if extra.row == pos[1] then
if not extra.managed then if not extra.managed then
Util.error( LazyVim.error(
"Not managed by LazyExtras. Remove from your config to enable/disable here.", "Not managed by LazyExtras. Remove from your config to enable/disable here.",
{ title = "LazyExtras" } { title = "LazyExtras" }
) )
@ -137,8 +136,8 @@ function X:toggle()
M.state[#M.state + 1] = extra.module M.state[#M.state + 1] = extra.module
end end
table.sort(Config.json.data.extras) table.sort(Config.json.data.extras)
Util.json.save() LazyVim.json.save()
Util.info( LazyVim.info(
"`" "`"
.. extra.name .. extra.name
.. "`" .. "`"

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.format ---@class lazyvim.util.format
---@overload fun(opts?: {force?:boolean}) ---@overload fun(opts?: {force?:boolean})
local M = setmetatable({}, { local M = setmetatable({}, {
@ -26,7 +24,7 @@ function M.register(formatter)
end end
function M.formatexpr() function M.formatexpr()
if Util.has("conform.nvim") then if LazyVim.has("conform.nvim") then
return require("conform").formatexpr() return require("conform").formatexpr()
end end
return vim.lsp.formatexpr({ timeout_ms = 3000 }) return vim.lsp.formatexpr({ timeout_ms = 3000 })
@ -76,7 +74,7 @@ function M.info(buf)
if not have then if not have then
lines[#lines + 1] = "\n***No formatters available for this buffer.***" lines[#lines + 1] = "\n***No formatters available for this buffer.***"
end end
Util[enabled and "info" or "warn"]( LazyVim[enabled and "info" or "warn"](
table.concat(lines, "\n"), table.concat(lines, "\n"),
{ title = "LazyFormat (" .. (enabled and "enabled" or "disabled") .. ")" } { title = "LazyFormat (" .. (enabled and "enabled" or "disabled") .. ")" }
) )
@ -120,14 +118,14 @@ function M.format(opts)
for _, formatter in ipairs(M.resolve(buf)) do for _, formatter in ipairs(M.resolve(buf)) do
if formatter.active then if formatter.active then
done = true done = true
Util.try(function() LazyVim.try(function()
return formatter.format(buf) return formatter.format(buf)
end, { msg = "Formatter `" .. formatter.name .. "` failed" }) end, { msg = "Formatter `" .. formatter.name .. "` failed" })
end end
end end
if not done and opts and opts.force then if not done and opts and opts.force then
Util.warn("No formatter available", { title = "LazyVim" }) LazyVim.warn("No formatter available", { title = "LazyVim" })
end end
end end
@ -136,7 +134,7 @@ function M.health()
local has_plugin = Config.spec.plugins["none-ls.nvim"] local has_plugin = Config.spec.plugins["none-ls.nvim"]
local has_extra = vim.tbl_contains(Config.spec.modules, "lazyvim.plugins.extras.lsp.none-ls") local has_extra = vim.tbl_contains(Config.spec.modules, "lazyvim.plugins.extras.lsp.none-ls")
if has_plugin and not has_extra then if has_plugin and not has_extra then
Util.warn({ LazyVim.warn({
"`conform.nvim` and `nvim-lint` are now the default formatters and linters in LazyVim.", "`conform.nvim` and `nvim-lint` are now the default formatters and linters in LazyVim.",
"", "",
"You can use those plugins together with `none-ls.nvim`,", "You can use those plugins together with `none-ls.nvim`,",

View file

@ -1,11 +1,13 @@
local LazyUtil = require("lazy.core.util") local LazyUtil = require("lazy.core.util")
---@class lazyvim.util: LazyUtilCore ---@class lazyvim.util: LazyUtilCore
---@field config LazyVimConfig
---@field ui lazyvim.util.ui ---@field ui lazyvim.util.ui
---@field lsp lazyvim.util.lsp ---@field lsp lazyvim.util.lsp
---@field root lazyvim.util.root ---@field root lazyvim.util.root
---@field telescope lazyvim.util.telescope ---@field telescope lazyvim.util.telescope
---@field terminal lazyvim.util.terminal ---@field terminal lazyvim.util.terminal
---@field lazygit lazyvim.util.lazygit
---@field toggle lazyvim.util.toggle ---@field toggle lazyvim.util.toggle
---@field format lazyvim.util.format ---@field format lazyvim.util.format
---@field plugin lazyvim.util.plugin ---@field plugin lazyvim.util.plugin
@ -38,7 +40,7 @@ setmetatable(M, {
if dep then if dep then
local mod = type(dep) == "table" and dep[1] or dep local mod = type(dep) == "table" and dep[1] or dep
local key = type(dep) == "table" and dep[2] or k local key = type(dep) == "table" and dep[2] or k
M.deprecate([[require("lazyvim.util").]] .. k, [[require("lazyvim.util").]] .. mod .. "." .. key) M.deprecate([[LazyVim.]] .. k, [[LazyVim.]] .. mod .. "." .. key)
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
t[mod] = require("lazyvim.util." .. mod) -- load here to prevent loops t[mod] = require("lazyvim.util." .. mod) -- load here to prevent loops
return t[mod][key] return t[mod][key]
@ -50,7 +52,7 @@ setmetatable(M, {
}) })
function M.is_win() function M.is_win()
return vim.loop.os_uname().sysname:find("Windows") ~= nil return vim.uv.os_uname().sysname:find("Windows") ~= nil
end end
---@param plugin string ---@param plugin string
@ -97,8 +99,8 @@ function M.lazy_notify()
local orig = vim.notify local orig = vim.notify
vim.notify = temp vim.notify = temp
local timer = vim.loop.new_timer() local timer = vim.uv.new_timer()
local check = assert(vim.loop.new_check()) local check = assert(vim.uv.new_check())
local replay = function() local replay = function()
timer:stop() timer:stop()

View file

@ -1,5 +1,4 @@
local Config = require("lazyvim.config") local Config = require("lazyvim.config")
local Util = require("lazyvim.util")
---@class lazyvim.util.json ---@class lazyvim.util.json
local M = {} local M = {}
@ -14,7 +13,7 @@ local function encode(value, indent)
elseif t == "number" or t == "boolean" then elseif t == "number" or t == "boolean" then
return tostring(value) return tostring(value)
elseif t == "table" then elseif t == "table" then
local is_list = Util.is_list(value) local is_list = LazyVim.is_list(value)
local parts = {} local parts = {}
local next_indent = indent .. " " local next_indent = indent .. " "
@ -51,13 +50,13 @@ function M.save()
local path = vim.fn.stdpath("config") .. "/lazyvim.json" local path = vim.fn.stdpath("config") .. "/lazyvim.json"
local f = io.open(path, "w") local f = io.open(path, "w")
if f then if f then
f:write(Util.json.encode(Config.json.data)) f:write(LazyVim.json.encode(Config.json.data))
f:close() f:close()
end end
end end
function M.migrate() function M.migrate()
Util.info("Migrating `lazyvim.json` to version `" .. Config.json.version .. "`") LazyVim.info("Migrating `lazyvim.json` to version `" .. Config.json.version .. "`")
local json = Config.json local json = Config.json
-- v0 -- v0
@ -74,6 +73,11 @@ function M.migrate()
-- replace double extras module name -- replace double extras module name
return extra:gsub("^lazyvim%.plugins%.extras%.lazyvim%.plugins%.extras%.", "lazyvim.plugins.extras.") return extra:gsub("^lazyvim%.plugins%.extras%.lazyvim%.plugins%.extras%.", "lazyvim.plugins.extras.")
end, json.data.extras or {}) end, json.data.extras or {})
elseif json.data.version == 2 then
json.data.extras = vim.tbl_map(function(extra)
return extra == "lazyvim.plugins.extras.editor.symbols-outline" and "lazyvim.plugins.extras.editor.outline"
or extra
end, json.data.extras or {})
end end
M.save() M.save()

View file

@ -0,0 +1,143 @@
---@class lazyvim.util.lazygit
---@field config_dir? string
---@overload fun(cmd: string|string[], opts: LazyTermOpts): LazyFloat
local M = setmetatable({}, {
__call = function(m, ...)
return m.open(...)
end,
})
---@alias LazyGitColor {fg?:string, bg?:string, bold?:boolean}
---@class LazyGitTheme: table<number, LazyGitColor>
---@field activeBorderColor LazyGitColor
---@field cherryPickedCommitBgColor LazyGitColor
---@field cherryPickedCommitFgColor LazyGitColor
---@field defaultFgColor LazyGitColor
---@field inactiveBorderColor LazyGitColor
---@field optionsTextColor LazyGitColor
---@field searchingActiveBorderColor LazyGitColor
---@field selectedLineBgColor LazyGitColor
---@field unstagedChangesColor LazyGitColor
M.theme = {
[241] = { fg = "Special" },
activeBorderColor = { fg = "MatchParen", bold = true },
cherryPickedCommitBgColor = { fg = "Identifier" },
cherryPickedCommitFgColor = { fg = "Function" },
defaultFgColor = { fg = "Normal" },
inactiveBorderColor = { fg = "FloatBorder" },
optionsTextColor = { fg = "Function" },
searchingActiveBorderColor = { fg = "MatchParen", bold = true },
selectedLineBgColor = { bg = "Visual" }, -- set to `default` to have no background colour
unstagedChangesColor = { fg = "DiagnosticError" },
}
M.theme_path = vim.fn.stdpath("cache") .. "/lazygit-theme.yml"
-- re-create config file on startup
M.dirty = true
-- re-create theme file on ColorScheme change
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
M.dirty = true
end,
})
-- Opens lazygit
---@param opts? LazyTermOpts | {args?: string[]}
function M.open(opts)
if vim.g.lazygit_theme ~= nil then
LazyVim.deprecate("vim.g.lazygit_theme", "vim.g.lazygit_config")
end
opts = vim.tbl_deep_extend("force", {}, {
esc_esc = false,
ctrl_hjkl = false,
}, opts or {})
local cmd = { "lazygit" }
vim.list_extend(cmd, opts.args or {})
if vim.g.lazygit_config then
if M.dirty then
M.update_config()
end
if not M.config_dir then
local Process = require("lazy.manage.process")
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
else
---@diagnostic disable-next-line: cast-type-mismatch
---@cast lines string
LazyVim.error(
{ "Failed to get **lazygit** config directory.", "Will not apply **lazygit** config.", "", "# Error:", lines },
{ title = "lazygit" }
)
end
end
end
return LazyVim.terminal(cmd, opts)
end
function M.set_ansi_color(idx, color)
io.write(("\27]4;%d;%s\7"):format(idx, color))
end
---@param v LazyGitColor
---@return string[]
function M.get_color(v)
---@type string[]
local color = {}
if v.fg then
color[1] = LazyVim.ui.color(v.fg)
elseif v.bg then
color[1] = LazyVim.ui.color(v.bg, true)
end
if v.bold then
table.insert(color, "bold")
end
return color
end
function M.update_config()
---@type table<string, string[]>
local theme = {}
for k, v in pairs(M.theme) do
if type(k) == "number" then
local color = M.get_color(v)
-- LazyGit uses color 241 a lot, so also set it to a nice color
-- pcall, since some terminals don't like this
pcall(M.set_ansi_color, k, color[1])
else
theme[k] = M.get_color(v)
end
end
local config = [[
os:
editPreset: "nvim-remote"
gui:
nerdFontsVersion: 3
theme:
]]
---@type string[]
local lines = {}
for k, v in pairs(theme) do
lines[#lines + 1] = (" %s:"):format(k)
for _, c in ipairs(v) do
lines[#lines + 1] = (" - %q"):format(c)
end
end
config = config .. table.concat(lines, "\n")
require("lazy.util").write_file(M.theme_path, config)
M.dirty = false
end
return M

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.lsp ---@class lazyvim.util.lsp
local M = {} local M = {}
@ -87,10 +85,10 @@ function M.formatter(opts)
primary = true, primary = true,
priority = 1, priority = 1,
format = function(buf) format = function(buf)
M.format(Util.merge(filter, { bufnr = buf })) M.format(LazyVim.merge({}, filter, { bufnr = buf }))
end, end,
sources = function(buf) sources = function(buf)
local clients = M.get_clients(Util.merge(filter, { bufnr = buf })) local clients = M.get_clients(LazyVim.merge({}, filter, { bufnr = buf }))
---@param client lsp.Client ---@param client lsp.Client
local ret = vim.tbl_filter(function(client) local ret = vim.tbl_filter(function(client)
return client.supports_method("textDocument/formatting") return client.supports_method("textDocument/formatting")
@ -102,20 +100,25 @@ function M.formatter(opts)
end, ret) end, ret)
end, end,
} }
return Util.merge(ret, opts) --[[@as LazyFormatter]] return LazyVim.merge(ret, opts) --[[@as LazyFormatter]]
end end
---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter ---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter
---@param opts? lsp.Client.format ---@param opts? lsp.Client.format
function M.format(opts) function M.format(opts)
opts = vim.tbl_deep_extend("force", {}, opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {}) opts = vim.tbl_deep_extend(
"force",
{},
opts or {},
LazyVim.opts("nvim-lspconfig").format or {},
LazyVim.opts("conform.nvim").format or {}
)
local ok, conform = pcall(require, "conform") local ok, conform = pcall(require, "conform")
-- use conform for formatting with LSP when available, -- use conform for formatting with LSP when available,
-- since it has better format diffing -- since it has better format diffing
if ok then if ok then
opts.formatters = {} opts.formatters = {}
opts.lsp_fallback = true
conform.format(opts) conform.format(opts)
else else
vim.lsp.buf.format(opts) vim.lsp.buf.format(opts)

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.lualine ---@class lazyvim.util.lualine
local M = {} local M = {}
@ -25,9 +23,9 @@ function M.cmp_source(name, icon)
end end
local colors = { local colors = {
ok = Util.ui.fg("Special"), ok = LazyVim.ui.fg("Special"),
error = Util.ui.fg("DiagnosticError"), error = LazyVim.ui.fg("DiagnosticError"),
pending = Util.ui.fg("DiagnosticWarn"), pending = LazyVim.ui.fg("DiagnosticWarn"),
} }
return { return {
@ -48,7 +46,7 @@ end
---@param hl_group? string ---@param hl_group? string
---@return string ---@return string
function M.format(component, text, hl_group) function M.format(component, text, hl_group)
if not hl_group then if not hl_group or hl_group == "" then
return text return text
end end
---@type table<string, string> ---@type table<string, string>
@ -56,17 +54,31 @@ function M.format(component, text, hl_group)
local lualine_hl_group = component.hl_cache[hl_group] local lualine_hl_group = component.hl_cache[hl_group]
if not lualine_hl_group then if not lualine_hl_group then
local utils = require("lualine.utils.utils") local utils = require("lualine.utils.utils")
lualine_hl_group = component:create_hl({ fg = utils.extract_highlight_colors(hl_group, "fg") }, "LV_" .. hl_group) ---@type string[]
local gui = vim.tbl_filter(function(x)
return x
end, {
utils.extract_highlight_colors(hl_group, "bold") and "bold",
utils.extract_highlight_colors(hl_group, "italic") and "italic",
})
lualine_hl_group = component:create_hl({
fg = utils.extract_highlight_colors(hl_group, "fg"),
gui = #gui > 0 and table.concat(gui, ",") or nil,
}, "LV_" .. hl_group) --[[@as string]]
component.hl_cache[hl_group] = lualine_hl_group component.hl_cache[hl_group] = lualine_hl_group
end end
return component:format_hl(lualine_hl_group) .. text .. component:get_default_hl() return component:format_hl(lualine_hl_group) .. text .. component:get_default_hl()
end end
---@param opts? {relative: "cwd"|"root", modified_hl: string?} ---@param opts? {relative: "cwd"|"root", modified_hl: string?, directory_hl: string?, filename_hl: string?}
function M.pretty_path(opts) function M.pretty_path(opts)
opts = vim.tbl_extend("force", { opts = vim.tbl_extend("force", {
relative = "cwd", relative = "cwd",
modified_hl = "Constant", modified_hl = "MatchParen",
directory_hl = "",
filename_hl = "Bold",
modified_sign = "",
}, opts or {}) }, opts or {})
return function(self) return function(self)
@ -75,8 +87,9 @@ function M.pretty_path(opts)
if path == "" then if path == "" then
return "" return ""
end end
local root = Util.root.get({ normalize = true })
local cwd = Util.root.cwd() local root = LazyVim.root.get({ normalize = true })
local cwd = LazyVim.root.cwd()
if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then
path = path:sub(#cwd + 2) path = path:sub(#cwd + 2)
@ -86,15 +99,24 @@ function M.pretty_path(opts)
local sep = package.config:sub(1, 1) local sep = package.config:sub(1, 1)
local parts = vim.split(path, "[\\/]") local parts = vim.split(path, "[\\/]")
if #parts > 3 then if #parts > 3 then
parts = { parts[1], "", parts[#parts - 1], parts[#parts] } parts = { parts[1], "", parts[#parts - 1], parts[#parts] }
end end
if opts.modified_hl and vim.bo.modified then if opts.modified_hl and vim.bo.modified then
parts[#parts] = parts[#parts] .. opts.modified_sign
parts[#parts] = M.format(self, parts[#parts], opts.modified_hl) parts[#parts] = M.format(self, parts[#parts], opts.modified_hl)
else
parts[#parts] = M.format(self, parts[#parts], opts.filename_hl)
end end
return table.concat(parts, sep) local dir = ""
if #parts > 1 then
dir = table.concat({ unpack(parts, 1, #parts - 1) }, sep)
dir = M.format(self, dir .. sep, opts.directory_hl)
end
return dir .. parts[#parts]
end end
end end
@ -106,12 +128,12 @@ function M.root_dir(opts)
parent = true, parent = true,
other = true, other = true,
icon = "󱉭 ", icon = "󱉭 ",
color = Util.ui.fg("Special"), color = LazyVim.ui.fg("Special"),
}, opts or {}) }, opts or {})
local function get() local function get()
local cwd = Util.root.cwd() local cwd = LazyVim.root.cwd()
local root = Util.root.get({ normalize = true }) local root = LazyVim.root.get({ normalize = true })
local name = vim.fs.basename(root) local name = vim.fs.basename(root)
if root == cwd then if root == cwd then

View file

@ -1,11 +1,10 @@
local Config = require("lazyvim.config") local Config = require("lazyvim.config")
local Util = require("lazyvim.util")
---@class lazyvim.util.news ---@class lazyvim.util.news
local M = {} local M = {}
function M.hash(file) function M.hash(file)
local stat = vim.loop.fs_stat(file) local stat = vim.uv.fs_stat(file)
if not stat then if not stat then
return return
end end
@ -27,7 +26,7 @@ function M.setup()
end end
function M.welcome() function M.welcome()
Util.info("Welcome to LazyVim!") LazyVim.info("Welcome to LazyVim!")
end end
function M.changelog() function M.changelog()
@ -50,7 +49,7 @@ function M.open(file, opts)
if opts.plugin then if opts.plugin then
local plugin = require("lazy.core.config").plugins[opts.plugin] --[[@as LazyPlugin?]] local plugin = require("lazy.core.config").plugins[opts.plugin] --[[@as LazyPlugin?]]
if not plugin then if not plugin then
return Util.error("plugin not found: " .. opts.plugin) return LazyVim.error("plugin not found: " .. opts.plugin)
end end
file = plugin.dir .. "/" .. file file = plugin.dir .. "/" .. file
elseif opts.rtp then elseif opts.rtp then
@ -58,7 +57,7 @@ function M.open(file, opts)
end end
if not file then if not file then
return Util.error("File not found") return LazyVim.error("File not found")
end end
if opts.when_changed then if opts.when_changed then
@ -68,7 +67,7 @@ function M.open(file, opts)
return return
end end
Config.json.data.news[ref] = hash Config.json.data.news[ref] = hash
Util.json.save() LazyVim.json.save()
-- don't open if file has never been opened -- don't open if file has never been opened
if is_new then if is_new then
return return

View file

@ -1,5 +1,4 @@
local Plugin = require("lazy.core.plugin") local Plugin = require("lazy.core.plugin")
local Util = require("lazyvim.util")
---@class lazyvim.util.plugin ---@class lazyvim.util.plugin
local M = {} local M = {}
@ -35,9 +34,8 @@ function M.setup()
M.lazy_file() M.lazy_file()
table.insert(package.loaders, function(module) table.insert(package.loaders, function(module)
if M.deprecated_modules[module] then if M.deprecated_modules[module] then
Util.warn( LazyVim.warn(
("`%s` is no longer included by default in **LazyVim**.\nPlease install the `%s` extra if you still want to use it.") ("`%s` is no longer included by default in **LazyVim**.\nPlease install the `%s` extra if you still want to use it."):format(
:format(
module, module,
M.deprecated_modules[module] M.deprecated_modules[module]
), ),
@ -126,21 +124,21 @@ function M.lazy_file()
end end
function M.fix_imports() function M.fix_imports()
Plugin.Spec.import = Util.inject.args(Plugin.Spec.import, function(_, spec) Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec)
local dep = M.deprecated_extras[spec and spec.import] local dep = M.deprecated_extras[spec and spec.import]
if dep then if dep then
dep = dep .. "\n" .. "Please remove the extra to hide this warning." dep = dep .. "\n" .. "Please remove the extra to hide this warning."
Util.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 }) LazyVim.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 })
return false return false
end end
end) end)
end end
function M.fix_renames() function M.fix_renames()
Plugin.Spec.add = Util.inject.args(Plugin.Spec.add, function(self, plugin) Plugin.Spec.add = LazyVim.inject.args(Plugin.Spec.add, function(self, plugin)
if type(plugin) == "table" then if type(plugin) == "table" then
if M.renames[plugin[1]] then if M.renames[plugin[1]] then
Util.warn( LazyVim.warn(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format( ("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1], plugin[1],
M.renames[plugin[1]], M.renames[plugin[1]],

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.root ---@class lazyvim.util.root
---@overload fun(): string ---@overload fun(): string
local M = setmetatable({}, { local M = setmetatable({}, {
@ -22,7 +20,7 @@ M.spec = { "lsp", { ".git", "lua" }, "cwd" }
M.detectors = {} M.detectors = {}
function M.detectors.cwd() function M.detectors.cwd()
return { vim.loop.cwd() } return { vim.uv.cwd() }
end end
function M.detectors.lsp(buf) function M.detectors.lsp(buf)
@ -31,7 +29,7 @@ function M.detectors.lsp(buf)
return {} return {}
end end
local roots = {} ---@type string[] local roots = {} ---@type string[]
for _, client in pairs(Util.lsp.get_clients({ bufnr = buf })) do for _, client in pairs(LazyVim.lsp.get_clients({ bufnr = buf })) do
-- only check workspace folders, since we're not interested in clients -- only check workspace folders, since we're not interested in clients
-- running in single file mode -- running in single file mode
local workspace = client.config.workspace_folders local workspace = client.config.workspace_folders
@ -40,7 +38,7 @@ function M.detectors.lsp(buf)
end end
end end
return vim.tbl_filter(function(path) return vim.tbl_filter(function(path)
path = Util.norm(path) path = LazyVim.norm(path)
return path and bufpath:find(path, 1, true) == 1 return path and bufpath:find(path, 1, true) == 1
end, roots) end, roots)
end end
@ -48,7 +46,7 @@ end
---@param patterns string[]|string ---@param patterns string[]|string
function M.detectors.pattern(buf, patterns) function M.detectors.pattern(buf, patterns)
patterns = type(patterns) == "string" and { patterns } or patterns patterns = type(patterns) == "string" and { patterns } or patterns
local path = M.bufpath(buf) or vim.loop.cwd() local path = M.bufpath(buf) or vim.uv.cwd()
local pattern = vim.fs.find(patterns, { path = path, upward = true })[1] local pattern = vim.fs.find(patterns, { path = path, upward = true })[1]
return pattern and { vim.fs.dirname(pattern) } or {} return pattern and { vim.fs.dirname(pattern) } or {}
end end
@ -58,15 +56,15 @@ function M.bufpath(buf)
end end
function M.cwd() function M.cwd()
return M.realpath(vim.loop.cwd()) or "" return M.realpath(vim.uv.cwd()) or ""
end end
function M.realpath(path) function M.realpath(path)
if path == "" or path == nil then if path == "" or path == nil then
return nil return nil
end end
path = vim.loop.fs_realpath(path) or path path = vim.uv.fs_realpath(path) or path
return Util.norm(path) return LazyVim.norm(path)
end end
---@param spec LazyRootSpec ---@param spec LazyRootSpec
@ -132,8 +130,8 @@ function M.info()
lines[#lines + 1] = "```lua" lines[#lines + 1] = "```lua"
lines[#lines + 1] = "vim.g.root_spec = " .. vim.inspect(spec) lines[#lines + 1] = "vim.g.root_spec = " .. vim.inspect(spec)
lines[#lines + 1] = "```" lines[#lines + 1] = "```"
require("lazyvim.util").info(lines, { title = "LazyVim Roots" }) LazyVim.info(lines, { title = "LazyVim Roots" })
return roots[1] and roots[1].paths[1] or vim.loop.cwd() return roots[1] and roots[1].paths[1] or vim.uv.cwd()
end end
---@type table<number, string> ---@type table<number, string>
@ -141,10 +139,10 @@ M.cache = {}
function M.setup() function M.setup()
vim.api.nvim_create_user_command("LazyRoot", function() vim.api.nvim_create_user_command("LazyRoot", function()
Util.root.info() LazyVim.root.info()
end, { desc = "LazyVim roots for the current buffer" }) end, { desc = "LazyVim roots for the current buffer" })
vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost" }, { vim.api.nvim_create_autocmd({ "LspAttach", "BufWritePost", "DirChanged" }, {
group = vim.api.nvim_create_augroup("lazyvim_root_cache", { clear = true }), group = vim.api.nvim_create_augroup("lazyvim_root_cache", { clear = true }),
callback = function(event) callback = function(event)
M.cache[event.buf] = nil M.cache[event.buf] = nil
@ -164,13 +162,20 @@ function M.get(opts)
local ret = M.cache[buf] local ret = M.cache[buf]
if not ret then if not ret then
local roots = M.detect({ all = false }) local roots = M.detect({ all = false })
ret = roots[1] and roots[1].paths[1] or vim.loop.cwd() ret = roots[1] and roots[1].paths[1] or vim.uv.cwd()
M.cache[buf] = ret M.cache[buf] = ret
end end
if opts and opts.normalize then if opts and opts.normalize then
return ret return ret
end end
return Util.is_win() and ret:gsub("/", "\\") or ret return LazyVim.is_win() and ret:gsub("/", "\\") or ret
end
function M.git()
local root = M.get()
local git_root = vim.fs.find(".git", { path = root, upward = true })[1]
local ret = git_root and vim.fn.fnamemodify(git_root, ":h") or root
return ret
end end
---@param opts? {hl_last?: string} ---@param opts? {hl_last?: string}

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.telescope.opts ---@class lazyvim.util.telescope.opts
---@field cwd? string|boolean ---@field cwd? string|boolean
---@field show_untracked? boolean ---@field show_untracked? boolean
@ -22,26 +20,34 @@ function M.telescope(builtin, opts)
return function() return function()
builtin = params.builtin builtin = params.builtin
opts = params.opts opts = params.opts
opts = vim.tbl_deep_extend("force", { cwd = Util.root() }, opts or {}) --[[@as lazyvim.util.telescope.opts]] opts = vim.tbl_deep_extend("force", { cwd = LazyVim.root() }, opts or {}) --[[@as lazyvim.util.telescope.opts]]
if builtin == "files" then if builtin == "files" then
if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then if
opts.show_untracked = true vim.uv.fs_stat((opts.cwd or vim.uv.cwd()) .. "/.git")
and not vim.uv.fs_stat((opts.cwd or vim.uv.cwd()) .. "/.ignore")
and not vim.uv.fs_stat((opts.cwd or vim.uv.cwd()) .. "/.rgignore")
then
if opts.show_untracked == nil then
opts.show_untracked = true
end
builtin = "git_files" builtin = "git_files"
else else
builtin = "find_files" builtin = "find_files"
end end
end end
if opts.cwd and opts.cwd ~= vim.loop.cwd() then if opts.cwd and opts.cwd ~= vim.uv.cwd() then
local function open_cwd_dir()
local action_state = require("telescope.actions.state")
local line = action_state.get_current_line()
M.telescope(
params.builtin,
vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line })
)()
end
---@diagnostic disable-next-line: inject-field ---@diagnostic disable-next-line: inject-field
opts.attach_mappings = function(_, map) opts.attach_mappings = function(_, map)
map("i", "<a-c>", function() -- opts.desc is overridden by telescope, until it's changed there is this fix
local action_state = require("telescope.actions.state") map("i", "<a-c>", open_cwd_dir, { desc = "Open cwd Directory" })
local line = action_state.get_current_line()
M.telescope(
params.builtin,
vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line })
)()
end)
return true return true
end end
end end
@ -51,7 +57,7 @@ function M.telescope(builtin, opts)
end end
function M.config_files() function M.config_files()
return Util.telescope("find_files", { cwd = vim.fn.stdpath("config") }) return LazyVim.telescope("find_files", { cwd = vim.fn.stdpath("config") })
end end
return M return M

View file

@ -9,6 +9,37 @@ local M = setmetatable({}, {
---@type table<string,LazyFloat> ---@type table<string,LazyFloat>
local terminals = {} local terminals = {}
---@param shell? string
function M.setup(shell)
vim.o.shell = shell or vim.o.shell
-- Special handling for pwsh
if shell == "pwsh" or shell == "powershell" then
-- Check if 'pwsh' is executable and set the shell accordingly
if vim.fn.executable("pwsh") == 1 then
vim.o.shell = "pwsh"
elseif vim.fn.executable("powershell") == 1 then
vim.o.shell = "powershell"
else
return LazyVim.error("No powershell executable found")
end
-- Setting shell command flags
vim.o.shellcmdflag =
"-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf8';"
-- Setting shell redirection
vim.o.shellredir = '2>&1 | %{ "$_" } | Out-File %s; exit $LastExitCode'
-- Setting shell pipe
vim.o.shellpipe = '2>&1 | %{ "$_" } | Tee-Object %s; exit $LastExitCode'
-- Setting shell quote options
vim.o.shellquote = ""
vim.o.shellxquote = ""
end
end
---@class LazyTermOpts: LazyCmdOptions ---@class LazyTermOpts: LazyCmdOptions
---@field interactive? boolean ---@field interactive? boolean
---@field esc_esc? boolean ---@field esc_esc? boolean
@ -21,6 +52,7 @@ function M.open(cmd, opts)
opts = vim.tbl_deep_extend("force", { opts = vim.tbl_deep_extend("force", {
ft = "lazyterm", ft = "lazyterm",
size = { width = 0.9, height = 0.9 }, size = { width = 0.9, height = 0.9 },
backdrop = LazyVim.has("edgy.nvim") and not cmd and 100 or nil,
}, opts or {}, { persistent = true }) --[[@as LazyTermOpts]] }, opts or {}, { persistent = true }) --[[@as LazyTermOpts]]
local termkey = vim.inspect({ cmd = cmd or "shell", cwd = opts.cwd, env = opts.env, count = vim.v.count1 }) local termkey = vim.inspect({ cmd = cmd or "shell", cwd = opts.cwd, env = opts.env, count = vim.v.count1 })

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.toggle ---@class lazyvim.util.toggle
local M = {} local M = {}
@ -14,15 +12,15 @@ function M.option(option, silent, values)
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
vim.opt_local[option] = values[1] vim.opt_local[option] = values[1]
end end
return Util.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" }) return LazyVim.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" })
end end
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
vim.opt_local[option] = not vim.opt_local[option]:get() vim.opt_local[option] = not vim.opt_local[option]:get()
if not silent then if not silent then
if vim.opt_local[option]:get() then if vim.opt_local[option]:get() then
Util.info("Enabled " .. option, { title = "Option" }) LazyVim.info("Enabled " .. option, { title = "Option" })
else else
Util.warn("Disabled " .. option, { title = "Option" }) LazyVim.warn("Disabled " .. option, { title = "Option" })
end end
end end
end end
@ -33,23 +31,29 @@ function M.number()
nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() } nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() }
vim.opt_local.number = false vim.opt_local.number = false
vim.opt_local.relativenumber = false vim.opt_local.relativenumber = false
Util.warn("Disabled line numbers", { title = "Option" }) LazyVim.warn("Disabled line numbers", { title = "Option" })
else else
vim.opt_local.number = nu.number vim.opt_local.number = nu.number
vim.opt_local.relativenumber = nu.relativenumber vim.opt_local.relativenumber = nu.relativenumber
Util.info("Enabled line numbers", { title = "Option" }) LazyVim.info("Enabled line numbers", { title = "Option" })
end end
end end
local enabled = true local enabled = true
function M.diagnostics() function M.diagnostics()
-- if this Neovim version supports checking if diagnostics are enabled
-- then use that for the current state
if vim.diagnostic.is_disabled then
enabled = not vim.diagnostic.is_disabled()
end
enabled = not enabled enabled = not enabled
if enabled then if enabled then
vim.diagnostic.enable() vim.diagnostic.enable()
Util.info("Enabled diagnostics", { title = "Diagnostics" }) LazyVim.info("Enabled diagnostics", { title = "Diagnostics" })
else else
vim.diagnostic.disable() vim.diagnostic.disable()
Util.warn("Disabled diagnostics", { title = "Diagnostics" }) LazyVim.warn("Disabled diagnostics", { title = "Diagnostics" })
end end
end end

View file

@ -103,7 +103,7 @@ function M.statuscolumn()
---@type Sign?,Sign?,Sign? ---@type Sign?,Sign?,Sign?
local left, right, fold local left, right, fold
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name and s.name:find("GitSign") then if s.name and (s.name:find("GitSign") or s.name:find("MiniDiffSign")) then
right = s right = s
else else
left = s left = s
@ -136,20 +136,42 @@ function M.statuscolumn()
components[2] = "%=" .. components[2] .. " " -- right align components[2] = "%=" .. components[2] .. " " -- right align
end end
if vim.v.virtnum ~= 0 then
components[2] = "%= "
end
return table.concat(components, "") return table.concat(components, "")
end end
---@return {fg?:string}?
function M.fg(name) function M.fg(name)
local color = M.color(name)
return color and { fg = color } or nil
end
---@param name string
---@param bg? boolean
---@return string?
function M.color(name, bg)
---@type {foreground?:number}? ---@type {foreground?:number}?
---@diagnostic disable-next-line: deprecated ---@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 hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name, link = false })
or vim.api.nvim_get_hl_by_name(name, true)
---@diagnostic disable-next-line: undefined-field ---@diagnostic disable-next-line: undefined-field
local fg = hl and (hl.fg or hl.foreground) ---@type string?
return fg and { fg = string.format("#%06x", fg) } or nil local color = nil
if hl then
if bg then
color = hl.bg or hl.background
else
color = hl.fg or hl.foreground
end
end
return color and string.format("#%06x", color) or nil
end end
M.skip_foldexpr = {} ---@type table<number,boolean> M.skip_foldexpr = {} ---@type table<number,boolean>
local skip_check = assert(vim.loop.new_check()) local skip_check = assert(vim.uv.new_check())
function M.foldexpr() function M.foldexpr()
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()