""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Config {{{ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let s:config = vue#GetConfig('config', {}) let s:enable_foldexpr = s:config.foldexpr "}}} if !s:enable_foldexpr | finish | endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Settings {{{ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if line('$') < 1000 setlocal foldmethod=expr endif setlocal foldexpr=GetVueFold(v:lnum) "}}} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Variables {{{ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let s:empty_line = '\v^\s*$' let s:vue_tag_start = '\v^\s*\<\w+' let s:vue_tag_end = '\v^\s*\<\/\w+' "}}} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Functions {{{ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " see :h fold-expr " value meaning " 0 the line is not in a fold " 1, 2, .. the line is in a fold with this level " -1 the fold level is undefined, use the fold level of a " line before or after this line, whichever is the " lowest. " "=" use fold level from the previous line " "a1", "a2", .. add one, two, .. to the fold level of the previous " line, use the result for the current line " "s1", "s2", .. subtract one, two, .. from the fold level of the " ">1", ">2", .. a fold with this level starts at this line " "<1", "<2", .. a fold with this level ends at this line function! GetVueFold(lnum) let this_line = getline(a:lnum) let next_line = getline(a:lnum + 1) if a:lnum > 1 let prev_line = getline(a:lnum - 1) endif " Handle empty lines if this_line =~ s:empty_line return -1 endif " Handle start/end tags if this_line =~ s:vue_tag_start return '>1' endif if this_line =~ s:vue_tag_end " If return '<1', fold will get incorrect with prev line return 1 endif " Fold by indent if a:lnum > 1 let prev_indent = s:IndentLevel(a:lnum - 1) else let prev_indent = 0 endif let this_indent = s:IndentLevel(a:lnum) let next_indent = s:IndentLevel(s:NextNonBlankLine(a:lnum)) " Handle