mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Merge branch 'main' into dev
This commit is contained in:
commit
7845ed672a
3 changed files with 24 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
*LazyVim.txt* For Neovim Last change: 2025 October 09
|
||||
*LazyVim.txt* For Neovim Last change: 2025 October 10
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ return {
|
|||
-- require("sidekick.cli").select({ filter = { installed = true } })
|
||||
desc = "Select CLI",
|
||||
},
|
||||
{
|
||||
"<leader>ad",
|
||||
function() require("sidekick.cli").close() end,
|
||||
desc = "Detach a CLI Session",
|
||||
},
|
||||
{
|
||||
"<leader>at",
|
||||
function() require("sidekick.cli").send({ msg = "{this}" }) end,
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@ return {
|
|||
event = { "LazyFile", "VeryLazy" },
|
||||
cmd = { "TSUpdate", "TSInstall", "TSLog", "TSUninstall" },
|
||||
opts_extend = { "ensure_installed" },
|
||||
---@alias lazyvim.TSFeat { enable?: boolean, disable?: string[] }
|
||||
---@class lazyvim.TSConfig: TSConfig
|
||||
opts = {
|
||||
-- LazyVim config for treesitter
|
||||
indent = { enable = true },
|
||||
highlight = { enable = true },
|
||||
folds = { enable = true },
|
||||
indent = { enable = true }, ---@type lazyvim.TSFeat
|
||||
highlight = { enable = true }, ---@type lazyvim.TSFeat
|
||||
folds = { enable = true }, ---@type lazyvim.TSFeat
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
|
|
@ -99,22 +100,32 @@ return {
|
|||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = vim.api.nvim_create_augroup("lazyvim_treesitter", { clear = true }),
|
||||
callback = function(ev)
|
||||
if not LazyVim.treesitter.have(ev.match) then
|
||||
local ft, lang = ev.match, vim.treesitter.language.get_lang(ev.match)
|
||||
if not LazyVim.treesitter.have(ft) then
|
||||
return
|
||||
end
|
||||
|
||||
---@param feat string
|
||||
---@param query string
|
||||
local function enabled(feat, query)
|
||||
local f = opts[feat] or {} ---@type lazyvim.TSFeat
|
||||
return f.enable ~= false
|
||||
and not (type(f.disable) == "table" and vim.tbl_contains(f.disable, lang))
|
||||
and LazyVim.treesitter.have(ft, query)
|
||||
end
|
||||
|
||||
-- highlighting
|
||||
if vim.tbl_get(opts, "highlight", "enable") ~= false then
|
||||
if enabled("highlight", "highlights") then
|
||||
pcall(vim.treesitter.start)
|
||||
end
|
||||
|
||||
-- indents
|
||||
if vim.tbl_get(opts, "indent", "enable") ~= false and LazyVim.treesitter.have(ev.match, "indents") then
|
||||
if enabled("indent", "indents") then
|
||||
LazyVim.set_default("indentexpr", "v:lua.LazyVim.treesitter.indentexpr()")
|
||||
end
|
||||
|
||||
-- folds
|
||||
if vim.tbl_get(opts, "folds", "enable") ~= false and LazyVim.treesitter.have(ev.match, "folds") then
|
||||
if enabled("folds", "folds") then
|
||||
if LazyVim.set_default("foldmethod", "expr") then
|
||||
LazyVim.set_default("foldexpr", "v:lua.LazyVim.treesitter.foldexpr()")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue