Update runtime files

This commit is contained in:
Bram Moolenaar
2021-04-21 18:09:37 +02:00
parent 459fbdbf92
commit 11e3c5ba82
24 changed files with 2367 additions and 2410 deletions

View File

@ -36,7 +36,7 @@ let b:did_indent = 1
" Is syntax highlighting active ?
let b:indent_use_syntax = has("syntax")
setlocal indentexpr=GetPerl6Indent()
setlocal indentexpr=GetRakuIndent()
" we reset it first because the Perl 5 indent file might have been loaded due
" to a .pl/pm file extension, and indent files don't clean up afterwards
@ -50,7 +50,7 @@ endif
let s:cpo_save = &cpo
set cpo-=C
function! GetPerl6Indent()
function! GetRakuIndent()
" Get the line to be indented
let cline = getline(v:lnum)
@ -60,11 +60,6 @@ function! GetPerl6Indent()
return 0
endif
" Don't reindent coments on first column
if cline =~ '^#'
return 0
endif
" Get current syntax item at the line's first char
let csynid = ''
if b:indent_use_syntax
@ -72,7 +67,7 @@ function! GetPerl6Indent()
endif
" Don't reindent POD and heredocs
if csynid =~ "^p6Pod"
if csynid =~ "^rakuPod"
return indent(v:lnum)
endif
@ -92,7 +87,7 @@ function! GetPerl6Indent()
let skippin = 2
while skippin
let synid = synIDattr(synID(lnum,1,0),"name")
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
if (synid =~ "^rakuPod" || synid =~ "rakuComment")
let lnum = prevnonblank(lnum - 1)
if lnum == 0
return 0
@ -107,19 +102,19 @@ function! GetPerl6Indent()
endif
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
let ind = ind + shiftwidth()
let ind = ind + &sw
endif
if cline =~ '^\s*[)}\]»>]'
let ind = ind - shiftwidth()
let ind = ind - &sw
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
let ind = ind + shiftwidth()
let ind = ind + &sw
endif
elseif line =~ '^\s*\(or\|and\)\>'
let ind = ind - shiftwidth()
let ind = ind - &sw
endif
return ind

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: Sun Aug 19, 2018 09:14PM
" Last Change: Sun Mar 28, 2021 08:05PM
" Only load this indent file when no other was loaded.
@ -13,7 +13,7 @@ runtime indent/r.vim
let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentkeys=0{,0},<:>,!^F,o,O,e
setlocal indentexpr=GetRmdIndent()
if exists("*GetRmdIndent")
@ -23,6 +23,21 @@ endif
let s:cpo_save = &cpo
set cpo&vim
" Simple Python indentation algorithm
function s:GetPyIndent()
let plnum = prevnonblank(v:lnum - 1)
let pline = getline(plnum)
let cline = getline(v:lnum)
if pline =~ '^s```\s*{\s*python '
return 0
elseif pline =~ ':$'
return indent(plnum) + &shiftwidth
elseif cline =~ 'else:$'
return indent(plnum) - &shiftwidth
endif
return indent(plnum)
endfunction
function s:GetMdIndent()
let pline = getline(v:lnum - 1)
let cline = getline(v:lnum)
@ -37,13 +52,14 @@ function s:GetMdIndent()
endfunction
function s:GetYamlIndent()
let pline = getline(v:lnum - 1)
let plnum = prevnonblank(v:lnum - 1)
let pline = getline(plnum)
if pline =~ ':\s*$'
return indent(v:lnum) + shiftwidth()
return indent(plnum) + shiftwidth()
elseif pline =~ '^\s*- '
return indent(v:lnum) + 2
endif
return indent(prevnonblank(v:lnum - 1))
return indent(plnum)
endfunction
function GetRmdIndent()
@ -52,9 +68,11 @@ function GetRmdIndent()
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)
elseif v:lnum > 1 && (search('^---$', "bnW") == 1 &&
\ (search('^---$', "nW") > v:lnum || search('^\.\.\.$', "nW") > v:lnum))
return s:GetYamlIndent()
elseif search('^[ \t]*```{python', "bncW") > search('^[ \t]*```$', "bncW")
return s:GetPyIndent()
else
return s:GetMdIndent()
endif

View File

@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Feb 18
" Last Change: 2021 Apr 18
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@ -71,7 +71,8 @@ function GetVimIndentIntern()
" End of heredoc: use indent of matching start line
let lnum = v:lnum - 1
while lnum > 0
if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
let attr = synIDattr(synID(lnum, 1, 1), "name")
if attr != '' && attr !~ 'vimLetHereDoc'
return indent(lnum)
endif
let lnum -= 1