mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-17 16:01:50 +02:00
Merge branch 'main' into lang/typst
This commit is contained in:
commit
138f625006
37 changed files with 866 additions and 263 deletions
|
@ -1,7 +1,6 @@
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
2
.github/.release-please-manifest.json
vendored
2
.github/.release-please-manifest.json
vendored
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
".": "12.29.2"
|
".": "12.38.2"
|
||||||
}
|
}
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -17,6 +17,8 @@ body:
|
||||||
options:
|
options:
|
||||||
- label: I have read all the LazyVim docs
|
- label: I have read all the LazyVim docs
|
||||||
required: true
|
required: true
|
||||||
|
- label: I have updated the plugin to the latest version before submitting this issue
|
||||||
|
required: true
|
||||||
- label: I have searched the existing issues of LazyVim
|
- label: I have searched the existing issues of LazyVim
|
||||||
required: true
|
required: true
|
||||||
- label: I have searched the existing issues of plugins related to this issue
|
- label: I have searched the existing issues of plugins related to this issue
|
||||||
|
|
3
.github/workflows/stale.yml
vendored
3
.github/workflows/stale.yml
vendored
|
@ -5,6 +5,7 @@ on:
|
||||||
- cron: "30 1 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
stale:
|
||||||
|
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
|
||||||
uses: folke/github/.github/workflows/stale.yml@main
|
uses: folke/github/.github/workflows/stale.yml@main
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
3
.github/workflows/update.yml
vendored
3
.github/workflows/update.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
||||||
- cron: "0 * * * *"
|
- cron: "0 * * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
update:
|
||||||
|
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
|
||||||
uses: folke/github/.github/workflows/update.yml@main
|
uses: folke/github/.github/workflows/update.yml@main
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
142
CHANGELOG.md
142
CHANGELOG.md
|
@ -1,5 +1,147 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [12.38.2](https://github.com/LazyVim/LazyVim/compare/v12.38.1...v12.38.2) (2024-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **news:** pcall diag when showing news for older Neovim versions ([94bf4f9](https://github.com/LazyVim/LazyVim/commit/94bf4f932482012306fb375c4418a398bb00a949))
|
||||||
|
|
||||||
|
## [12.38.1](https://github.com/LazyVim/LazyVim/compare/v12.38.0...v12.38.1) (2024-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **autcmds:** added grug-far to close with q ([3282721](https://github.com/LazyVim/LazyVim/commit/328272144c8c0b2d96988770d48c690a72613a81))
|
||||||
|
|
||||||
|
## [12.38.0](https://github.com/LazyVim/LazyVim/compare/v12.37.0...v12.38.0) (2024-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **markdown:** markdown-render toggle ([c8d0faf](https://github.com/LazyVim/LazyVim/commit/c8d0faf9b152283b2ae74f9594287a834eae002a))
|
||||||
|
* **markdown:** replace `headlines.nvim` by `markdown.nvim` ([#4139](https://github.com/LazyVim/LazyVim/issues/4139)) ([264abdf](https://github.com/LazyVim/LazyVim/commit/264abdf9d52fe44c1dcb66f0502dcba5a881ea43))
|
||||||
|
|
||||||
|
## [12.37.0](https://github.com/LazyVim/LazyVim/compare/v12.36.0...v12.37.0) (2024-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **catppuccin:** enable grug-far integration ([#4156](https://github.com/LazyVim/LazyVim/issues/4156)) ([4bf6d85](https://github.com/LazyVim/LazyVim/commit/4bf6d856a805d38c19c8485c7a062d6cbc5cfaa8))
|
||||||
|
* **elixir:** add elixirls code actions ([#4148](https://github.com/LazyVim/LazyVim/issues/4148)) ([f94a059](https://github.com/LazyVim/LazyVim/commit/f94a0591b3e5838794b1c3897ec21491aeb080fe))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **dap:** don't mess up DAP adapters provided by nvim-dap-python ([#4141](https://github.com/LazyVim/LazyVim/issues/4141)) ([940d7df](https://github.com/LazyVim/LazyVim/commit/940d7df59aac01f6cc587f035d9b4913139fae60))
|
||||||
|
* **dap:** extend dap.configurations from .vscode/launch.json ([#4106](https://github.com/LazyVim/LazyVim/issues/4106)) ([caf227d](https://github.com/LazyVim/LazyVim/commit/caf227dd08e83c826800cb88c34c87c600793fa3))
|
||||||
|
* **grug-far:** use new transient option ([1c2be20](https://github.com/LazyVim/LazyVim/commit/1c2be200c185a4567c6a634da2b624d9a638fe73))
|
||||||
|
* **keymaps:** leader-wd ([f0d8b8b](https://github.com/LazyVim/LazyVim/commit/f0d8b8b293c1fc798b576a74a87f9bd0b59714f3))
|
||||||
|
* **keymaps:** leader-wm ([391f506](https://github.com/LazyVim/LazyVim/commit/391f506295607e12db545b85fcbe0e00b1b8efa9))
|
||||||
|
* **news:** deprecated API ([f6cd4a3](https://github.com/LazyVim/LazyVim/commit/f6cd4a38c667e3ef56672d723705ecd8a774a0f4))
|
||||||
|
|
||||||
|
## [12.36.0](https://github.com/LazyVim/LazyVim/compare/v12.35.1...v12.36.0) (2024-07-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **grug-far:** no longer needed to call visual replace separately ([72d0cad](https://github.com/LazyVim/LazyVim/commit/72d0cad3530d877401ad9674f5266c79fbec396b))
|
||||||
|
|
||||||
|
## [12.35.1](https://github.com/LazyVim/LazyVim/compare/v12.35.0...v12.35.1) (2024-07-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **grug-far:** only prefill files filter when file has an extension. Closes [#4130](https://github.com/LazyVim/LazyVim/issues/4130) ([6411ab0](https://github.com/LazyVim/LazyVim/commit/6411ab0897f19dad9f902dfee29e101a9a767357))
|
||||||
|
|
||||||
|
## [12.35.0](https://github.com/LazyVim/LazyVim/compare/v12.34.0...v12.35.0) (2024-07-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **python:** default to new ruff instead of ruff_lsp ([#4126](https://github.com/LazyVim/LazyVim/issues/4126)) ([61ce1cf](https://github.com/LazyVim/LazyVim/commit/61ce1cfaaf8365e3b5c12b1509064579ab7d80b5))
|
||||||
|
|
||||||
|
## [12.34.0](https://github.com/LazyVim/LazyVim/compare/v12.33.0...v12.34.0) (2024-07-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **editor:** replace nvim-spectre with grug-far.nvim ([#4099](https://github.com/LazyVim/LazyVim/issues/4099)) ([0d561a3](https://github.com/LazyVim/LazyVim/commit/0d561a3226b46f6a44c4f2c9be2288f3b52cc351))
|
||||||
|
* **indent-blankline:** add which-key toggles ([#4122](https://github.com/LazyVim/LazyVim/issues/4122)) ([a997152](https://github.com/LazyVim/LazyVim/commit/a997152eb2307380888d640440e0732493f82727))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **conform:** changes for new conform.nvim config ([eed91a3](https://github.com/LazyVim/LazyVim/commit/eed91a3e4c1521dd839d1a8bc09bdd98ac2fb874))
|
||||||
|
* **toggle:** safe toggle get ([c8ab5d7](https://github.com/LazyVim/LazyVim/commit/c8ab5d7554da9f1eff69f5d6d8a0df38309d9f81))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **core:** defer clipboard because xsel and pbcopy can be slow ([#4120](https://github.com/LazyVim/LazyVim/issues/4120)) ([578f06e](https://github.com/LazyVim/LazyVim/commit/578f06e1401defbbc0a82f9ff1fb505564d038cf))
|
||||||
|
|
||||||
|
## [12.33.0](https://github.com/LazyVim/LazyVim/compare/v12.32.0...v12.33.0) (2024-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **extras:** improve ruby extra by letting user chose ([#3652](https://github.com/LazyVim/LazyVim/issues/3652)) ([7839498](https://github.com/LazyVim/LazyVim/commit/783949810855556dd12ed2685e62fb37a4c9504d))
|
||||||
|
* **lang:** add Lean 4 support ([#4080](https://github.com/LazyVim/LazyVim/issues/4080)) ([3e29fdf](https://github.com/LazyVim/LazyVim/commit/3e29fdf478383034c48477dd04fd433a7c9327ee))
|
||||||
|
* **lang:** add OCaml ([#4079](https://github.com/LazyVim/LazyVim/issues/4079)) ([a219e10](https://github.com/LazyVim/LazyVim/commit/a219e105b0e86316edfedb57f1fa267a764eab13))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ui:** trouble lualine component ([f9fdb35](https://github.com/LazyVim/LazyVim/commit/f9fdb356f2362e5ae4ef490944b1957b49dc6680))
|
||||||
|
|
||||||
|
## [12.32.0](https://github.com/LazyVim/LazyVim/compare/v12.31.0...v12.32.0) (2024-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **edgy:** added support for grug-far.nvim ([b1a4740](https://github.com/LazyVim/LazyVim/commit/b1a47405b9fa5eb9f5222876e81be73206b80792))
|
||||||
|
* **terminal:** clear search highlight when opening a terminal ([#4090](https://github.com/LazyVim/LazyVim/issues/4090)) ([b5290fd](https://github.com/LazyVim/LazyVim/commit/b5290fd92935d2e96fa2249cfd09bdd853972869))
|
||||||
|
* **toggle:** move toggle notifs to toggle function ([c1b76ee](https://github.com/LazyVim/LazyVim/commit/c1b76ee235a2cccff6370ecfca57bdacd5fe6258))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **autcmds:** desc for close_with_q ([d6561fd](https://github.com/LazyVim/LazyVim/commit/d6561fd27c17806ca972cbfc18573ca81d13e346))
|
||||||
|
* **ui:** another typo ([b8bdebe](https://github.com/LazyVim/LazyVim/commit/b8bdebe5be7eba91db23e43575fc1226075f6a56))
|
||||||
|
* **ui:** typo ([4ac249b](https://github.com/LazyVim/LazyVim/commit/4ac249beaae3462d606128ca21db79cb85a8c65b))
|
||||||
|
|
||||||
|
## [12.31.0](https://github.com/LazyVim/LazyVim/compare/v12.30.0...v12.31.0) (2024-07-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **keymaps:** proxy leader-w to ctrl-w ([bab5440](https://github.com/LazyVim/LazyVim/commit/bab54406dc312947e4e03bb728498503c09231ca))
|
||||||
|
* **R:** added new which-key group for new install feature ([#4078](https://github.com/LazyVim/LazyVim/issues/4078)) ([5339aca](https://github.com/LazyVim/LazyVim/commit/5339acacec0996968d64fdbaf9fe8187bfea1b47))
|
||||||
|
* **toggle:** make toggles callable. Fixes [#4081](https://github.com/LazyVim/LazyVim/issues/4081) ([150523b](https://github.com/LazyVim/LazyVim/commit/150523b77b6e848c4135a97a5fd8f6f79a6f4443))
|
||||||
|
* **treesitter-context:** which-key toggle ([#4059](https://github.com/LazyVim/LazyVim/issues/4059)) ([ab01350](https://github.com/LazyVim/LazyVim/commit/ab0135093bc18ccf82325bc8ee14c25230a71786))
|
||||||
|
* **which-key:** dynamic buffer mappings under leader-b ([8d9f2ad](https://github.com/LazyVim/LazyVim/commit/8d9f2ad97ee0d495135380975438ab8a8ae62b14))
|
||||||
|
* **which-key:** dynamic window mappings under leader-w ([66bba78](https://github.com/LazyVim/LazyVim/commit/66bba787b83afdd85b5ee95aa589fbe9fbb95535))
|
||||||
|
* **which-key:** leader-w-space starts hydra mode for window mappings ([865bf15](https://github.com/LazyVim/LazyVim/commit/865bf15f1cf4d4f6a3eda6d7509f94a59752fb36))
|
||||||
|
|
||||||
|
## [12.30.0](https://github.com/LazyVim/LazyVim/compare/v12.29.2...v12.30.0) (2024-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **keymaps:** dynamic which-key icons/descriptions for toggles ([#4050](https://github.com/LazyVim/LazyVim/issues/4050)) ([78cf032](https://github.com/LazyVim/LazyVim/commit/78cf0320bfc34050883cde5e7af267184dc60ee9))
|
||||||
|
* **util.mini:** follow the user's mappings instead of hardcoded values ([#4043](https://github.com/LazyVim/LazyVim/issues/4043)) ([8506cb5](https://github.com/LazyVim/LazyVim/commit/8506cb5a98a528651a5557d8e447fa13bd8ac0cb))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **lsp:** lsp keymaps. Fixes [#4051](https://github.com/LazyVim/LazyVim/issues/4051) ([706ec4b](https://github.com/LazyVim/LazyVim/commit/706ec4b6b6be4265cbcfd326d3216f2a29952b55))
|
||||||
|
* **yanky:** enable yank history in visual mode ([#4048](https://github.com/LazyVim/LazyVim/issues/4048)) ([6911327](https://github.com/LazyVim/LazyVim/commit/6911327a5edca85ce3bc71229236494d9af7fafa))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **luasnip:** luasnip wasn't lazyloaded ([#4032](https://github.com/LazyVim/LazyVim/issues/4032)) ([e80ed32](https://github.com/LazyVim/LazyVim/commit/e80ed322a79a8b9857c6ab0ad76545654917ddcb))
|
||||||
|
|
||||||
## [12.29.2](https://github.com/LazyVim/LazyVim/compare/v12.29.1...v12.29.2) (2024-07-14)
|
## [12.29.2](https://github.com/LazyVim/LazyVim/compare/v12.29.1...v12.29.2) (2024-07-14)
|
||||||
|
|
||||||
|
|
||||||
|
|
6
NEWS.md
6
NEWS.md
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
## 12.x
|
## 12.x
|
||||||
|
|
||||||
|
- **Markdown Extra**: [headlines.nvim](https://github.com/lukas-reineke/headlines.nvim) has been removed in favor of [markdown.nvim](https://github.com/MeanderingProgrammer/markdown.nvim)
|
||||||
|
to spice up your markdown files.
|
||||||
|
|
||||||
|
- [nvim-spectre](https://github.com/nvim-pack/nvim-spectre) has been removed in favor of [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim).
|
||||||
|
**grug-far.nvim** has a great UI and feels more intuitive to use.
|
||||||
|
|
||||||
- This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news)
|
- This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news)
|
||||||
|
|
||||||
- **prettier** extra now works for all prettier supported filetypes
|
- **prettier** extra now works for all prettier supported filetypes
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
*LazyVim.txt* For Neovim Last change: 2024 July 14
|
*LazyVim.txt* For Neovim Last change: 2024 July 25
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Table of Contents *LazyVim-table-of-contents*
|
Table of Contents *LazyVim-table-of-contents*
|
||||||
|
|
|
@ -55,6 +55,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
group = augroup("close_with_q"),
|
group = augroup("close_with_q"),
|
||||||
pattern = {
|
pattern = {
|
||||||
"PlenaryTestPopup",
|
"PlenaryTestPopup",
|
||||||
|
"grug-far",
|
||||||
"help",
|
"help",
|
||||||
"lspinfo",
|
"lspinfo",
|
||||||
"notify",
|
"notify",
|
||||||
|
@ -71,7 +72,11 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
},
|
},
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.bo[event.buf].buflisted = false
|
vim.bo[event.buf].buflisted = false
|
||||||
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
vim.keymap.set("n", "q", "<cmd>close<cr>", {
|
||||||
|
buffer = event.buf,
|
||||||
|
silent = true,
|
||||||
|
desc = "Quit buffer",
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
|
||||||
---@class LazyVimConfig: LazyVimOptions
|
---@class LazyVimConfig: LazyVimOptions
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.version = "12.29.2" -- x-release-please-version
|
M.version = "12.38.2" -- x-release-please-version
|
||||||
LazyVim.config = M
|
LazyVim.config = M
|
||||||
|
|
||||||
---@class LazyVimOptions
|
---@class LazyVimOptions
|
||||||
|
@ -161,6 +161,7 @@ end
|
||||||
|
|
||||||
---@type LazyVimOptions
|
---@type LazyVimOptions
|
||||||
local options
|
local options
|
||||||
|
local lazy_clipboard
|
||||||
|
|
||||||
---@param opts? LazyVimOptions
|
---@param opts? LazyVimOptions
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
|
@ -181,6 +182,9 @@ function M.setup(opts)
|
||||||
M.load("autocmds")
|
M.load("autocmds")
|
||||||
end
|
end
|
||||||
M.load("keymaps")
|
M.load("keymaps")
|
||||||
|
if lazy_clipboard ~= nil then
|
||||||
|
vim.opt.clipboard = lazy_clipboard
|
||||||
|
end
|
||||||
|
|
||||||
LazyVim.format.setup()
|
LazyVim.format.setup()
|
||||||
LazyVim.news.setup()
|
LazyVim.news.setup()
|
||||||
|
@ -285,6 +289,9 @@ function M.init()
|
||||||
-- 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")
|
||||||
|
-- defer built-in clipboard handling: "xsel" and "pbcopy" can be slow
|
||||||
|
lazy_clipboard = vim.opt.clipboard
|
||||||
|
vim.opt.clipboard = ""
|
||||||
|
|
||||||
if vim.g.deprecation_warnings == false then
|
if vim.g.deprecation_warnings == false then
|
||||||
vim.deprecate = function() end
|
vim.deprecate = function() end
|
||||||
|
|
|
@ -115,20 +115,19 @@ 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() LazyVim.format.toggle() end, { desc = "Toggle Auto Format (Global)" })
|
LazyVim.toggle.map("<leader>uf", LazyVim.toggle.format())
|
||||||
map("n", "<leader>uF", function() LazyVim.format.toggle(true) end, { desc = "Toggle Auto Format (Buffer)" })
|
LazyVim.toggle.map("<leader>uF", LazyVim.toggle.format(true))
|
||||||
map("n", "<leader>us", function() LazyVim.toggle("spell") end, { desc = "Toggle Spelling" })
|
LazyVim.toggle.map("<leader>us", LazyVim.toggle("spell", { name = "Spelling" }))
|
||||||
map("n", "<leader>uw", function() LazyVim.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
LazyVim.toggle.map("<leader>uw", LazyVim.toggle("wrap", { name = "Wrap" }))
|
||||||
map("n", "<leader>uL", function() LazyVim.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
|
LazyVim.toggle.map("<leader>uL", LazyVim.toggle("relativenumber", { name = "Relative Number" }))
|
||||||
map("n", "<leader>ul", function() LazyVim.toggle.number() end, { desc = "Toggle Line Numbers" })
|
LazyVim.toggle.map("<leader>ud", LazyVim.toggle.diagnostics)
|
||||||
map("n", "<leader>ud", function() LazyVim.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
|
LazyVim.toggle.map("<leader>ul", LazyVim.toggle.number)
|
||||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
LazyVim.toggle.map( "<leader>uc", LazyVim.toggle("conceallevel", { values = { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 } }))
|
||||||
map("n", "<leader>uc", function() LazyVim.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
LazyVim.toggle.map("<leader>uT", LazyVim.toggle.treesitter)
|
||||||
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
|
LazyVim.toggle.map("<leader>ub", LazyVim.toggle("background", { values = { "light", "dark" }, name = "Background" }))
|
||||||
map( "n", "<leader>uh", function() LazyVim.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
|
if vim.lsp.inlay_hint then
|
||||||
|
LazyVim.toggle.map("<leader>uh", LazyVim.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>ub", function() LazyVim.toggle("background", false, {"light", "dark"}) end, { desc = "Toggle Background" })
|
|
||||||
|
|
||||||
-- lazygit
|
-- lazygit
|
||||||
map("n", "<leader>gg", function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
|
map("n", "<leader>gg", function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
|
||||||
|
@ -175,13 +174,11 @@ 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>w", "<c-w>", { desc = "Windows", 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>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 })
|
||||||
map("n", "<leader>wm", function() LazyVim.toggle.maximize() end, { desc = "Maximize Toggle" })
|
map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
|
||||||
|
LazyVim.toggle.map("<leader>wm", LazyVim.toggle.maximize)
|
||||||
|
|
||||||
-- tabs
|
-- tabs
|
||||||
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||||
|
|
|
@ -47,6 +47,7 @@ vim.g.deprecation_warnings = false
|
||||||
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
|
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
|
||||||
|
|
||||||
-- Show the current document symbols location from Trouble in lualine
|
-- Show the current document symbols location from Trouble in lualine
|
||||||
|
-- You can disable this for a buffer by setting `vim.b.trouble_lualine = false`
|
||||||
vim.g.trouble_lualine = true
|
vim.g.trouble_lualine = true
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
|
@ -140,20 +140,6 @@ return {
|
||||||
-- better deal with markdown code blocks
|
-- better deal with markdown code blocks
|
||||||
markdown = true,
|
markdown = true,
|
||||||
},
|
},
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>up",
|
|
||||||
function()
|
|
||||||
vim.g.minipairs_disable = not vim.g.minipairs_disable
|
|
||||||
if vim.g.minipairs_disable then
|
|
||||||
LazyVim.warn("Disabled auto pairs", { title = "Option" })
|
|
||||||
else
|
|
||||||
LazyVim.info("Enabled auto pairs", { title = "Option" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = "Toggle Auto Pairs",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
LazyVim.mini.pairs(opts)
|
LazyVim.mini.pairs(opts)
|
||||||
end,
|
end,
|
||||||
|
@ -171,9 +157,6 @@ return {
|
||||||
"echasnovski/mini.ai",
|
"echasnovski/mini.ai",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = function()
|
opts = function()
|
||||||
LazyVim.on_load("which-key.nvim", function()
|
|
||||||
vim.schedule(LazyVim.mini.ai_whichkey)
|
|
||||||
end)
|
|
||||||
local ai = require("mini.ai")
|
local ai = require("mini.ai")
|
||||||
return {
|
return {
|
||||||
n_lines = 500,
|
n_lines = 500,
|
||||||
|
@ -197,6 +180,14 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.ai").setup(opts)
|
||||||
|
LazyVim.on_load("which-key.nvim", function()
|
||||||
|
vim.schedule(function()
|
||||||
|
LazyVim.mini.ai_whichkey(opts)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ return {
|
||||||
cmp = true,
|
cmp = true,
|
||||||
dashboard = true,
|
dashboard = true,
|
||||||
flash = true,
|
flash = true,
|
||||||
|
grug_far = true,
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
headlines = true,
|
headlines = true,
|
||||||
illuminate = true,
|
illuminate = true,
|
||||||
|
|
|
@ -128,13 +128,25 @@ return {
|
||||||
|
|
||||||
-- search/replace in multiple files
|
-- search/replace in multiple files
|
||||||
{
|
{
|
||||||
"nvim-pack/nvim-spectre",
|
"MagicDuck/grug-far.nvim",
|
||||||
build = false,
|
opts = { headerMaxWidth = 80 },
|
||||||
cmd = "Spectre",
|
cmd = "GrugFar",
|
||||||
opts = { open_cmd = "noswapfile vnew" },
|
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" },
|
{
|
||||||
|
"<leader>sr",
|
||||||
|
function()
|
||||||
|
local grug = require("grug-far")
|
||||||
|
local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
|
||||||
|
grug.grug_far({
|
||||||
|
transient = true,
|
||||||
|
prefills = {
|
||||||
|
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
|
desc = "Search and Replace",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -169,21 +181,36 @@ return {
|
||||||
{
|
{
|
||||||
mode = { "n", "v" },
|
mode = { "n", "v" },
|
||||||
{ "<leader><tab>", group = "tabs" },
|
{ "<leader><tab>", group = "tabs" },
|
||||||
{ "<leader>b", group = "buffer" },
|
|
||||||
{ "<leader>c", group = "code" },
|
{ "<leader>c", group = "code" },
|
||||||
{ "<leader>f", group = "file/find" },
|
{ "<leader>f", group = "file/find" },
|
||||||
{ "<leader>g", group = "git" },
|
{ "<leader>g", group = "git" },
|
||||||
{ "<leader>gh", group = "hunks" },
|
{ "<leader>gh", group = "hunks" },
|
||||||
{ "<leader>q", group = "quit/session" },
|
{ "<leader>q", group = "quit/session" },
|
||||||
{ "<leader>s", group = "search" },
|
{ "<leader>s", group = "search" },
|
||||||
{ "<leader>u", group = "ui" },
|
{ "<leader>u", group = "ui", icon = { icon = " ", color = "cyan" } },
|
||||||
{ "<leader>w", group = "windows" },
|
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = " ", color = "green" } },
|
||||||
{ "<leader>x", group = "diagnostics/quickfix" },
|
|
||||||
{ "[", group = "prev" },
|
{ "[", group = "prev" },
|
||||||
{ "]", group = "next" },
|
{ "]", group = "next" },
|
||||||
{ "g", group = "goto" },
|
{ "g", group = "goto" },
|
||||||
{ "gs", group = "surround" },
|
{ "gs", group = "surround" },
|
||||||
{ "z", group = "fold" },
|
{ "z", group = "fold" },
|
||||||
|
{
|
||||||
|
"<leader>b",
|
||||||
|
group = "buffer",
|
||||||
|
expand = function()
|
||||||
|
return require("which-key.extras").expand.buf()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>w",
|
||||||
|
group = "windows",
|
||||||
|
proxy = "<c-w>",
|
||||||
|
expand = function()
|
||||||
|
return require("which-key.extras").expand.win()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- better descriptions
|
||||||
|
{ "gx", desc = "Open with system app" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -193,7 +220,14 @@ return {
|
||||||
function()
|
function()
|
||||||
require("which-key").show({ global = false })
|
require("which-key").show({ global = false })
|
||||||
end,
|
end,
|
||||||
desc = "Buffer Local Keymaps (which-key)",
|
desc = "Buffer Keymaps (which-key)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<c-w><space>",
|
||||||
|
function()
|
||||||
|
require("which-key").show({ keys = "<c-w>", loop = true })
|
||||||
|
end,
|
||||||
|
desc = "Window Hydra Mode (which-key)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
|
|
@ -17,6 +17,7 @@ return {
|
||||||
vim.cmd([[YankyRingHistory]])
|
vim.cmd([[YankyRingHistory]])
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
mode = { "n", "x" },
|
||||||
desc = "Open Yank History",
|
desc = "Open Yank History",
|
||||||
},
|
},
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
|
|
|
@ -69,6 +69,11 @@ return {
|
||||||
vscode.json_decode = function(str)
|
vscode.json_decode = function(str)
|
||||||
return vim.json.decode(json.json_strip_comments(str))
|
return vim.json.decode(json.json_strip_comments(str))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Extends dap.configurations with entries read from .vscode/launch.json
|
||||||
|
if vim.fn.filereadable(".vscode/launch.json") then
|
||||||
|
vscode.load_launchjs()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,32 @@ return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
elixirls = {},
|
elixirls = {
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>cp",
|
||||||
|
function()
|
||||||
|
local params = vim.lsp.util.make_position_params()
|
||||||
|
LazyVim.lsp.execute({
|
||||||
|
command = "manipulatePipes:serverid",
|
||||||
|
arguments = { "toPipe", params.textDocument.uri, params.position.line, params.position.character },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "To Pipe",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cP",
|
||||||
|
function()
|
||||||
|
local params = vim.lsp.util.make_position_params()
|
||||||
|
LazyVim.lsp.execute({
|
||||||
|
command = "manipulatePipes:serverid",
|
||||||
|
arguments = { "fromPipe", params.textDocument.uri, params.position.line, params.position.character },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "From Pipe",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
125
lua/lazyvim/plugins/extras/lang/lean.lua
Normal file
125
lua/lazyvim/plugins/extras/lang/lean.lua
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
return {
|
||||||
|
recommended = function()
|
||||||
|
return LazyVim.extras.wants({
|
||||||
|
ft = { "lean" },
|
||||||
|
root = { "lean-toolchain" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
"Julian/lean.nvim",
|
||||||
|
event = { "BufReadPre *.lean", "BufNewFile *.lean" },
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- see details below for full configuration options
|
||||||
|
opts = {
|
||||||
|
-- Enable the Lean language server(s)?
|
||||||
|
--
|
||||||
|
-- false to disable, otherwise should be a table of options to pass to `leanls`
|
||||||
|
--
|
||||||
|
-- See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls for details.
|
||||||
|
-- In particular ensure you have followed instructions setting up a callback
|
||||||
|
-- for `LspAttach` which sets your key bindings!
|
||||||
|
lsp = {
|
||||||
|
init_options = {
|
||||||
|
-- See Lean.Lsp.InitializationOptions for details and further options.
|
||||||
|
|
||||||
|
-- Time (in milliseconds) which must pass since latest edit until elaboration begins.
|
||||||
|
-- Lower values may make editing feel faster at the cost of higher CPU usage.
|
||||||
|
-- Note that lean.nvim changes the Lean default for this value!
|
||||||
|
editDelay = 0,
|
||||||
|
|
||||||
|
-- Whether to signal that widgets are supported.
|
||||||
|
hasWidgets = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
ft = {
|
||||||
|
-- A list of patterns which will be used to protect any matching
|
||||||
|
-- Lean file paths from being accidentally modified (by marking the
|
||||||
|
-- buffer as `nomodifiable`).
|
||||||
|
nomodifiable = {
|
||||||
|
-- by default, this list includes the Lean standard libraries,
|
||||||
|
-- as well as files within dependency directories (e.g. `_target`)
|
||||||
|
-- Set this to an empty table to disable.
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Abbreviation support
|
||||||
|
abbreviations = {
|
||||||
|
-- Enable expanding of unicode abbreviations?
|
||||||
|
enable = true,
|
||||||
|
-- additional abbreviations:
|
||||||
|
extra = {
|
||||||
|
-- Add a \wknight abbreviation to insert ♘
|
||||||
|
--
|
||||||
|
-- Note that the backslash is implied, and that you of
|
||||||
|
-- course may also use a snippet engine directly to do
|
||||||
|
-- this if so desired.
|
||||||
|
wknight = "♘",
|
||||||
|
},
|
||||||
|
-- Change if you don't like the backslash
|
||||||
|
-- (comma is a popular choice on French keyboards)
|
||||||
|
leader = "\\",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Enable suggested mappings?
|
||||||
|
--
|
||||||
|
-- false by default, true to enable
|
||||||
|
mappings = true,
|
||||||
|
|
||||||
|
-- Infoview support
|
||||||
|
infoview = {
|
||||||
|
-- Automatically open an infoview on entering a Lean buffer?
|
||||||
|
-- Should be a function that will be called anytime a new Lean file
|
||||||
|
-- is opened. Return true to open an infoview, otherwise false.
|
||||||
|
-- Setting this to `true` is the same as `function() return true end`,
|
||||||
|
-- i.e. autoopen for any Lean file, or setting it to `false` is the
|
||||||
|
-- same as `function() return false end`, i.e. never autoopen.
|
||||||
|
autoopen = true,
|
||||||
|
|
||||||
|
-- Set infoview windows' starting dimensions.
|
||||||
|
-- Windows are opened horizontally or vertically depending on spacing.
|
||||||
|
width = 50,
|
||||||
|
height = 20,
|
||||||
|
|
||||||
|
-- Put the infoview on the top or bottom when horizontal?
|
||||||
|
-- top | bottom
|
||||||
|
horizontal_position = "bottom",
|
||||||
|
|
||||||
|
-- Always open the infoview window in a separate tabpage.
|
||||||
|
-- Might be useful if you are using a screen reader and don't want too
|
||||||
|
-- many dynamic updates in the terminal at the same time.
|
||||||
|
-- Note that `height` and `width` will be ignored in this case.
|
||||||
|
separate_tab = false,
|
||||||
|
|
||||||
|
-- Show indicators for pin locations when entering an infoview window?
|
||||||
|
-- always | never | auto (= only when there are multiple pins)
|
||||||
|
indicators = "auto",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Progress bar support
|
||||||
|
progress_bars = {
|
||||||
|
-- Enable the progress bars?
|
||||||
|
enable = true,
|
||||||
|
-- What character should be used for the bars?
|
||||||
|
character = "│",
|
||||||
|
-- Use a different priority for the signs
|
||||||
|
priority = 10,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Redirect Lean's stderr messages somehwere (to a buffer by default)
|
||||||
|
stderr = {
|
||||||
|
enable = true,
|
||||||
|
-- height of the window
|
||||||
|
height = 5,
|
||||||
|
-- a callback which will be called with (multi-line) stderr output
|
||||||
|
-- e.g., use:
|
||||||
|
-- on_lines = function(lines) vim.notify(lines) end
|
||||||
|
-- if you want to redirect stderr to `vim.notify`.
|
||||||
|
-- The default implementation will redirect to a dedicated stderr
|
||||||
|
-- window.
|
||||||
|
on_lines = nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -92,31 +92,36 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"lukas-reineke/headlines.nvim",
|
"MeanderingProgrammer/markdown.nvim",
|
||||||
opts = function()
|
opts = {
|
||||||
local opts = {}
|
file_types = { "markdown", "norg", "rmd", "org" },
|
||||||
for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do
|
code = {
|
||||||
opts[ft] = {
|
sign = false,
|
||||||
headline_highlights = {},
|
width = "block",
|
||||||
-- disable bullets for now. See https://github.com/lukas-reineke/headlines.nvim/issues/66
|
right_pad = 1,
|
||||||
bullets = {},
|
},
|
||||||
quote_string = false,
|
heading = {
|
||||||
}
|
sign = false,
|
||||||
for i = 1, 6 do
|
icons = {},
|
||||||
local hl = "Headline" .. i
|
},
|
||||||
vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true })
|
},
|
||||||
table.insert(opts[ft].headline_highlights, hl)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return opts
|
|
||||||
end,
|
|
||||||
ft = { "markdown", "norg", "rmd", "org" },
|
ft = { "markdown", "norg", "rmd", "org" },
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- PERF: schedule to prevent headlines slowing down opening a file
|
require("render-markdown").setup(opts)
|
||||||
vim.schedule(function()
|
LazyVim.toggle.map("<leader>um", {
|
||||||
require("headlines").setup(opts)
|
name = "Render Markdown",
|
||||||
require("headlines").refresh()
|
get = function()
|
||||||
end)
|
return require("render-markdown.state").enabled
|
||||||
|
end,
|
||||||
|
set = function(enabled)
|
||||||
|
local m = require("render-markdown")
|
||||||
|
if enabled then
|
||||||
|
m.enable()
|
||||||
|
else
|
||||||
|
m.disable()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
39
lua/lazyvim/plugins/extras/lang/ocaml.lua
Normal file
39
lua/lazyvim/plugins/extras/lang/ocaml.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
return {
|
||||||
|
recommended = function()
|
||||||
|
return LazyVim.extras.wants({
|
||||||
|
ft = { "ml", "mli", "cmi", "cmo", "cmx", "cma", "cmxa", "cmxs", "cmt", "cmti", "opam" },
|
||||||
|
root = { "merlin.opam", "dune-project" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "ocaml" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
ocamllsp = {
|
||||||
|
get_language_id = function(_, ftype)
|
||||||
|
return language_id_of[ftype]
|
||||||
|
end,
|
||||||
|
root_dir = function(fname)
|
||||||
|
return require("lspconfig.util").root_pattern(
|
||||||
|
"*.opam",
|
||||||
|
"esy.json",
|
||||||
|
"package.json",
|
||||||
|
".git",
|
||||||
|
"dune-project",
|
||||||
|
"dune-workspace",
|
||||||
|
"*.ml"
|
||||||
|
)(fname)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -2,11 +2,12 @@ if lazyvim_docs then
|
||||||
-- LSP Server to use for Python.
|
-- LSP Server to use for Python.
|
||||||
-- Set to "basedpyright" to use basedpyright instead of pyright.
|
-- Set to "basedpyright" to use basedpyright instead of pyright.
|
||||||
vim.g.lazyvim_python_lsp = "pyright"
|
vim.g.lazyvim_python_lsp = "pyright"
|
||||||
vim.g.lazyvim_python_ruff = "ruff_lsp"
|
-- Set to "ruff_lsp" to use the old LSP implementation version.
|
||||||
|
vim.g.lazyvim_python_ruff = "ruff"
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp = vim.g.lazyvim_python_lsp or "pyright"
|
local lsp = vim.g.lazyvim_python_lsp or "pyright"
|
||||||
local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp"
|
local ruff = vim.g.lazyvim_python_ruff or "ruff"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
recommended = function()
|
recommended = function()
|
||||||
|
@ -30,22 +31,22 @@ return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
pyright = {
|
ruff = {
|
||||||
enabled = lsp == "pyright",
|
cmd_env = { RUFF_TRACE = "messages" },
|
||||||
},
|
init_options = {
|
||||||
basedpyright = {
|
settings = {
|
||||||
enabled = lsp == "basedpyright",
|
logLevel = "error",
|
||||||
},
|
},
|
||||||
[lsp] = {
|
},
|
||||||
enabled = true,
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>co",
|
||||||
|
LazyVim.lsp.action["source.organizeImports"],
|
||||||
|
desc = "Organize Imports",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ruff_lsp = {
|
ruff_lsp = {
|
||||||
enabled = ruff == "ruff_lsp",
|
|
||||||
},
|
|
||||||
ruff = {
|
|
||||||
enabled = ruff == "ruff",
|
|
||||||
},
|
|
||||||
[ruff] = {
|
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>co",
|
"<leader>co",
|
||||||
|
@ -65,6 +66,16 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local servers = { "pyright", "basedpyright", "ruff", "ruff_lsp", ruff, lsp }
|
||||||
|
for _, server in ipairs(servers) do
|
||||||
|
opts.servers[server] = opts.servers[server] or {}
|
||||||
|
opts.servers[server].enabled = server == lsp or server == ruff
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
@ -127,4 +138,15 @@ return {
|
||||||
table.insert(opts.auto_brackets, "python")
|
table.insert(opts.auto_brackets, "python")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Don't mess up DAP adapters provided by nvim-dap-python
|
||||||
|
{
|
||||||
|
"jay-babu/mason-nvim-dap.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
handlers = {
|
||||||
|
python = function() end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,15 @@ return {
|
||||||
vim.keymap.set("n", "<Enter>", "<Plug>RDSendLine", { buffer = true })
|
vim.keymap.set("n", "<Enter>", "<Plug>RDSendLine", { buffer = true })
|
||||||
vim.keymap.set("v", "<Enter>", "<Plug>RSendSelection", { buffer = true })
|
vim.keymap.set("v", "<Enter>", "<Plug>RSendSelection", { buffer = true })
|
||||||
|
|
||||||
-- Increase the width of which-key to handle the longer r-nvim descriptions
|
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
wk.add({
|
wk.add({
|
||||||
|
buffer = true,
|
||||||
{ "<localleader>a", group = "all" },
|
{ "<localleader>a", group = "all" },
|
||||||
{ "<localleader>b", group = "between marks" },
|
{ "<localleader>b", group = "between marks" },
|
||||||
{ "<localleader>c", group = "chunks" },
|
{ "<localleader>c", group = "chunks" },
|
||||||
{ "<localleader>f", group = "functions" },
|
{ "<localleader>f", group = "functions" },
|
||||||
{ "<localleader>g", group = "goto" },
|
{ "<localleader>g", group = "goto" },
|
||||||
|
{ "<localleader>i", group = "install" },
|
||||||
{ "<localleader>k", group = "knit" },
|
{ "<localleader>k", group = "knit" },
|
||||||
{ "<localleader>p", group = "paragraph" },
|
{ "<localleader>p", group = "paragraph" },
|
||||||
{ "<localleader>q", group = "quarto" },
|
{ "<localleader>q", group = "quarto" },
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
if lazyvim_docs then
|
||||||
|
-- LSP Server to use for Ruby.
|
||||||
|
-- Set to "solargraph" to use solargraph instead of ruby_lsp.
|
||||||
|
vim.g.lazyvim_ruby_lsp = "ruby_lsp"
|
||||||
|
vim.g.lazyvim_ruby_formatter = "rubocop"
|
||||||
|
end
|
||||||
|
|
||||||
|
local lsp = vim.g.lazyvim_ruby_lsp or "ruby_lsp"
|
||||||
|
if vim.fn.has("nvim-0.10") == 0 then
|
||||||
|
-- ruby_lsp does not work well with Neovim < 0.10
|
||||||
|
lsp = vim.g.lazyvim_ruby_lsp or "solargraph"
|
||||||
|
end
|
||||||
|
local formatter = vim.g.lazyvim_ruby_formatter or "rubocop"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
recommended = function()
|
recommended = function()
|
||||||
return LazyVim.extras.wants({
|
return LazyVim.extras.wants({
|
||||||
|
@ -11,12 +25,29 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
---@class PluginLspOpts
|
||||||
opts = {
|
opts = {
|
||||||
|
---@type lspconfig.options
|
||||||
servers = {
|
servers = {
|
||||||
solargraph = {},
|
ruby_lsp = {
|
||||||
|
enabled = lsp == "ruby_lsp",
|
||||||
|
},
|
||||||
|
solargraph = {
|
||||||
|
enabled = lsp == "solargraph",
|
||||||
|
},
|
||||||
|
rubocop = {
|
||||||
|
enabled = formatter == "rubocop",
|
||||||
|
},
|
||||||
|
standardrb = {
|
||||||
|
enabled = formatter == "standardrb",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = { ensure_installed = { "erb-formatter", "erb-lint" } },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
@ -27,6 +58,16 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
ruby = { formatter },
|
||||||
|
eruby = { "erb-format" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
|
|
@ -56,6 +56,9 @@ return {
|
||||||
{ title = "Neotest Summary", ft = "neotest-summary" },
|
{ title = "Neotest Summary", ft = "neotest-summary" },
|
||||||
-- "neo-tree",
|
-- "neo-tree",
|
||||||
},
|
},
|
||||||
|
right = {
|
||||||
|
{ title = "Grug Far", ft = "grug-far", size = { width = 0.4 } },
|
||||||
|
},
|
||||||
keys = {
|
keys = {
|
||||||
-- increase width
|
-- increase width
|
||||||
["<c-Right>"] = function(win)
|
["<c-Right>"] = function(win)
|
||||||
|
|
|
@ -14,6 +14,23 @@ return {
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "grug-far",
|
||||||
|
callback = function()
|
||||||
|
vim.b.minianimate_disable = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
LazyVim.toggle.map("<leader>ua", {
|
||||||
|
name = "Mini Animate",
|
||||||
|
get = function()
|
||||||
|
return not vim.g.minianimate_disable
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
vim.g.minianimate_disable = not state
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
local animate = require("mini.animate")
|
local animate = require("mini.animate")
|
||||||
return {
|
return {
|
||||||
resize = {
|
resize = {
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
-- Show context of the current function
|
-- Show context of the current function
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
event = "LazyFile",
|
event = "VeryLazy",
|
||||||
opts = { mode = "cursor", max_lines = 3 },
|
opts = function()
|
||||||
keys = {
|
local tsc = require("treesitter-context")
|
||||||
{
|
|
||||||
"<leader>ut",
|
LazyVim.toggle.map("<leader>ut", {
|
||||||
function()
|
name = "Treesitter Context",
|
||||||
local tsc = require("treesitter-context")
|
get = tsc.enabled,
|
||||||
tsc.toggle()
|
set = function(state)
|
||||||
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
|
if state then
|
||||||
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
|
tsc.enable()
|
||||||
else
|
else
|
||||||
LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
|
tsc.disable()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = "Toggle Treesitter Context",
|
})
|
||||||
},
|
|
||||||
},
|
return { mode = "cursor", max_lines = 3 }
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@param opts ConformOpts
|
---@param opts conform.setupOpts
|
||||||
function M.setup(_, opts)
|
function M.setup(_, opts)
|
||||||
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
|
||||||
|
@ -10,6 +10,10 @@ function M.setup(_, opts)
|
||||||
opts[key] = nil
|
opts[key] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
if opts.format then
|
||||||
|
LazyVim.warn("**conform.nvim** `opts.format` is deprecated. Please use `opts.default_format_opts` instead.")
|
||||||
|
end
|
||||||
require("conform").setup(opts)
|
require("conform").setup(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,8 +41,7 @@ return {
|
||||||
priority = 100,
|
priority = 100,
|
||||||
primary = true,
|
primary = true,
|
||||||
format = function(buf)
|
format = function(buf)
|
||||||
local opts = LazyVim.opts("conform.nvim")
|
require("conform").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)
|
||||||
|
@ -59,16 +62,14 @@ return {
|
||||||
"Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
|
"Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
|
||||||
}, { title = "LazyVim" })
|
}, { title = "LazyVim" })
|
||||||
end
|
end
|
||||||
---@class ConformOpts
|
---@type conform.setupOpts
|
||||||
local opts = {
|
local opts = {
|
||||||
-- LazyVim will use these options when formatting with the conform.nvim formatter
|
default_format_opts = {
|
||||||
format = {
|
|
||||||
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_format = "fallback", -- not recommended to change
|
lsp_format = "fallback", -- not recommended to change
|
||||||
},
|
},
|
||||||
---@type table<string, conform.FormatterUnit[]>
|
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
fish = { "fish_indent" },
|
fish = { "fish_indent" },
|
||||||
|
|
|
@ -7,9 +7,9 @@ return {
|
||||||
"mason.nvim",
|
"mason.nvim",
|
||||||
{ "williamboman/mason-lspconfig.nvim", config = function() end },
|
{ "williamboman/mason-lspconfig.nvim", config = function() end },
|
||||||
},
|
},
|
||||||
---@class PluginLspOpts
|
|
||||||
opts = function()
|
opts = function()
|
||||||
return {
|
---@class PluginLspOpts
|
||||||
|
local ret = {
|
||||||
-- options for vim.diagnostic.config()
|
-- options for vim.diagnostic.config()
|
||||||
---@type vim.diagnostic.Opts
|
---@type vim.diagnostic.Opts
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
|
@ -114,6 +114,7 @@ return {
|
||||||
-- ["*"] = function(server, opts) end,
|
-- ["*"] = function(server, opts) end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
return ret
|
||||||
end,
|
end,
|
||||||
---@param opts PluginLspOpts
|
---@param opts PluginLspOpts
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
@ -150,7 +151,7 @@ return {
|
||||||
and vim.bo[buffer].buftype == ""
|
and vim.bo[buffer].buftype == ""
|
||||||
and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype)
|
and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype)
|
||||||
then
|
then
|
||||||
LazyVim.toggle.inlay_hints(buffer, true)
|
vim.lsp.inlay_hint.enable(true, { bufnr = buffer })
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -195,6 +196,9 @@ return {
|
||||||
local server_opts = vim.tbl_deep_extend("force", {
|
local server_opts = vim.tbl_deep_extend("force", {
|
||||||
capabilities = vim.deepcopy(capabilities),
|
capabilities = vim.deepcopy(capabilities),
|
||||||
}, servers[server] or {})
|
}, servers[server] or {})
|
||||||
|
if server_opts.enabled == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if opts.setup[server] then
|
if opts.setup[server] then
|
||||||
if opts.setup[server](server, server_opts) then
|
if opts.setup[server](server, server_opts) then
|
||||||
|
|
|
@ -14,10 +14,10 @@ function M.get()
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
M._keys = {
|
M._keys = {
|
||||||
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
||||||
{ "gd", vim.lsp.buf.definition(), desc = "Goto Definition", has = "definition" },
|
{ "gd", vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" },
|
||||||
{ "gr", vim.lsp.buf.references(), desc = "References", nowait = true },
|
{ "gr", vim.lsp.buf.references, desc = "References", nowait = true },
|
||||||
{ "gI", vim.lsp.buf.implementation(), desc = "Goto Implementation" },
|
{ "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" },
|
||||||
{ "gy", vim.lsp.buf.type_definition(), desc = "Goto T[y]pe Definition" },
|
{ "gy", vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" },
|
||||||
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
||||||
{ "K", vim.lsp.buf.hover, desc = "Hover" },
|
{ "K", vim.lsp.buf.hover, desc = "Hover" },
|
||||||
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
|
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
return {
|
return {
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
opts = {
|
||||||
|
spec = {
|
||||||
|
{ "<BS>", desc = "Decrement Selection", mode = "x" },
|
||||||
|
{ "<c-space>", desc = "Increment Selection", mode = { "x", "n" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- Treesitter is a new parser generator tool that we can
|
-- Treesitter is a new parser generator tool that we can
|
||||||
-- use in Neovim to power faster and more accurate
|
-- use in Neovim to power faster and more accurate
|
||||||
-- syntax highlighting.
|
-- syntax highlighting.
|
||||||
|
|
|
@ -198,20 +198,22 @@ return {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- do not add trouble symbols if aerial is enabled
|
-- do not add trouble symbols if aerial is enabled
|
||||||
|
-- And allow it to be overriden for some buffer types (see autocmds)
|
||||||
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
|
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
|
||||||
local trouble = require("trouble")
|
local trouble = require("trouble")
|
||||||
local symbols = trouble.statusline
|
local symbols = trouble.statusline({
|
||||||
and trouble.statusline({
|
mode = "symbols",
|
||||||
mode = "symbols",
|
groups = {},
|
||||||
groups = {},
|
title = false,
|
||||||
title = false,
|
filter = { range = true },
|
||||||
filter = { range = true },
|
format = "{kind_icon}{symbol.name:Normal}",
|
||||||
format = "{kind_icon}{symbol.name:Normal}",
|
hl_group = "lualine_c_normal",
|
||||||
hl_group = "lualine_c_normal",
|
})
|
||||||
})
|
|
||||||
table.insert(opts.sections.lualine_c, {
|
table.insert(opts.sections.lualine_c, {
|
||||||
symbols and symbols.get,
|
symbols and symbols.get,
|
||||||
cond = symbols and symbols.has,
|
cond = function()
|
||||||
|
return vim.b.trouble_lualine ~= false and symbols.has()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -223,28 +225,40 @@ return {
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
event = "LazyFile",
|
event = "LazyFile",
|
||||||
opts = {
|
opts = function()
|
||||||
indent = {
|
LazyVim.toggle.map("<leader>ug", {
|
||||||
char = "│",
|
name = "Indention Guides",
|
||||||
tab_char = "│",
|
get = function()
|
||||||
},
|
return require("ibl.config").get_config(0).enabled
|
||||||
scope = { show_start = false, show_end = false },
|
end,
|
||||||
exclude = {
|
set = function(state)
|
||||||
filetypes = {
|
require("ibl").setup_buffer(0, { enabled = state })
|
||||||
"help",
|
end,
|
||||||
"alpha",
|
})
|
||||||
"dashboard",
|
|
||||||
"neo-tree",
|
return {
|
||||||
"Trouble",
|
indent = {
|
||||||
"trouble",
|
char = "│",
|
||||||
"lazy",
|
tab_char = "│",
|
||||||
"mason",
|
|
||||||
"notify",
|
|
||||||
"toggleterm",
|
|
||||||
"lazyterm",
|
|
||||||
},
|
},
|
||||||
},
|
scope = { show_start = false, show_end = false },
|
||||||
},
|
exclude = {
|
||||||
|
filetypes = {
|
||||||
|
"help",
|
||||||
|
"alpha",
|
||||||
|
"dashboard",
|
||||||
|
"neo-tree",
|
||||||
|
"Trouble",
|
||||||
|
"trouble",
|
||||||
|
"lazy",
|
||||||
|
"mason",
|
||||||
|
"notify",
|
||||||
|
"toggleterm",
|
||||||
|
"lazyterm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
main = "ibl",
|
main = "ibl",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,19 @@ end
|
||||||
|
|
||||||
---@param buf? boolean
|
---@param buf? boolean
|
||||||
function M.toggle(buf)
|
function M.toggle(buf)
|
||||||
|
M.enable(not M.enabled(), buf)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param enable? boolean
|
||||||
|
---@param buf? boolean
|
||||||
|
function M.enable(enable, buf)
|
||||||
|
if enable == nil then
|
||||||
|
enable = true
|
||||||
|
end
|
||||||
if buf then
|
if buf then
|
||||||
vim.b.autoformat = not M.enabled()
|
vim.b.autoformat = enable
|
||||||
else
|
else
|
||||||
vim.g.autoformat = not M.enabled()
|
vim.g.autoformat = enable
|
||||||
vim.b.autoformat = nil
|
vim.b.autoformat = nil
|
||||||
end
|
end
|
||||||
M.info()
|
M.info()
|
||||||
|
|
|
@ -60,7 +60,8 @@ function M.ai_buffer(ai_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register all text objects with which-key
|
-- register all text objects with which-key
|
||||||
function M.ai_whichkey()
|
---@param opts table
|
||||||
|
function M.ai_whichkey(opts)
|
||||||
local objects = {
|
local objects = {
|
||||||
{ " ", desc = "whitespace" },
|
{ " ", desc = "whitespace" },
|
||||||
{ '"', desc = '" string' },
|
{ '"', desc = '" string' },
|
||||||
|
@ -92,14 +93,20 @@ function M.ai_whichkey()
|
||||||
}
|
}
|
||||||
|
|
||||||
local ret = { mode = { "o", "x" } }
|
local ret = { mode = { "o", "x" } }
|
||||||
for prefix, name in pairs({
|
---@type table<string, string>
|
||||||
i = "inside",
|
local mappings = vim.tbl_extend("force", {}, {
|
||||||
a = "around",
|
around = "a",
|
||||||
il = "last",
|
inside = "i",
|
||||||
["in"] = "next",
|
around_next = "an",
|
||||||
al = "last",
|
inside_next = "in",
|
||||||
an = "next",
|
around_last = "al",
|
||||||
}) do
|
inside_last = "il",
|
||||||
|
}, opts.mappings or {})
|
||||||
|
mappings.goto_left = nil
|
||||||
|
mappings.goto_right = nil
|
||||||
|
|
||||||
|
for name, prefix in pairs(mappings) do
|
||||||
|
name = name:gsub("^around_", ""):gsub("^inside_", "")
|
||||||
ret[#ret + 1] = { prefix, group = name }
|
ret[#ret + 1] = { prefix, group = name }
|
||||||
for _, obj in ipairs(objects) do
|
for _, obj in ipairs(objects) do
|
||||||
local desc = obj.desc
|
local desc = obj.desc
|
||||||
|
@ -114,6 +121,15 @@ end
|
||||||
|
|
||||||
---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean}
|
---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean}
|
||||||
function M.pairs(opts)
|
function M.pairs(opts)
|
||||||
|
LazyVim.toggle.map("<leader>up", {
|
||||||
|
name = "Mini Pairs",
|
||||||
|
get = function()
|
||||||
|
return not vim.g.minipairs_disable
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
vim.g.minipairs_disable = not state
|
||||||
|
end,
|
||||||
|
})
|
||||||
local pairs = require("mini.pairs")
|
local pairs = require("mini.pairs")
|
||||||
pairs.setup(opts)
|
pairs.setup(opts)
|
||||||
local open = pairs.open
|
local open = pairs.open
|
||||||
|
|
|
@ -81,7 +81,11 @@ function M.open(file, opts)
|
||||||
vim.opt_local.signcolumn = "yes"
|
vim.opt_local.signcolumn = "yes"
|
||||||
vim.opt_local.statuscolumn = " "
|
vim.opt_local.statuscolumn = " "
|
||||||
vim.opt_local.conceallevel = 3
|
vim.opt_local.conceallevel = 3
|
||||||
vim.diagnostic.disable(float.buf)
|
if vim.diagnostic.enable then
|
||||||
|
pcall(vim.diagnostic.enable, false, { bufnr = float.buf })
|
||||||
|
else
|
||||||
|
pcall(vim.diagnostic.disable, float.buf)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -87,6 +87,8 @@ function M.open(cmd, opts)
|
||||||
vim.cmd.startinsert()
|
vim.cmd.startinsert()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.cmd("noh")
|
||||||
end
|
end
|
||||||
|
|
||||||
return terminals[termkey]
|
return terminals[termkey]
|
||||||
|
|
|
@ -1,115 +1,186 @@
|
||||||
---@class lazyvim.util.toggle
|
---@class lazyvim.util.toggle
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@param silent boolean?
|
---@class lazyvim.Toggle
|
||||||
---@param values? {[1]:any, [2]:any}
|
---@field name string
|
||||||
function M.option(option, silent, values)
|
---@field get fun():boolean
|
||||||
if values then
|
---@field set fun(state:boolean)
|
||||||
if vim.opt_local[option]:get() == values[1] then
|
|
||||||
---@diagnostic disable-next-line: no-unknown
|
---@class lazyvim.Toggle.wrap: lazyvim.Toggle
|
||||||
vim.opt_local[option] = values[2]
|
---@operator call:boolean
|
||||||
else
|
|
||||||
---@diagnostic disable-next-line: no-unknown
|
---@param toggle lazyvim.Toggle
|
||||||
vim.opt_local[option] = values[1]
|
function M.wrap(toggle)
|
||||||
end
|
return setmetatable(toggle, {
|
||||||
return LazyVim.info("Set " .. option .. " to " .. vim.opt_local[option]:get(), { title = "Option" })
|
__call = function()
|
||||||
end
|
toggle.set(not toggle.get())
|
||||||
---@diagnostic disable-next-line: no-unknown
|
local state = toggle.get()
|
||||||
vim.opt_local[option] = not vim.opt_local[option]:get()
|
if state then
|
||||||
if not silent then
|
LazyVim.info("Enabled " .. toggle.name, { title = toggle.name })
|
||||||
if vim.opt_local[option]:get() then
|
else
|
||||||
LazyVim.info("Enabled " .. option, { title = "Option" })
|
LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name })
|
||||||
else
|
end
|
||||||
LazyVim.warn("Disabled " .. option, { title = "Option" })
|
return state
|
||||||
end
|
end,
|
||||||
end
|
}) --[[@as lazyvim.Toggle.wrap]]
|
||||||
end
|
end
|
||||||
|
|
||||||
local nu = { number = true, relativenumber = true }
|
---@param lhs string
|
||||||
function M.number()
|
---@param toggle lazyvim.Toggle
|
||||||
if vim.opt_local.number:get() or vim.opt_local.relativenumber:get() then
|
function M.map(lhs, toggle)
|
||||||
nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() }
|
local t = M.wrap(toggle)
|
||||||
vim.opt_local.number = false
|
LazyVim.safe_keymap_set("n", lhs, function()
|
||||||
vim.opt_local.relativenumber = false
|
t()
|
||||||
LazyVim.warn("Disabled line numbers", { title = "Option" })
|
end, { desc = "Toggle " .. toggle.name })
|
||||||
else
|
M.wk(lhs, toggle)
|
||||||
vim.opt_local.number = nu.number
|
|
||||||
vim.opt_local.relativenumber = nu.relativenumber
|
|
||||||
LazyVim.info("Enabled line numbers", { title = "Option" })
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local enabled = true
|
function M.wk(lhs, toggle)
|
||||||
function M.diagnostics()
|
if not LazyVim.has("which-key.nvim") then
|
||||||
-- if this Neovim version supports checking if diagnostics are enabled
|
|
||||||
-- then use that for the current state
|
|
||||||
if vim.diagnostic.is_enabled then
|
|
||||||
enabled = vim.diagnostic.is_enabled()
|
|
||||||
elseif vim.diagnostic.is_disabled then
|
|
||||||
enabled = not vim.diagnostic.is_disabled()
|
|
||||||
end
|
|
||||||
enabled = not enabled
|
|
||||||
|
|
||||||
if enabled then
|
|
||||||
vim.diagnostic.enable()
|
|
||||||
LazyVim.info("Enabled diagnostics", { title = "Diagnostics" })
|
|
||||||
else
|
|
||||||
vim.diagnostic.disable()
|
|
||||||
LazyVim.warn("Disabled diagnostics", { title = "Diagnostics" })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param buf? number
|
|
||||||
---@param value? boolean
|
|
||||||
function M.inlay_hints(buf, value)
|
|
||||||
local ih = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
|
||||||
if type(ih) == "function" then
|
|
||||||
ih(buf, value)
|
|
||||||
elseif type(ih) == "table" and ih.enable then
|
|
||||||
if value == nil then
|
|
||||||
value = not ih.is_enabled({ bufnr = buf or 0 })
|
|
||||||
end
|
|
||||||
ih.enable(value, { bufnr = buf })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---@type {k:string, v:any}[]
|
|
||||||
M._maximized = nil
|
|
||||||
---@param state boolean?
|
|
||||||
function M.maximize(state)
|
|
||||||
if state == (M._maximized ~= nil) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if M._maximized then
|
local function safe_get()
|
||||||
for _, opt in ipairs(M._maximized) do
|
local ok, enabled = pcall(toggle.get)
|
||||||
vim.o[opt.k] = opt.v
|
if not ok then
|
||||||
|
LazyVim.error({ "Failed to get toggle state for **" .. toggle.name .. "**:\n", enabled }, { once = true })
|
||||||
end
|
end
|
||||||
M._maximized = nil
|
return enabled
|
||||||
vim.cmd("wincmd =")
|
|
||||||
else
|
|
||||||
M._maximized = {}
|
|
||||||
local function set(k, v)
|
|
||||||
table.insert(M._maximized, 1, { k = k, v = vim.o[k] })
|
|
||||||
vim.o[k] = v
|
|
||||||
end
|
|
||||||
set("winwidth", 999)
|
|
||||||
set("winheight", 999)
|
|
||||||
set("winminwidth", 10)
|
|
||||||
set("winminheight", 4)
|
|
||||||
vim.cmd("wincmd =")
|
|
||||||
end
|
end
|
||||||
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
|
require("which-key").add({
|
||||||
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
|
{
|
||||||
vim.api.nvim_create_autocmd("ExitPre", {
|
lhs,
|
||||||
once = true,
|
icon = function()
|
||||||
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
|
return safe_get() and { icon = " ", color = "green" } or { icon = " ", color = "yellow" }
|
||||||
desc = "Restore width/height when close Neovim while maximized",
|
end,
|
||||||
callback = function()
|
desc = function()
|
||||||
M.maximize(false)
|
return (safe_get() and "Disable " or "Enable ") .. toggle.name
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
M.treesitter = M.wrap({
|
||||||
|
name = "Treesitter Highlight",
|
||||||
|
get = function()
|
||||||
|
return vim.b.ts_highlight
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
if state then
|
||||||
|
vim.treesitter.start()
|
||||||
|
else
|
||||||
|
vim.treesitter.stop()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
---@param buf? boolean
|
||||||
|
function M.format(buf)
|
||||||
|
return M.wrap({
|
||||||
|
name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")",
|
||||||
|
get = function()
|
||||||
|
if not buf then
|
||||||
|
return vim.g.autoformat == nil or vim.g.autoformat
|
||||||
|
end
|
||||||
|
return LazyVim.format.enabled()
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
LazyVim.format.enable(state, buf)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param opts? {values?: {[1]:any, [2]:any}, name?: string}
|
||||||
|
function M.option(option, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local name = opts.name or option
|
||||||
|
local on = opts.values and opts.values[2] or true
|
||||||
|
local off = opts.values and opts.values[1] or false
|
||||||
|
return M.wrap({
|
||||||
|
name = name,
|
||||||
|
get = function()
|
||||||
|
return vim.opt_local[option]:get() == on
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
vim.opt_local[option] = state and on or off
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local nu = { number = true, relativenumber = true }
|
||||||
|
M.number = M.wrap({
|
||||||
|
name = "Line Numbers",
|
||||||
|
get = function()
|
||||||
|
return vim.opt_local.number:get() or vim.opt_local.relativenumber:get()
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
if state then
|
||||||
|
vim.opt_local.number = nu.number
|
||||||
|
vim.opt_local.relativenumber = nu.relativenumber
|
||||||
|
else
|
||||||
|
nu = { number = vim.opt_local.number:get(), relativenumber = vim.opt_local.relativenumber:get() }
|
||||||
|
vim.opt_local.number = false
|
||||||
|
vim.opt_local.relativenumber = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
M.diagnostics = M.wrap({
|
||||||
|
name = "Diagnostics",
|
||||||
|
get = function()
|
||||||
|
return vim.diagnostic.is_enabled and vim.diagnostic.is_enabled()
|
||||||
|
end,
|
||||||
|
set = vim.diagnostic.enable,
|
||||||
|
})
|
||||||
|
|
||||||
|
M.inlay_hints = M.wrap({
|
||||||
|
name = "Inlay Hints",
|
||||||
|
get = function()
|
||||||
|
return vim.lsp.inlay_hint.is_enabled({ bufnr = 0 })
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
vim.lsp.inlay_hint.enable(state, { bufnr = 0 })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
---@type {k:string, v:any}[]
|
||||||
|
M._maximized = nil
|
||||||
|
M.maximize = M.wrap({
|
||||||
|
name = "Maximize",
|
||||||
|
get = function()
|
||||||
|
return M._maximized ~= nil
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
if state then
|
||||||
|
M._maximized = {}
|
||||||
|
local function set(k, v)
|
||||||
|
table.insert(M._maximized, 1, { k = k, v = vim.o[k] })
|
||||||
|
vim.o[k] = v
|
||||||
|
end
|
||||||
|
set("winwidth", 999)
|
||||||
|
set("winheight", 999)
|
||||||
|
set("winminwidth", 10)
|
||||||
|
set("winminheight", 4)
|
||||||
|
vim.cmd("wincmd =")
|
||||||
|
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
|
||||||
|
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
|
||||||
|
vim.api.nvim_create_autocmd("ExitPre", {
|
||||||
|
once = true,
|
||||||
|
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
|
||||||
|
desc = "Restore width/height when close Neovim while maximized",
|
||||||
|
callback = function()
|
||||||
|
M.maximize.set(false)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
for _, opt in ipairs(M._maximized) do
|
||||||
|
vim.o[opt.k] = opt.v
|
||||||
|
end
|
||||||
|
M._maximized = nil
|
||||||
|
vim.cmd("wincmd =")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
setmetatable(M, {
|
setmetatable(M, {
|
||||||
__call = function(m, ...)
|
__call = function(m, ...)
|
||||||
return m.option(...)
|
return m.option(...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue