Last active
August 3, 2016 20:25
-
-
Save TableBookspro/eeb36e337b00ad414f4bc4b9fd8da008 to your computer and use it in GitHub Desktop.
markdown.vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! MarkdownFolds() | |
let thisline = getline(v:lnum) | |
let laterline = getline(v:lnum + 2) | |
if match(thisline, '^#') >= 0 | |
return ">1" | |
elseif match(laterline, '^#') >= 0 | |
return "<1" | |
else | |
return "=" | |
endif | |
endfunction | |
setlocal foldmethod=expr | |
setlocal foldexpr=MarkdownFolds() | |
function! MarkdownFoldText() | |
let foldsize = (v:foldend-v:foldstart) | |
return getline(v:foldstart).' ('.foldsize.' lines)' | |
endfunction | |
setlocal foldtext=MarkdownFoldText() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment