by phaedrix · 13y ago · 0 comments
" space toggles the fold state under the cursor.
nnoremap <silent><space> :exe 'normal! za'.(foldlevel('.')?'':'l')<cr>
" <leader>space expands with zO
map <leader><space> zO nnoremap <Space> za
vnoremap <Space> za
also, for folding in general I'd recommend using set foldmethod=marker
which has the benefit of making folds more 'transparent' in your code, and also persistent across vim sessions