Nice folding toggling

This commit is contained in:
Pavel Korytov 2020-02-08 15:19:10 +03:00
parent bf887b0b4d
commit 6f181eb0e4

View file

@ -132,6 +132,7 @@ set cursorline
set mouse=a
set splitbelow
set splitright
set inccommand=split
set relativenumber
@ -215,7 +216,7 @@ nnoremap <Leader>ar :ALEFindReferences<CR>
nnoremap <Leader>ah :ALEHover<CR>
nnoremap <Leader>ac :ALERename<CR>
"EasyAlign
" EasyAlign
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
@ -644,6 +645,30 @@ nnoremap gd<Right> :call GitMergeGetRight()<CR>
" }}}
" {{{ Folding
function! SetFoldLevel() range
execute ":set foldlevel=" . v:count
echo("set foldlevel=" . v:count)
endfunction
function! OnSpace()
if foldlevel('.')
if foldclosed('.') != -1
return 'zO'
else
return 'za'
endif
else
return "\<Space>"
endif
endfunction
nnoremap <Leader>ff :call SetFoldLevel()<CR>
nnoremap <silent> <Space> @=(OnSpace())<CR>
" }}}
" Put current time
command! Timestamp :put =strftime('%d-%m-%y %H:%M:%S')
" }}}