Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let g:fold_levels = {}
- function! JFolds(lnum)
- let line = getline(a:lnum)
- let next_line = getline(a:lnum + 1)
- let g:fold_levels.line = line
- let g:fold_levels.next = next_line
- if line =~ '^\s\+\%(describe\|it\)'
- let lead = matchstr(line, '^\s\+')
- let g:fold_levels.lead = len(lead)
- let g:fold_levels[lead] = lead
- echom '1:a1 ' . string(g:fold_levels)
- return 'a1'
- elseif line =~ '^\s\+});.*'
- let lead = matchstr(line, '^\s\+\ze\});')
- let g:fold_levels.lead = len(lead)
- if has_key(g:fold_levels, lead)
- call remove(g:fold_levels, lead)
- echom '2:s1 ' . string(g:fold_levels)
- return 's1'
- endif
- echom '3: = ' . string(g:fold_levels)
- return '='
- else
- echom '4: = ' . string(g:fold_levels)
- return '='
- endif
- endfunction
- set fdm=expr
- set fde=JFolds(v:lnum)
- set debug=msg
Advertisement
Add Comment
Please, Sign In to add comment