config: use nvim-treesitter for folding

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-14 16:09:11 +03:00
parent 2a44c3e661
commit ecd8cd11ed
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -17,7 +17,6 @@ vim.opt.encoding = "utf-8"
vim.opt.termguicolors = true vim.opt.termguicolors = true
-- Other options -- Other options
vim.cmd("syntax on")
vim.opt.backspace = { "indent", "eol", "start" } vim.opt.backspace = { "indent", "eol", "start" }
vim.opt.laststatus = 2 vim.opt.laststatus = 2
vim.opt.showmode = false vim.opt.showmode = false
@ -88,6 +87,10 @@ vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99 vim.opt.foldlevelstart = 99
vim.opt.foldminlines = 3 vim.opt.foldminlines = 3
vim.opt.foldnestmax = 5 vim.opt.foldnestmax = 5
vim.opt.foldmethod = "expr"
vim.cmd([[
set foldexpr=nvim_treesitter#foldexpr()
]])
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- --
@ -126,32 +129,6 @@ set_line_limiter(81, {
"*.css", "*.css",
}) })
-- Spell check for markdown files
local spell_check_augroup = vim.api.nvim_create_augroup("spell_check", {})
vim.api.nvim_create_autocmd(bufReadFile, {
pattern = { "*.md" },
group = spell_check_augroup,
callback = function()
vim.wo.spell = true
end,
})
-- Set up fold method for each lang
local folding_augroup = vim.api.nvim_create_augroup("folding", {})
vim.api.nvim_create_autocmd(bufReadFile, {
group = folding_augroup,
pattern = {
"*.js",
"*.jsx",
"*.ts",
"*.tsx",
},
callback = function()
vim.cmd("syntax on")
vim.wo.foldmethod = "syntax"
end,
})
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- --
-- Bindings -- Bindings