Skip to content

Commit c942d50

Browse files
chore(build): auto-generate docs
1 parent 2759341 commit c942d50

3 files changed

Lines changed: 32 additions & 22 deletions

File tree

docs/configuration/general.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,15 @@ opt.fillchars = {
120120
diff = "",
121121
eob = " ",
122122
}
123-
opt.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()" -- treesitter folds
124123
opt.foldlevel = 99
125-
opt.foldmethod = "expr"
124+
opt.foldmethod = "indent"
126125
opt.foldtext = ""
127126
opt.formatexpr = "v:lua.LazyVim.format.formatexpr()"
128127
opt.formatoptions = "jcroqlnt" -- tcqj
129128
opt.grepformat = "%f:%l:%c:%m"
130129
opt.grepprg = "rg --vimgrep"
131130
opt.ignorecase = true -- Ignore case
132131
opt.inccommand = "nosplit" -- preview incremental substitute
133-
opt.indentexpr = "v:lua.LazyVim.treesitter.indentexpr()" -- treesitter indents
134132
opt.jumpoptions = "view"
135133
opt.laststatus = 3 -- global statusline
136134
opt.linebreak = true -- Wrap lines at convenient points
@@ -156,7 +154,7 @@ opt.spelllang = { "en" }
156154
opt.splitbelow = true -- Put new windows below current
157155
opt.splitkeep = "screen"
158156
opt.splitright = true -- Put new windows right of current
159-
opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]]
157+
opt.statuscolumn = [[%!v:lua.LazyVim.statuscolumn()]]
160158
opt.tabstop = 2 -- Number of spaces tabs count for
161159
opt.termguicolors = true -- True color support
162160
opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key

docs/plugins/lsp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ end
303303
LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer)
304304
local win = vim.api.nvim_get_current_win()
305305
vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
306+
vim.wo[win][0].foldmethod = "expr"
306307
end)
307308
end
308309

docs/plugins/treesitter.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import TabItem from '@theme/TabItem';
1919
```lua
2020
opts = {
2121
-- LazyVim config for treesitter
22+
indent = { enable = true },
23+
highlight = { enable = true },
24+
folds = { enable = true },
2225
ensure_installed = {
2326
"bash",
2427
"c",
@@ -64,7 +67,9 @@ opts = {
6467
LazyVim.error("Please restart Neovim and run `:TSUpdate` to use the `nvim-treesitter` **main** branch.")
6568
return
6669
end
67-
TS.update(nil, { summary = true })
70+
LazyVim.treesitter.ensure_treesitter_cli(function()
71+
TS.update(nil, { summary = true })
72+
end)
6873
end,
6974
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
7075
event = { "LazyFile", "VeryLazy" },
@@ -73,6 +78,9 @@ opts = {
7378
---@class lazyvim.TSConfig: TSConfig
7479
opts = {
7580
-- LazyVim config for treesitter
81+
indent = { enable = true },
82+
highlight = { enable = true },
83+
folds = { enable = true },
7684
ensure_installed = {
7785
"bash",
7886
"c",
@@ -107,44 +115,47 @@ opts = {
107115
-- some quick sanity checks
108116
if not TS.get_installed then
109117
return LazyVim.error("Please use `:Lazy` and update `nvim-treesitter`")
110-
elseif vim.fn.executable("tree-sitter") == 0 then
111-
return LazyVim.error({
112-
"**treesitter-main** requires the `tree-sitter` CLI executable to be installed.",
113-
"Run `:checkhealth nvim-treesitter` for more information.",
114-
})
115118
elseif type(opts.ensure_installed) ~= "table" then
116119
return LazyVim.error("`nvim-treesitter` opts.ensure_installed must be a table")
117120
end
118121

119122
-- setup treesitter
120123
TS.setup(opts)
121-
122124
LazyVim.treesitter.get_installed(true) -- initialize the installed langs
123125

124126
-- install missing parsers
125127
local install = vim.tbl_filter(function(lang)
126128
return not LazyVim.treesitter.have(lang)
127129
end, opts.ensure_installed or {})
128130
if #install > 0 then
129-
TS.install(install, { summary = true }):await(function()
130-
LazyVim.treesitter.get_installed(true) -- refresh the installed langs
131+
LazyVim.treesitter.ensure_treesitter_cli(function()
132+
TS.install(install, { summary = true }):await(function()
133+
LazyVim.treesitter.get_installed(true) -- refresh the installed langs
134+
end)
131135
end)
132136
end
133137

134-
-- treesitter highlighting
135138
vim.api.nvim_create_autocmd("FileType", {
136139
group = vim.api.nvim_create_augroup("lazyvim_treesitter", { clear = true }),
137140
callback = function(ev)
138-
if LazyVim.treesitter.have(ev.match) then
141+
if not LazyVim.treesitter.have(ev.match) then
142+
return
143+
end
144+
145+
-- highlighting
146+
if vim.tbl_get(opts, "highlight", "enable") ~= false then
139147
pcall(vim.treesitter.start)
148+
end
140149

141-
-- check if ftplugins changed foldexpr/indentexpr
142-
for _, option in ipairs({ "foldexpr", "indentexpr" }) do
143-
local expr = "v:lua.LazyVim.treesitter." .. option .. "()"
144-
if vim.opt_global[option]:get() == expr then
145-
vim.opt_local[option] = expr
146-
end
147-
end
150+
-- indents
151+
if vim.tbl_get(opts, "indent", "enable") ~= false then
152+
vim.bo[ev.buf].indentexpr = "v:lua.LazyVim.treesitter.indentexpr()"
153+
end
154+
155+
-- folds
156+
if vim.tbl_get(opts, "folds", "enable") ~= false then
157+
vim.wo.foldmethod = "expr"
158+
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()"
148159
end
149160
end,
150161
})

0 commit comments

Comments
 (0)