From 2c4617f462bed6f349c37f83f8f209e7d2487ffd Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Wed, 20 Apr 2022 22:18:18 +0200 Subject: [PATCH] treesitter folding with space x :) --- lua/my_options.lua | 5 +++++ lua/setup/my_command_center.lua | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lua/my_options.lua b/lua/my_options.lua index 023307f..ac41fda 100644 --- a/lua/my_options.lua +++ b/lua/my_options.lua @@ -48,3 +48,8 @@ opt.smartindent= true -- disable nvim intro opt.shortmess:append('sI') + +-- Treesitter based folding +opt.foldlevel = 20 +opt.foldmethod = 'expr' +opt.foldexpr = 'nvim_treesitter#foldexpr()' diff --git a/lua/setup/my_command_center.lua b/lua/setup/my_command_center.lua index d0dff1c..84abf32 100644 --- a/lua/setup/my_command_center.lua +++ b/lua/setup/my_command_center.lua @@ -167,4 +167,11 @@ command_center.add({ { 'n', 'a', silent_noremap }, }, }, + { + description = 'Toggle fold', + cmd = 'za', + keybindings = { + { 'n', 'x', silent_noremap }, + }, + }, })