Update runtime files.

This commit is contained in:
Bram Moolenaar
2018-08-28 22:58:02 +02:00
parent 627cb6a6b3
commit fc65cabb15
33 changed files with 3983 additions and 343 deletions

View File

@ -2,7 +2,7 @@
" Language: Rmd
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Tue Apr 07, 2015 04:38PM
" Last Change: Sun Aug 19, 2018 09:14PM
" Only load this indent file when no other was loaded.
@ -20,7 +20,10 @@ if exists("*GetRmdIndent")
finish
endif
function GetMdIndent()
let s:cpo_save = &cpo
set cpo&vim
function s:GetMdIndent()
let pline = getline(v:lnum - 1)
let cline = getline(v:lnum)
if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
@ -33,15 +36,31 @@ function GetMdIndent()
return indent(prevnonblank(v:lnum - 1))
endfunction
function s:GetYamlIndent()
let pline = getline(v:lnum - 1)
if pline =~ ':\s*$'
return indent(v:lnum) + &sw
elseif pline =~ '^\s*- '
return indent(v:lnum) + 2
endif
return indent(prevnonblank(v:lnum - 1))
endfunction
function GetRmdIndent()
if getline(".") =~ '^[ \t]*```{r .*}$' || getline(".") =~ '^[ \t]*```$'
return 0
endif
if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW")
return s:RIndent()
elseif v:lnum > 1 && search('^---$', "bnW") == 1 &&
\ (search('^---$', "nW") > v:lnum || search('^...$', "nW") > v:lnum)
return s:GetYamlIndent()
else
return GetMdIndent()
return s:GetMdIndent()
endif
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2