.vimrc configuration
1 2 3 4 5 6 7 8 9 10 |
setlocal foldmethod=expr setlocal foldexpr=(getline(v:lnum)=~'^$')?-1:((indent(v:lnum)<indent(v:lnum+1))?('>'.indent(v:lnum+1)):indent(v:lnum)) set foldtext=getline(v:foldstart) set fillchars=fold:\ "(there's a space after that \) highlight Folded ctermfg=DarkGreen ctermbg=Black nnoremap <S-Left> zo inoremap <S-Left> <C-O>zo nnoremap <S-Right> zc inoremap <S-Right> <C-O>zc |
vi command mode
1 |
:set foldmethod=indent |
zR -> unfold all
zM -> fold all
za -> fold/unfold