From 8f804c189ce45bff61f388d66ef5c3d4da03a9ce Mon Sep 17 00:00:00 2001 From: Jeremy Mack Date: Sat, 15 Dec 2012 10:57:28 -0500 Subject: [PATCH] Added option to disable folding Also updated the readme with information about the command. --- README.md | 10 ++++++++++ after/ftplugin/mkd.vim | 23 +++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a11299b..2d7e587 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,16 @@ To install without Pathogen, download the [tarball](https://github.com/plasticbo [Homepage](http://plasticboy.com/markdown-vim-mode/) +## Options + +**Disable Folding** + +Add the following line to your `.vimrc` to disable folding. + +```vim +let g:vim_markdown_folding_disabled=1 +``` + ## License The MIT License (MIT) diff --git a/after/ftplugin/mkd.vim b/after/ftplugin/mkd.vim index b0b0946..ed78895 100644 --- a/after/ftplugin/mkd.vim +++ b/after/ftplugin/mkd.vim @@ -35,14 +35,17 @@ func! Foldexpr_markdown(lnum) endif endfunc -setlocal foldexpr=Foldexpr_markdown(v:lnum) -setlocal foldmethod=expr -"---------- everything after this is optional ----------------------- -" change the following fold options to your liking -" see ':help fold-options' for more -setlocal foldenable -setlocal foldlevel=0 -setlocal foldcolumn=0 -set foldmethod=expr -set foldopen-=search +if !exists("g:vim_markdown_folding_disabled") + setlocal foldexpr=Foldexpr_markdown(v:lnum) + setlocal foldmethod=expr + + "---------- everything after this is optional ----------------------- + " change the following fold options to your liking + " see ':help fold-options' for more + setlocal foldenable + setlocal foldlevel=0 + setlocal foldcolumn=0 + set foldmethod=expr + set foldopen-=search +endif -- 2.39.2