diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-10-29 09:50:39 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-10-29 09:55:07 +0100 |
commit | 07fdbba9d0a5cce9d466c36fbbaa9fe1cdeb1428 (patch) | |
tree | d566cb8ac4626e11d3766d767a9d64681dd0ae66 /runtime/autoload | |
parent | 877d5c8be799bb89107741ed9a0e24e22a1b4295 (diff) | |
download | rneovim-07fdbba9d0a5cce9d466c36fbbaa9fe1cdeb1428.tar.gz rneovim-07fdbba9d0a5cce9d466c36fbbaa9fe1cdeb1428.tar.bz2 rneovim-07fdbba9d0a5cce9d466c36fbbaa9fe1cdeb1428.zip |
vim-patch:91f84f6e11cd
Update runtime files.
https://github.com/vim/vim/commit/91f84f6e11cd879d43d651c0903d85bff95f0716
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/RstFold.vim | 48 | ||||
-rw-r--r-- | runtime/autoload/xmlformat.vim | 3 |
2 files changed, 49 insertions, 2 deletions
diff --git a/runtime/autoload/RstFold.vim b/runtime/autoload/RstFold.vim new file mode 100644 index 0000000000..5becb04685 --- /dev/null +++ b/runtime/autoload/RstFold.vim @@ -0,0 +1,48 @@ +" Author: Antony Lee <anntzer.lee@gmail.com> +" Description: Helper functions for reStructuredText syntax folding +" Last Modified: 2018-01-07 + +function s:CacheRstFold() + let closure = {'header_types': {}, 'max_level': 0, 'levels': {}} + function closure.Process(match) dict + let curline = getcurpos()[1] + if has_key(self.levels, curline - 1) + " For over+under-lined headers, the regex will match both at the + " overline and at the title itself; in that case, skip the second match. + return + endif + let lines = split(a:match, '\n') + let key = repeat(lines[-1][0], len(lines)) + if !has_key(self.header_types, key) + let self.max_level += 1 + let self.header_types[key] = self.max_level + endif + let self.levels[curline] = self.header_types[key] + endfunction + let save_cursor = getcurpos() + 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) + let b:RstFoldCache = closure.levels +endfunction + +function RstFold#GetRstFold() + if !has_key(b:, 'RstFoldCache') + call s:CacheRstFold() + endif + if has_key(b:RstFoldCache, v:lnum) + return '>' . b:RstFoldCache[v:lnum] + else + return '=' + endif +endfunction + +function RstFold#GetRstFoldText() + if !has_key(b:, 'RstFoldCache') + call s:CacheRstFold() + endif + let indent = repeat(' ', b:RstFoldCache[v:foldstart] - 1) + let thisline = getline(v:foldstart) + " For over+under-lined headers, skip the overline. + let text = thisline =~ '^\([=`:.''"~^_*+#-]\)\1\+$' ? getline(v:foldstart + 1) : thisline + return indent . text +endfunction diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim index 83ba49a073..f227b5ee25 100644 --- a/runtime/autoload/xmlformat.vim +++ b/runtime/autoload/xmlformat.vim @@ -2,9 +2,8 @@ " Last Change: Thu, 22 May 2018 21:26:55 +0100 " Version: 0.1 " Author: Christian Brabandt <cb@256bit.org> -" Script: http://www.vim.org/scripts/script.php?script_id= +" Repository: https://github.com/chrisbra/vim-xml-ftplugin " License: VIM License -" GetLatestVimScripts: ???? 18 :AutoInstall: xmlformat.vim " Documentation: see :h xmlformat.txt (TODO!) " --------------------------------------------------------------------- " Load Once: {{{1 |