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

@ -3,9 +3,6 @@
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2011-07-08
let s:cpo_save = &cpo
set cpo&vim
setlocal indentexpr=GetDTDIndent()
setlocal indentkeys=!^F,o,O,>
setlocal nosmartindent
@ -14,6 +11,9 @@ if exists("*GetDTDIndent")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" TODO: Needs to be adjusted to stop at [, <, and ].
let s:token_pattern = '^[^[:space:]]\+'

View File

@ -663,7 +663,7 @@ func! s:CSSIndent()
else
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
let prev_unfinished = s:CssUnfinished(prev_text)
if !cur_hasfield && (prev_hasfield || prev_unfinished)
if prev_unfinished
" Continuation line has extra indent if the previous line was not a
" continuation line.
let extra = shiftwidth()
@ -716,9 +716,13 @@ func! s:CSSIndent()
endfunc "}}}
" Inside <style>: Whether a line is unfinished.
" tag:
" tag: blah
" tag: blah &&
" tag: blah ||
func! s:CssUnfinished(text)
"{{{
return a:text =~ '\s\(||\|&&\|:\)\s*$'
return a:text =~ '\(||\|&&\|:\|\k\)\s*$'
endfunc "}}}
" Search back for the first unfinished line above "lnum".

View File

@ -2,7 +2,7 @@
" Language: R
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Thu Feb 18, 2016 06:32AM
" Last Change: Sun Aug 19, 2018 09:13PM
" Only load this indent file when no other was loaded.
@ -19,22 +19,16 @@ if exists("*GetRIndent")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" Options to make the indentation more similar to Emacs/ESS:
if !exists("g:r_indent_align_args")
let g:r_indent_align_args = 1
endif
if !exists("g:r_indent_ess_comments")
let g:r_indent_ess_comments = 0
endif
if !exists("g:r_indent_comment_column")
let g:r_indent_comment_column = 40
endif
if ! exists("g:r_indent_ess_compatible")
let g:r_indent_ess_compatible = 0
endif
if ! exists("g:r_indent_op_pattern")
let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
endif
let g:r_indent_align_args = get(g:, 'r_indent_align_args', 1)
let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0)
let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40)
let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0)
let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern',
\ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$')
function s:RDelete_quotes(line)
let i = 0
@ -231,7 +225,7 @@ function GetRIndent()
let cline = SanitizeRLine(cline)
if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
if cline =~ '^\s*}'
let indline = s:Get_matching_brace(clnum, '{', '}', 1)
if indline > 0 && indline != clnum
let iline = SanitizeRLine(getline(indline))
@ -244,6 +238,11 @@ function GetRIndent()
endif
endif
if cline =~ '^\s*)$'
let indline = s:Get_matching_brace(clnum, '(', ')', 1)
return indent(indline)
endif
" Find the first non blank line above the current line
let lnum = s:Get_prev_line(clnum)
" Hit the start of the file, use zero indent.
@ -515,7 +514,9 @@ function GetRIndent()
endwhile
return ind
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2

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

View File

@ -21,7 +21,7 @@ else
let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
endif
unlet b:did_indent
unlet! b:did_indent
runtime indent/r.vim
let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
let b:did_indent = 1