parent
3ea223ac76
commit
d5e72e0ae7
@ -38,7 +38,6 @@ function! sy#fold#do() abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
tabedit %
|
|
||||||
let [s:context0, s:context1] = get(g:, 'signify_fold_context', [3, 8])
|
let [s:context0, s:context1] = get(g:, 'signify_fold_context', [3, 8])
|
||||||
let s:levels = s:get_levels(s:get_lines())
|
let s:levels = s:get_levels(s:get_lines())
|
||||||
|
|
||||||
@ -46,6 +45,13 @@ function! sy#fold#do() abort
|
|||||||
set foldtext=SignifyFoldText()
|
set foldtext=SignifyFoldText()
|
||||||
set foldmethod=expr
|
set foldmethod=expr
|
||||||
set foldlevel=0
|
set foldlevel=0
|
||||||
|
let g:signify_fold = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! sy#fold#disable() "abort
|
||||||
|
set foldmethod=manual
|
||||||
|
normal zE
|
||||||
|
let g:signify_fold = 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:get_lines {{{1
|
" Function: s:get_lines {{{1
|
||||||
@ -65,6 +71,19 @@ function! s:get_lines() abort
|
|||||||
return reverse(lines)
|
return reverse(lines)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Function: #fold_toggle {{{1
|
||||||
|
function! sy#fold#toggle() abort
|
||||||
|
if get(g:, 'signify_fold')
|
||||||
|
call sy#fold#disable()
|
||||||
|
else
|
||||||
|
call sy#fold#do()
|
||||||
|
endif
|
||||||
|
|
||||||
|
redraw!
|
||||||
|
call sy#start()
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
" Function: s:get_levels {{{1
|
" Function: s:get_levels {{{1
|
||||||
function! s:get_levels(lines) abort
|
function! s:get_levels(lines) abort
|
||||||
let levels = {}
|
let levels = {}
|
||||||
|
@ -45,6 +45,7 @@ command! -nargs=0 -bar SignifyFold call sy#fold#do()
|
|||||||
command! -nargs=0 -bar SignifyRefresh call sy#util#refresh_windows()
|
command! -nargs=0 -bar SignifyRefresh call sy#util#refresh_windows()
|
||||||
command! -nargs=0 -bar SignifyToggle call sy#toggle()
|
command! -nargs=0 -bar SignifyToggle call sy#toggle()
|
||||||
command! -nargs=0 -bar SignifyToggleHighlight call sy#highlight#line_toggle()
|
command! -nargs=0 -bar SignifyToggleHighlight call sy#highlight#line_toggle()
|
||||||
|
command! -nargs=0 -bar SignifyToggleFold call sy#fold#toggle()
|
||||||
|
|
||||||
" Init: mappings {{{1
|
" Init: mappings {{{1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user