vim-indent-folding

indentation based folding for vim
git clone https://git.ce9e.org/vim-indent-folding.git

commit
3fa3eabab044dd27ca73916e6cd5c11fdf9ccb60
parent
c6fedf54831c29c40130ff82f68cfc5f4cda6ce0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-08-24 18:09
perf: only use fold expr when actually interacting with fold

inspired by https://github.com/Konfekt/FastFold

Diffstat

M plugin/folding.vim 6 +++++-

1 files changed, 5 insertions, 1 deletions


diff --git a/plugin/folding.vim b/plugin/folding.vim

@@ -1,4 +1,8 @@
    1     1 set foldlevel=99
    2    -1 set foldmethod=expr
   -1     2 set foldmethod=manual
    3     3 set foldexpr=folding#IndentFold(v:lnum)
    4     4 set foldtext=folding#IndentFoldText()
   -1     5 
   -1     6 for cmd in ['zo', 'zO', 'zc', 'zC', 'za', 'zA', 'zm', 'zM', 'zr', 'zR']
   -1     7 	exe 'nnoremap <silent> '.cmd.' :setlocal foldmethod=expr<CR>'.cmd.':setlocal foldmethod=manual<CR>'
   -1     8 endfor