" fold text between context and specify function! ShowRSpecContext() let spec_idx = search('specify\s\+".\+"', 'Wbn', '^') let ctx_idx = search('context\s\+".\+"', 'Wbn', '^') if spec_idx && ctx_idx exec (ctx_idx+1).','.(spec_idx-1).'fold' endif endfunction " fold text between all contexts and specify lines function! ShowRSpecAnnotation() call cursor('$', 0) try foldo! catch endtry let cur_line = line('$') while cur_line > 0 let prev_spec = search('\(context\|specify\)\s\+".\+"', 'Wb', '^') if ! prev_spec break endif exec (prev_spec).','.cur_line.'fold' let cur_line=prev_spec-1 endwhile endfunction command! Sx :call ShowRSpecContext() command! Sa :call ShowRSpecAnnotation()
You need to create an account or log in to post comments to this site.