~kota/wiki-ft.vim

045622f1b39a1cf882de64e790f20ad657350ae4 — Karl Yngve Lervåg 8 months ago 9e6c6ef
perf: improve WikiFoldLevel
1 files changed, 3 insertions(+), 5 deletions(-)

M ftplugin/wiki.vim
M ftplugin/wiki.vim => ftplugin/wiki.vim +3 -5
@@ 45,13 45,11 @@ call wiki#init#apply_mappings_from_dict(s:mappings, '<buffer>')
function! WikiFoldLevel(lnum) abort " {{{1
  let l:line = getline(a:lnum)

  if wiki#u#is_code(a:lnum)
    return l:line =~# '^\s*```'
          \ ? (wiki#u#is_code(a:lnum+1) ? 'a1' : 's1')
          \ : '='
  if l:line =~# '^\s*```'
    return wiki#u#is_code(a:lnum+1) ? 'a1' : 's1'
  endif

  if l:line =~# g:wiki#rx#header
  if l:line =~# g:wiki#rx#header && !wiki#u#is_code(a:lnum)
    return '>' . len(matchstr(l:line, '#*'))
  endif