diff options
author | Urbain Vaes <urbain@vaes.uk> | 2014-10-09 14:14:48 +0100 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2014-10-09 14:14:48 +0100 |
commit | 54be9a471091bdc8e7770d85623895c83e3f3153 (patch) | |
tree | 539410b6883d0f777f3b32ec6fbc33245fec68e0 /.vim/after/ftplugin/vim |
Initial commit
Diffstat (limited to '.vim/after/ftplugin/vim')
-rw-r--r-- | .vim/after/ftplugin/vim/folding.vim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/.vim/after/ftplugin/vim/folding.vim b/.vim/after/ftplugin/vim/folding.vim new file mode 100644 index 0000000..773b38e --- /dev/null +++ b/.vim/after/ftplugin/vim/folding.vim @@ -0,0 +1,25 @@ +function! VimFolds() + let thisline = getline(v:lnum) + if match(thisline,'^"" ') >= 0 + return ">1" + elseif match(thisline,'^" ') >=0 + return ">1" + else + return "=" + endif +endfunction + +function! VimFoldText() + let startline = getline(v:foldstart) + if match(startline,'^"" ') >= 0 + let title = substitute(startline,'^"" \(.*\)$','\1',"") + return '# ' . title + elseif match(startline,'^" ') >=0 + let title = substitute(startline,'^" \(.*\)$','\1',"") + return ' ## ' .title + endif +endfunction + +setlocal foldmethod=expr +setlocal foldexpr=VimFolds() +setlocal foldtext=VimFoldText() |