diff options
author | Urbain Vaes <urbain@vaes.uk> | 2015-08-08 20:08:42 +0200 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2015-08-08 20:08:42 +0200 |
commit | 8df9472e0cdbab0d12211c2bc77918e8f515c409 (patch) | |
tree | f420b705adfec42bb33191c44c8fe252fca0f785 /.vim/after/ftplugin/vim/folding.vim | |
parent | b8a9b07b741cddbf6e0476e70c94aa186d62b6ae (diff) |
Improve installation and organization
Diffstat (limited to '.vim/after/ftplugin/vim/folding.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..1454cbe --- /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() |