Compare commits

...

16 Commits
v12.30.0 ... 11

Author SHA1 Message Date
a3089ba06b feat(keymaps): added leader-uI to open InspectTree 2024-05-16 21:23:35 +02:00
c3483f86df fix(treesitter-rewrite): disable vim-illuminate 2024-05-16 21:23:35 +02:00
62f4f484d7 feat(lsp): enable inlay hints by default on Neovim 0.10 2024-05-16 21:23:35 +02:00
10675c8080 docs: update 2024-05-16 21:23:29 +02:00
4226cf71f1 docs: updated news for 11.0 release 2024-05-16 21:06:45 +02:00
abefa2d2c9 feat(extras): added extra for the nvim-treesitter rewrite. Some plugins are not compatible and will be disabled. 2024-05-16 20:52:53 +02:00
e883620c7c feat(util)!: move vim-startuptime to an extra 2024-05-16 19:00:13 +02:00
2cb9dc5487 feat(coding)!: move mini.ai to an extra 2024-05-16 18:56:54 +02:00
0e0aae0155 feat(mini.surround)!: move mini.surround to an extra 2024-05-16 18:55:50 +02:00
bafca50bc8 feat(ui)!: move mini.indentscope to an extra 2024-05-16 18:53:21 +02:00
a0010ae549 feat(ui)!: moved treesitter-context to an extra. No longer a core plugin 2024-05-16 18:20:09 +02:00
ebbf67211e refactor: comments code 2024-05-16 18:07:38 +02:00
0aff79ec74 feat(coding)!: native snippets are now the default on Neovim 0.10. Install the luasnip extra to get luasnip back 2024-05-16 18:03:58 +02:00
800d33eebb feat(coding)!: use native comments on 0.10, with support for ts_context_commentstring 2024-05-16 17:51:47 +02:00
ba7d0203df feat(util): set_upvalue 2024-05-16 17:44:41 +02:00
fffb47b69f fix(health): add warning when not using 0.10.0 2024-05-16 16:49:35 +02:00
22 changed files with 527 additions and 335 deletions

38
NEWS.md
View File

@ -1,5 +1,43 @@
# What's new?
## 11.x
Since Neovim 0.10 has been released, I've been working on a new version of **LazyVim**
that is fully compatible with all the latest Neovim features.
Additionally, some core plugins have been moved to extras.
- `native snippets` are not the default on Neovim 0.10
Older versions of Neovim will use the new `luasnip` extra.
- `native comments` are now the default on Neovim 0.10
Older versions of Neovim will use the new `mini-comment` extra.
`nvim-ts-context-commentstring` has been integrated in the native comments.
- `inlay hints` have been in **LazyVim** for a while, but are now
enabled by default. To disable then:
```lua
{
"nvim-lspconfig",
opts = {
inlay_hints = { enabled = true },
}
}
```
- plugins moved to extras:
- `mini.ai` which I couldn't live without, but not everyone needs it
- `mini.surround`
- `mini.indentscope` scopes are now also highlighted with `indent-blankline`
- `nvim-treesitter-context`
- There's a new extra for the `nvim-treesitter` **rewrite**.
Since the rewrite is not backward compatible, some plugins will be disabled
when you enable this extra: `vim-illuminate`, `nvim-ts-autotag`, and `nvim-ts-autotag`.
I would **NOT** recommend enabling this extra for now.
## 10.x
- added new extra for [mini.diff](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md)

View File

@ -139,6 +139,7 @@ map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })
-- highlights under cursor
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
map("n", "<leader>uI", "<cmd>InspectTree<cr>", { desc = "Inspect Tree" })
-- LazyVim Changelog
map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim Changelog" })

View File

@ -10,6 +10,9 @@ function M.check()
if vim.fn.has("nvim-0.9.0") == 1 then
ok("Using Neovim >= 0.9.0")
if vim.fn.has("nvim-0.10.0") == 0 then
warn("Use Neovim >= 0.10.0 for the best experience")
end
else
error("Neovim >= 0.9.0 is required")
end

View File

@ -96,50 +96,65 @@ return {
},
-- 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,
},
{
vim.snippet
and {
"nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
{ "rafamadriz/friendly-snippets" },
{ "garymjr/nvim-snippets", opts = { friendly_snippets = true } },
},
opts = function(_, opts)
opts.snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
vim.snippet.expand(args.body)
end,
}
table.insert(opts.sources, { name = "luasnip" })
table.insert(opts.sources, { name = "snippets" })
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" } },
},
},
keys = {
{
"<Tab>",
function()
if vim.snippet.active({ direction = 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.active({ direction = -1 }) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
return
end
return "<S-Tab>"
end,
expr = true,
silent = true,
mode = { "i", "s" },
},
},
}
or { import = "lazyvim.plugins.extras.coding.luasnip", enabled = vim.fn.has("nvim-0.10") == 0 },
-- auto pairs
{
@ -166,43 +181,6 @@ return {
},
},
-- Fast and feature-rich surround actions. For text that includes
-- surrounding characters like brackets or quotes, this allows you
-- to select the text inside, change or modify the surrounding characters,
-- and more.
{
"echasnovski/mini.surround",
keys = function(_, keys)
-- Populate the keys based on the user's options
local plugin = require("lazy.core.config").spec.plugins["mini.surround"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
local mappings = {
{ opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } },
{ opts.mappings.delete, desc = "Delete Surrounding" },
{ opts.mappings.find, desc = "Find Right Surrounding" },
{ opts.mappings.find_left, desc = "Find Left Surrounding" },
{ opts.mappings.highlight, desc = "Highlight Surrounding" },
{ opts.mappings.replace, desc = "Replace Surrounding" },
{ opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
}
mappings = vim.tbl_filter(function(m)
return m[1] and #m[1] > 0
end, mappings)
return vim.list_extend(mappings, keys)
end,
opts = {
mappings = {
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
replace = "gsr", -- Replace surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
},
},
-- comments
{
"JoosepAlviste/nvim-ts-context-commentstring",
@ -212,110 +190,22 @@ return {
},
},
{
"echasnovski/mini.comment",
event = "VeryLazy",
opts = {
options = {
custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
end,
},
},
},
-- Better text-objects
{
"echasnovski/mini.ai",
-- keys = {
-- { "a", mode = { "x", "o" } },
-- { "i", mode = { "x", "o" } },
-- },
event = "VeryLazy",
opts = function()
local ai = require("mini.ai")
return {
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
}, {}),
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
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,
config = function(_, opts)
require("mini.ai").setup(opts)
-- register all text objects with which-key
LazyVim.on_load("which-key.nvim", function()
---@type table<string, string|table>
local i = {
[" "] = "Whitespace",
['"'] = 'Balanced "',
["'"] = "Balanced '",
["`"] = "Balanced `",
["("] = "Balanced (",
[")"] = "Balanced ) including white-space",
[">"] = "Balanced > including white-space",
["<lt>"] = "Balanced <",
["]"] = "Balanced ] including white-space",
["["] = "Balanced [",
["}"] = "Balanced } including white-space",
["{"] = "Balanced {",
["?"] = "User Prompt",
_ = "Underscore",
a = "Argument",
b = "Balanced ), ], }",
c = "Class",
d = "Digit(s)",
e = "Word in CamelCase & snake_case",
f = "Function",
g = "Entire file",
o = "Block, conditional, loop",
q = "Quote `, \", '",
t = "Tag",
u = "Use/call function & method",
U = "Use/call without dot in name",
}
local a = vim.deepcopy(i)
for k, v in pairs(a) do
a[k] = v:gsub(" including.*", "")
end
local ic = vim.deepcopy(i)
local ac = vim.deepcopy(a)
for key, name in pairs({ n = "Next", l = "Last" }) do
i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic)
a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac)
end
require("which-key").register({
mode = { "o", "x" },
i = i,
a = a,
})
end)
import = "lazyvim.plugins.extras.coding.mini-comment",
enabled = function()
if vim.fn.has("nvim-0.10") == 1 then
-- Majestically override the native `get_commentstring` function.
vim.schedule(function()
LazyVim.inject.set_upvalue(
LazyVim.inject.get_upvalue(require("vim._comment").textobject, "get_comment_parts"),
"get_commentstring",
function()
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
end
)
end)
else
return true
end
end,
},
}

View File

@ -452,7 +452,6 @@ return {
-- buffer remove
{
"echasnovski/mini.bufremove",
keys = {
{
"<leader>bd",

View File

@ -0,0 +1,44 @@
return {
"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" } },
},
}

View File

@ -0,0 +1,95 @@
-- Better text-objects
return {
"echasnovski/mini.ai",
-- keys = {
-- { "a", mode = { "x", "o" } },
-- { "i", mode = { "x", "o" } },
-- },
event = "VeryLazy",
opts = function()
local ai = require("mini.ai")
return {
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
}, {}),
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
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,
config = function(_, opts)
require("mini.ai").setup(opts)
-- register all text objects with which-key
LazyVim.on_load("which-key.nvim", function()
---@type table<string, string|table>
local i = {
[" "] = "Whitespace",
['"'] = 'Balanced "',
["'"] = "Balanced '",
["`"] = "Balanced `",
["("] = "Balanced (",
[")"] = "Balanced ) including white-space",
[">"] = "Balanced > including white-space",
["<lt>"] = "Balanced <",
["]"] = "Balanced ] including white-space",
["["] = "Balanced [",
["}"] = "Balanced } including white-space",
["{"] = "Balanced {",
["?"] = "User Prompt",
_ = "Underscore",
a = "Argument",
b = "Balanced ), ], }",
c = "Class",
d = "Digit(s)",
e = "Word in CamelCase & snake_case",
f = "Function",
g = "Entire file",
o = "Block, conditional, loop",
q = "Quote `, \", '",
t = "Tag",
u = "Use/call function & method",
U = "Use/call without dot in name",
}
local a = vim.deepcopy(i)
for k, v in pairs(a) do
a[k] = v:gsub(" including.*", "")
end
local ic = vim.deepcopy(i)
local ac = vim.deepcopy(a)
for key, name in pairs({ n = "Next", l = "Last" }) do
i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic)
a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac)
end
require("which-key").register({
mode = { "o", "x" },
i = i,
a = a,
})
end)
end,
}

View File

@ -0,0 +1,13 @@
return {
{
"echasnovski/mini.comment",
event = "VeryLazy",
opts = {
options = {
custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
end,
},
},
},
}

View File

@ -0,0 +1,36 @@
-- Fast and feature-rich surround actions. For text that includes
-- surrounding characters like brackets or quotes, this allows you
-- to select the text inside, change or modify the surrounding characters,
-- and more.
return {
"echasnovski/mini.surround",
keys = function(_, keys)
-- Populate the keys based on the user's options
local plugin = require("lazy.core.config").spec.plugins["mini.surround"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
local mappings = {
{ opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } },
{ opts.mappings.delete, desc = "Delete Surrounding" },
{ opts.mappings.find, desc = "Find Right Surrounding" },
{ opts.mappings.find_left, desc = "Find Left Surrounding" },
{ opts.mappings.highlight, desc = "Highlight Surrounding" },
{ opts.mappings.replace, desc = "Replace Surrounding" },
{ opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
}
mappings = vim.tbl_filter(function(m)
return m[1] and #m[1] > 0
end, mappings)
return vim.list_extend(mappings, keys)
end,
opts = {
mappings = {
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
replace = "gsr", -- Replace surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
},
}

View File

@ -1,69 +0,0 @@
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",
dependencies = {
{ "rafamadriz/friendly-snippets" },
{ "garymjr/nvim-snippets", opts = { friendly_snippets = true } },
},
opts = function(_, opts)
opts.snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
}
table.insert(opts.sources, { name = "snippets" })
end,
keys = {
{
"<Tab>",
function()
if vim.snippet.active({ direction = 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.active({ direction = -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

@ -38,6 +38,7 @@ return {
-- rename surround mappings from gs to gz to prevent conflict with leap
{
"echasnovski/mini.surround",
optional = true,
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes

View File

@ -0,0 +1,42 @@
return {
-- Active indent guide and indent text objects. When you're browsing
-- code, this highlights the current level of indentation, and animates
-- the highlighting.
{
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = "LazyFile",
opts = {
-- symbol = "▏",
symbol = "",
options = { try_as_border = true },
},
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end,
},
{
"lukas-reineke/indent-blankline.nvim",
event = "LazyFile",
opts = {
scope = { enabled = false },
},
},
}

View File

@ -0,0 +1,21 @@
-- Show context of the current function
return {
"nvim-treesitter/nvim-treesitter-context",
event = "LazyFile",
opts = { mode = "cursor", max_lines = 3 },
keys = {
{
"<leader>ut",
function()
local tsc = require("treesitter-context")
tsc.toggle()
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
else
LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
end
end,
desc = "Toggle Treesitter Context",
},
},
}

View File

@ -0,0 +1,102 @@
-- backwards compatibility with the old treesitter config for adding custom parsers
local function patch()
local parsers = require("nvim-treesitter.parsers")
parsers.get_parser_configs = setmetatable({}, {
__call = function()
return parsers
end,
})
end
if vim.fn.executable("tree-sitter") == 0 then
LazyVim.error("**treesitter-rewrite** requires the `tree-sitter` executable to be installed")
return {}
end
if vim.fn.has("nvim-0.10") == 0 then
LazyVim.error("**treesitter-rewrite** requires Neovim >= 0.10")
return {}
end
return {
{
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
branch = "main",
build = ":TSUpdate",
lazy = false,
cmd = {},
opts = function()
patch()
return {
highlight = { enable = true },
indent = { enable = true },
ensure_install = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
}
end,
init = function() end,
---@param opts TSConfig
config = function(_, opts)
---@return string[]
local function norm(ensure)
return ensure == nil and {} or type(ensure) == "string" and { ensure } or ensure
end
-- ensure_installed is deprecated, but still supported
opts.ensure_install = LazyVim.dedup(vim.list_extend(norm(opts.ensure_install), norm(opts.ensure_installed)))
require("nvim-treesitter").setup(opts)
patch()
-- backwards compatibility with the old treesitter config for indent
if vim.tbl_get(opts, "indent", "enable") then
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
-- backwards compatibility with the old treesitter config for highlight
if vim.tbl_get(opts, "highlight", "enable") then
vim.api.nvim_create_autocmd("FileType", {
callback = function()
pcall(vim.treesitter.start)
end,
})
end
end,
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
enabled = false,
},
{
"windwp/nvim-ts-autotag",
enabled = false,
},
{
"RRethy/vim-illuminate",
enabled = false,
},
}

View File

@ -0,0 +1,8 @@
-- measure startuptime
return {
"dstein64/vim-startuptime",
cmd = "StartupTime",
config = function()
vim.g.startuptime_tries = 10
end,
}

View File

@ -38,7 +38,7 @@ return {
-- Be aware that you also will need to properly configure your LSP server to
-- provide the inlay hints.
inlay_hints = {
enabled = false,
enabled = true,
},
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
@ -140,27 +140,29 @@ return {
end
end
-- inlay hints
if opts.inlay_hints.enabled then
LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/inlayHint") then
LazyVim.toggle.inlay_hints(buffer, true)
end
end)
end
if vim.fn.has("nvim-0.10") == 1 then
-- inlay hints
if opts.inlay_hints.enabled then
LazyVim.lsp.on_attach(function(client, buffer)
if client.supports_method("textDocument/inlayHint") then
LazyVim.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)
-- 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
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then

View File

@ -118,29 +118,6 @@ return {
end,
},
-- Show context of the current function
{
"nvim-treesitter/nvim-treesitter-context",
event = "LazyFile",
enabled = true,
opts = { mode = "cursor", max_lines = 3 },
keys = {
{
"<leader>ut",
function()
local tsc = require("treesitter-context")
tsc.toggle()
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
else
LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
end
end,
desc = "Toggle Treesitter Context",
},
},
},
-- Automatically add closing tags for HTML and JSX
{
"windwp/nvim-ts-autotag",

View File

@ -219,7 +219,7 @@ return {
char = "",
tab_char = "",
},
scope = { enabled = false },
scope = { show_start = false, show_end = false },
exclude = {
filetypes = {
"help",
@ -239,40 +239,6 @@ return {
main = "ibl",
},
-- Active indent guide and indent text objects. When you're browsing
-- code, this highlights the current level of indentation, and animates
-- the highlighting.
{
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = "LazyFile",
opts = {
-- symbol = "▏",
symbol = "",
options = { try_as_border = true },
},
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end,
},
-- Displays a popup with possible key bindings of the command you started typing
{
"folke/which-key.nvim",

View File

@ -1,14 +1,5 @@
return {
-- measure startuptime
{
"dstein64/vim-startuptime",
cmd = "StartupTime",
config = function()
vim.g.startuptime_tries = 10
end,
},
-- Session management. This saves your session in the background,
-- keeping track of open buffers, window arrangement, and more.
-- You can restore sessions when returning through the dashboard.

View File

@ -170,4 +170,19 @@ function M.safe_keymap_set(mode, lhs, rhs, opts)
end
end
---@generic T
---@param list T[]
---@return T[]
function M.dedup(list)
local ret = {}
local seen = {}
for _, v in ipairs(list) do
if not seen[v] then
table.insert(ret, v)
seen[v] = true
end
end
return ret
end
return M

View File

@ -31,4 +31,20 @@ function M.get_upvalue(func, name)
end
end
function M.set_upvalue(func, name, value)
local i = 1
while true do
local n = debug.getupvalue(func, i)
if not n then
break
end
if n == name then
debug.setupvalue(func, i, value)
return
end
i = i + 1
end
LazyVim.error("upvalue not found: " .. name)
end
return M

View File

@ -10,6 +10,7 @@ M.deprecated_extras = {
["lazyvim.plugins.extras.formatting.conform"] = "`conform.nvim` is now the default **LazyVim** formatter.",
["lazyvim.plugins.extras.linting.nvim-lint"] = "`nvim-lint` is now the default **LazyVim** linter.",
["lazyvim.plugins.extras.ui.dashboard"] = "`dashboard.nvim` is now the default **LazyVim** starter.",
["lazyvim.plugins.extras.coding.native_snippets"] = "Native snippets are now the default for **Neovim >= 0.10**",
}
M.deprecated_modules = {
@ -91,7 +92,7 @@ function M.fix_imports()
Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec)
local dep = M.deprecated_extras[spec and spec.import]
if dep then
dep = dep .. "\n" .. "Please remove the extra to hide this warning."
dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning."
LazyVim.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 })
return false
end