Skip to content

Instantly share code, notes, and snippets.

@vim-voom
vim-voom / foldexpr_with_counters.vim
Created December 27, 2012 17:23
Vim folding expression with counters
" vim: fdc=5
" http://groups.google.com/group/vim_use/browse_thread/thread/fedd5c8e45162d3f
" THE GOAL: Write Vim folding expression that
" - starts fold on lines matching 'start'
" - ends fold on lines matching 'stop'
" - DOES NOT USE "a", "s", "="
" (this should be same as :set fdm=marker fmr=start,stop)
" stop
@vim-voom
vim-voom / markdown.vim
Created June 20, 2011 02:23
Markdown folding for Vim
" folding for Markdown headers, both styles (atx- and setext-)
" http://daringfireball.net/projects/markdown/syntax#header
"
" this code can be placed in file
" $HOME/.vim/after/ftplugin/markdown.vim
" In Markdown, setext-style overrides atx-style, so we first check for an
" underline. Empty lines should be ignored when underlined.
func! Foldexpr_markdown(lnum)
let l1 = getline(a:lnum)