runtime(r): Update R runtime files and docs (#13757)

* Update R runtime files
- Fix indentation issue with ggplot().
- Setlocal autoindent in indent/r.vim.
- New syntax option: rmd_include_latex.
- Clear syn iskeyword to recognize _ as keyword.
- Document some options.
- remove the test has("patch-7.4.1142")
- Update changed date of doc files

Signed-off-by: Jakson Alves de Aquino <jalvesaq@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org
This commit is contained in:
Jakson Alves de Aquino
2023-12-25 09:22:27 +00:00
committed by GitHub
parent 377372ed5b
commit 9042bd8b09
7 changed files with 108 additions and 62 deletions

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: Mon Feb 27, 2023 07:16PM
" Last Change: Sun Oct 08, 2023 10:45AM
" Only load this indent file when no other was loaded.
@ -13,6 +13,7 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetRIndent()
setlocal autoindent
let b:undo_indent = "setl inde< indk<"
@ -47,27 +48,23 @@ function s:RDelete_quotes(line)
if a:line[i] == '"'
let i += 1
endif
else
elseif a:line[i] == "'"
let i += 1
let line1 = line1 . 's'
while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
let i += 1
endwhile
if a:line[i] == "'"
let i += 1
let line1 = line1 . 's'
while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
let i += 1
endwhile
if a:line[i] == "'"
let i += 1
endif
else
if a:line[i] == "`"
let i += 1
let line1 = line1 . 's'
while a:line[i] != "`" && i < llen
let i += 1
endwhile
if a:line[i] == "`"
let i += 1
endif
endif
endif
elseif a:line[i] == "`"
let i += 1
let line1 = line1 . 's'
while a:line[i] != "`" && i < llen
let i += 1
endwhile
if a:line[i] == "`"
let i += 1
endif
endif
if i == llen
@ -97,10 +94,8 @@ function s:RDelete_parens(line)
let i += 1
if a:line[i] == ')'
let nop -= 1
else
if a:line[i] == '('
let nop += 1
endif
elseif a:line[i] == '('
let nop += 1
endif
endwhile
let line1 = line1 . a:line[i]
@ -174,10 +169,8 @@ function s:Get_last_paren_idx(line, o, c, pb)
if blc == 0
let theidx = idx
endif
else
if line[idx] == a:c
let blc += 1
endif
elseif line[idx] == a:c
let blc += 1
endif
let idx += 1
endwhile
@ -316,6 +309,11 @@ function GetRIndent()
endif
if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
if line =~ '.*[\-\*+>]$'
let is_op = v:true
else
let is_op = v:false
endif
let lnum = s:Get_prev_line(lnum)
while pb < 1 && lnum > 0
let line = SanitizeRLine(getline(lnum))
@ -324,9 +322,10 @@ function GetRIndent()
while ind > 0
if line[ind] == ')'
let pb -= 1
else
if line[ind] == '('
let pb += 1
elseif line[ind] == '('
let pb += 1
if is_op && pb == 0
return indent(lnum)
endif
endif
if pb == 1
@ -367,10 +366,8 @@ function GetRIndent()
else
return indent(lnum) + shiftwidth()
endif
else
if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - shiftwidth()
endif
elseif substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - shiftwidth()
endif
elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) + shiftwidth()
@ -404,12 +401,10 @@ function GetRIndent()
if cline =~ '^\s*else'
if line =~ '<-\s*if\s*()'
return indent(lnum) + shiftwidth()
elseif line =~ '\<if\s*()'
return indent(lnum)
else
if line =~ '\<if\s*()'
return indent(lnum)
else
return indent(lnum) - shiftwidth()
endif
return indent(lnum) - shiftwidth()
endif
endif