diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-12 23:09:50 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-12 23:09:50 +0200 |
commit | 1105b3fee91ebaacb34720e96fd7fef7ba4864cc (patch) | |
tree | 6d8b703b2a46b926171fd2dca2cc336d066f0bee /.config/nvim/lua | |
parent | 090b79751d765fc20790094d09344629e3b3eae8 (diff) |
nvim: Enable tree-sitter code folding
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/mango/set.lua | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/.config/nvim/lua/mango/set.lua b/.config/nvim/lua/mango/set.lua index 0ef61ff..d082916 100644 --- a/.config/nvim/lua/mango/set.lua +++ b/.config/nvim/lua/mango/set.lua @@ -2,6 +2,8 @@ local lib = require('mango.lib') local api = vim.api local opt = vim.opt +local augroup = api.nvim_create_augroup('Mango', { clear = true }) + opt.nu = true opt.relativenumber = true @@ -34,13 +36,17 @@ opt.splitright = true opt.splitbelow = true -- Disable auto commenting -local group = api.nvim_create_augroup('Mango', { clear = true }) -api.nvim_create_autocmd( - 'BufEnter', - { - callback = function() - opt.formatoptions:remove({'c', 'r', 'o'}) - end, - group = group, - } -) +api.nvim_create_autocmd('BufEnter', { + callback = function() + opt.formatoptions:remove({'c', 'r', 'o'}) + end, + group = augroup, +}) + +opt.foldmethod = 'expr' +opt.foldexpr = 'nvim_treesitter#foldexpr()' + +api.nvim_create_autocmd('BufWinEnter', { + command = 'normal zR', + group = augroup, +}) |