summaryrefslogtreecommitdiff
path: root/vim/.vim/after/ftplugin/freefem/folding.vim
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2016-04-19 15:24:25 +0100
committerUrbain Vaes <urbain@vaes.uk>2016-04-19 15:24:25 +0100
commite146e947c52ac4adbe426b3f893faff1e46ed5f8 (patch)
tree1605bf4eb78cc619988c92632f3cee2a56143fd5 /vim/.vim/after/ftplugin/freefem/folding.vim
parent83bd503208d45fa837348441196dd07223b13e3e (diff)
Use GNU stow for dotfiles management
Diffstat (limited to 'vim/.vim/after/ftplugin/freefem/folding.vim')
-rw-r--r--vim/.vim/after/ftplugin/freefem/folding.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/vim/.vim/after/ftplugin/freefem/folding.vim b/vim/.vim/after/ftplugin/freefem/folding.vim
new file mode 100644
index 0000000..7d2f6fd
--- /dev/null
+++ b/vim/.vim/after/ftplugin/freefem/folding.vim
@@ -0,0 +1,20 @@
+function! FreeFemFolds()
+ let thisline = getline(v:lnum)
+ if match(thisline,'^/// ') >= 0
+ return ">1"
+ else
+ return "="
+ endif
+endfunction
+
+function! FreeFemFoldText()
+ let startline = getline(v:foldstart)
+ if match(startline,'^/// ') >= 0
+ let title = substitute(startline,'^/// \(.*\)$','\1',"")
+ return '# ' . title
+ endif
+endfunction
+
+setlocal foldmethod=expr
+setlocal foldexpr=FreeFemFolds()
+setlocal foldtext=FreeFemFoldText()