diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-29 02:59:32 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-07-29 20:50:07 +0200 |
commit | ef1f1907cc4f9c74fc415d7411aacf8c61a4a38f (patch) | |
tree | a64c7538e93005d367e625dd2a6d827926d2fa87 /runtime/autoload | |
parent | 4cab90ad8c2f82dbdea71cf240384c5c3ae92d4d (diff) | |
download | rneovim-ef1f1907cc4f9c74fc415d7411aacf8c61a4a38f.tar.gz rneovim-ef1f1907cc4f9c74fc415d7411aacf8c61a4a38f.tar.bz2 rneovim-ef1f1907cc4f9c74fc415d7411aacf8c61a4a38f.zip |
vim-patch:4c05fa08c973
Update runtime files
https://github.com/vim/vim/commit/4c05fa08c9739e307ddc88ac91ba6d208f1fd68e
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/RstFold.vim | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/autoload/RstFold.vim b/runtime/autoload/RstFold.vim index 5becb04685..238b1e3537 100644 --- a/runtime/autoload/RstFold.vim +++ b/runtime/autoload/RstFold.vim @@ -1,8 +1,12 @@ " Author: Antony Lee <anntzer.lee@gmail.com> " Description: Helper functions for reStructuredText syntax folding -" Last Modified: 2018-01-07 +" Last Modified: 2018-12-29 function s:CacheRstFold() + if !g:rst_fold_enabled + return + endif + let closure = {'header_types': {}, 'max_level': 0, 'levels': {}} function closure.Process(match) dict let curline = getcurpos()[1] @@ -20,12 +24,18 @@ function s:CacheRstFold() let self.levels[curline] = self.header_types[key] endfunction let save_cursor = getcurpos() + let save_mark = getpos("'[") silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn call setpos('.', save_cursor) + call setpos("'[", save_mark) let b:RstFoldCache = closure.levels endfunction function RstFold#GetRstFold() + if !g:rst_fold_enabled + return + endif + if !has_key(b:, 'RstFoldCache') call s:CacheRstFold() endif @@ -37,6 +47,10 @@ function RstFold#GetRstFold() endfunction function RstFold#GetRstFoldText() + if !g:rst_fold_enabled + return + endif + if !has_key(b:, 'RstFoldCache') call s:CacheRstFold() endif |