aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/cmake.vim49
-rw-r--r--runtime/indent/cucumber.vim77
-rw-r--r--runtime/indent/fortran.vim24
-rw-r--r--runtime/indent/gdscript.vim154
-rw-r--r--runtime/indent/odin.vim124
-rw-r--r--runtime/indent/qml.vim6
-rw-r--r--runtime/indent/query.lua2
-rw-r--r--runtime/indent/r.vim81
-rw-r--r--runtime/indent/racket.vim17
-rw-r--r--runtime/indent/rhelp.vim8
-rw-r--r--runtime/indent/rmd.vim8
-rw-r--r--runtime/indent/rnoweb.vim8
-rw-r--r--runtime/indent/rrst.vim8
-rw-r--r--runtime/indent/sass.vim6
-rw-r--r--runtime/indent/yaml.vim7
15 files changed, 453 insertions, 126 deletions
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim
index af27c0d49b..c1aa3bff86 100644
--- a/runtime/indent/cmake.vim
+++ b/runtime/indent/cmake.vim
@@ -3,9 +3,9 @@
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
-" Last Change: 2022 Apr 06
+" Last Change: 2023 Dec 12
"
-" Licence: The CMake license applies to this file. See
+" License: The CMake license applies to this file. See
" https://cmake.org/licensing
" This implies that distribution with Vim is allowed
@@ -55,32 +55,41 @@ fun! CMakeGetIndent(lnum)
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
\ '\s*(' . cmake_regex_arguments .
\ '\(' . cmake_regex_comment . '\)\?$'
-
let cmake_indent_close_regex = '^' . cmake_regex_arguments .
\ ')\s*' .
\ '\(' . cmake_regex_comment . '\)\?$'
- let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
- let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
+ let cmake_closing_parens_line = '^\s*\()\+\)\s*$'
- " Add
- if previous_line =~? cmake_indent_comment_line " Handle comments
- let ind = ind
- else
- if previous_line =~? cmake_indent_begin_regex
- let ind = ind + shiftwidth()
+ let cmake_indent_begin_regex = '^\s*\(BLOCK\|IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
+ let cmake_indent_end_regex = '^\s*\(ENDBLOCK\|ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
+
+ if this_line =~? cmake_closing_parens_line
+ if previous_line !~? cmake_indent_open_regex
+ let ind = ind - shiftwidth()
endif
- if previous_line =~? cmake_indent_open_regex
- let ind = ind + shiftwidth()
+ else
+ " Add
+ if previous_line =~? cmake_indent_comment_line " Handle comments
+ let ind = ind
+ else
+ if previous_line =~? cmake_indent_begin_regex
+ let ind = ind + shiftwidth()
+ endif
+ if previous_line =~? cmake_indent_open_regex
+ let ind = ind + shiftwidth()
+ endif
endif
- endif
- " Subtract
- if this_line =~? cmake_indent_end_regex
- let ind = ind - shiftwidth()
- endif
- if previous_line =~? cmake_indent_close_regex
- let ind = ind - shiftwidth()
+ " Subtract
+ if this_line =~? cmake_indent_end_regex
+ let ind = ind - shiftwidth()
+ endif
+ if previous_line !~? cmake_closing_parens_line
+ if previous_line =~? cmake_indent_close_regex
+ let ind = ind - shiftwidth()
+ endif
+ endif
endif
return ind
diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim
index ad28a67a0d..5d144e426b 100644
--- a/runtime/indent/cucumber.vim
+++ b/runtime/indent/cucumber.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2023 Dec 28
if exists("b:did_indent")
finish
@@ -19,57 +19,80 @@ if exists("*GetCucumberIndent")
finish
endif
-function! s:syn(lnum)
- return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
+let s:headings = {
+ \ 'Feature': 'feature',
+ \ 'Rule': 'rule',
+ \ 'Background': 'bg_or_scenario',
+ \ 'Scenario': 'bg_or_scenario',
+ \ 'ScenarioOutline': 'bg_or_scenario',
+ \ 'Examples': 'examples',
+ \ 'Scenarios': 'examples'}
+
+function! s:Line(lnum) abort
+ if getline(a:lnum) =~# ':'
+ let group = matchstr(synIDattr(synID(a:lnum,1+indent(a:lnum), 1), 'name'), '^cucumber\zs.*')
+ if !has_key(s:headings, group)
+ let group = substitute(matchstr(getline(a:lnum), '^\s*\zs\%([^:]\+\)\ze:\S\@!'), '\s\+', '', 'g')
+ endif
+ else
+ let group = ''
+ endif
+ let char = matchstr(getline(a:lnum), '^\s*\zs[[:punct:]]')
+ return {
+ \ 'lnum': a:lnum,
+ \ 'indent': indent(a:lnum),
+ \ 'heading': get(s:headings, group, ''),
+ \ 'tag': char ==# '@',
+ \ 'table': char ==# '|',
+ \ 'comment': char ==# '#',
+ \ }
endfunction
-function! GetCucumberIndent()
- let line = getline(prevnonblank(v:lnum-1))
- let cline = getline(v:lnum)
- let nline = getline(nextnonblank(v:lnum+1))
- let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth()
- let syn = s:syn(prevnonblank(v:lnum-1))
- let csyn = s:syn(v:lnum)
- let nsyn = s:syn(nextnonblank(v:lnum+1))
- if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
+function! GetCucumberIndent(...) abort
+ let lnum = a:0 ? a:1 : v:lnum
+ let sw = shiftwidth()
+ let prev = s:Line(prevnonblank(lnum-1))
+ let curr = s:Line(lnum)
+ let next = s:Line(nextnonblank(lnum+1))
+ if curr.heading ==# 'feature'
" feature heading
return 0
- elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
+ elseif curr.heading ==# 'examples'
" examples heading
return 2 * sw
- elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ elseif curr.heading ==# 'bg_or_scenario'
" background, scenario or outline heading
return sw
- elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
+ elseif prev.heading ==# 'feature'
" line after feature heading
return sw
- elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
+ elseif prev.heading ==# 'examples'
" line after examples heading
return 3 * sw
- elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ elseif prev.heading ==# 'bg_or_scenario'
" line after background, scenario or outline heading
return 2 * sw
- elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
+ elseif (curr.tag || curr.comment) && (next.heading ==# 'feature' || prev.indent <= 0)
" tag or comment before a feature heading
return 0
- elseif cline =~# '^\s*@'
+ elseif curr.tag
" other tags
return sw
- elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
+ elseif (curr.table || curr.comment) && prev.table
" mid-table
" preserve indent
- return indent(prevnonblank(v:lnum-1))
- elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
+ return prev.indent
+ elseif curr.table && !prev.table
" first line of a table, relative indent
- return indent(prevnonblank(v:lnum-1)) + sw
- elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
+ return prev.indent + sw
+ elseif !curr.table && prev.table
" line after a table, relative unindent
- return indent(prevnonblank(v:lnum-1)) - sw
- elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
+ return prev.indent - sw
+ elseif curr.comment && getline(v:lnum-1) =~# '^\s*$' && next.heading ==# 'bg_or_scenario'
" comments on scenarios
return sw
endif
- return indent(prevnonblank(v:lnum-1))
+ return prev.indent < 0 ? 0 : prev.indent
endfunction
" vim:set sts=2 sw=2:
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index 9623014818..392b2d29d5 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: (v49) 2022 May 14
-" Maintainer: Ajit J. Thakkar <thakkar.ajit@gmail.com>; <http://www2.unb.ca/~ajit/>
+" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, 77, 66)
+" Version: (v50) 2023 December 22
+" Maintainers: Ajit J. Thakkar <ajit@unb.ca>; <https://ajit.ext.unb.ca/>
+" Joshua Hollett <j.hollett@uwinnipeg.ca>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
@@ -21,8 +22,8 @@ let b:undo_indent = "setl inde< indk<"
setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select
setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect,=~elseif
-setlocal indentkeys+==~type,=~interface,=~forall,=~associate,=~block,=~enum
-setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum
+setlocal indentkeys+==~interface,=~forall,=~associate,=~block,=~enum,=~critical
+setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum,=~endcritical
if exists("b:fortran_indent_more") || exists("g:fortran_indent_more")
setlocal indentkeys+==~function,=~subroutine,=~module,=~contains,=~program
setlocal indentkeys+==~endfunction,=~endsubroutine,=~endmodule
@@ -48,7 +49,7 @@ if !exists("b:fortran_fixed_source")
" Fixed-form file extension defaults
let b:fortran_fixed_source = 1
else
- " Modern fortran still allows both fixed and free source form
+ " Modern fortran compilers still allow both fixed and free source form
" Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
@@ -108,8 +109,9 @@ function FortranGetIndent(lnum)
"Add a shiftwidth to statements following if, else, else if, case, class,
"where, else where, forall, type, interface and associate statements
- if prevstat =~? '^\s*\(case\|class\|else\|else\s*if\|else\s*where\)\>'
- \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>'
+ if prevstat =~? '^\s*\(case\|class\s\+is\|else\|else\s*if\|else\s*where\)\>'
+ \ ||prevstat=~? '^\s*\(type\|rank\|interface\|associate\|enum\|critical\)\>'
+ \ ||prevstat=~? '^\s*change\s\+team\>'
\ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>'
\ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>'
let ind = ind + shiftwidth()
@@ -144,10 +146,10 @@ function FortranGetIndent(lnum)
"Subtract a shiftwidth from else, else if, elsewhere, case, class, end if,
" end where, end select, end forall, end interface, end associate,
- " end enum, end type, end block and end type statements
+ " end enum, end type, end block, end team and end type statements
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*'
- \. '\(else\|else\s*if\|else\s*where\|case\|class\|'
- \. 'end\s*\(if\|where\|select\|interface\|'
+ \. '\(else\|else\s*if\|else\s*where\|case\|class\|rank\|type\s\+is\|'
+ \. 'end\s*\(if\|where\|select\|interface\|critical\|team\|'
\. 'type\|forall\|associate\|enum\|block\)\)\>'
let ind = ind - shiftwidth()
" Fix indent for case statement immediately after select
diff --git a/runtime/indent/gdscript.vim b/runtime/indent/gdscript.vim
new file mode 100644
index 0000000000..bbb4f284f1
--- /dev/null
+++ b/runtime/indent/gdscript.vim
@@ -0,0 +1,154 @@
+" Vim indent file
+" Language: gdscript (Godot game engine)
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Based on python indent file.
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:undo_opts = "setl indentexpr< indentkeys< lisp< autoindent<"
+
+if exists('b:undo_indent')
+ let b:undo_indent ..= "|" .. s:undo_opts
+else
+ let b:undo_indent = s:undo_opts
+endif
+
+setlocal nolisp
+setlocal autoindent
+setlocal indentexpr=s:GDScriptIndent()
+setlocal indentkeys+=<:>,=elif,=except
+
+
+function s:GDScriptIndent() abort
+ " If this line is explicitly joined: If the previous line was also joined,
+ " line it up with that one, otherwise add two 'shiftwidth'
+ if getline(v:lnum - 1) =~# '\\$'
+ if v:lnum > 1 && getline(v:lnum - 2) =~# '\\$'
+ return indent(v:lnum - 1)
+ endif
+ return indent(v:lnum - 1) + (shiftwidth() * 2)
+ endif
+
+ " If the start of the line is in a string don't change the indent.
+ if has('syntax_items') && synIDattr(synID(v:lnum, 1, 1), "name") =~# "String$"
+ return -1
+ endif
+
+ " Search backwards for the previous non-empty line.
+ let plnum = prevnonblank(v:lnum - 1)
+
+ if plnum == 0
+ " This is the first non-empty line, use zero indent.
+ return 0
+ endif
+
+ let plindent = indent(plnum)
+ let plnumstart = plnum
+
+ " Get the line and remove a trailing comment.
+ " Use syntax highlighting attributes when possible.
+ let pline = getline(plnum)
+ let pline_len = strlen(pline)
+ if has('syntax_items')
+ " If the last character in the line is a comment, do a binary search for
+ " the start of the comment. synID() is slow, a linear search would take
+ " too long on a long line.
+ if synIDattr(synID(plnum, pline_len, 1), "name") =~# "\\(Comment\\|Todo\\)$"
+ let min = 1
+ let max = pline_len
+ while min < max
+ let col = (min + max) / 2
+ if synIDattr(synID(plnum, col, 1), "name") =~# "\\(Comment\\|Todo\\)$"
+ let max = col
+ else
+ let min = col + 1
+ endif
+ endwhile
+ let pline = strpart(pline, 0, min - 1)
+ endif
+ else
+ let col = 0
+ while col < pline_len
+ if pline[col] ==# '#'
+ let pline = strpart(pline, 0, col)
+ break
+ endif
+ let col = col + 1
+ endwhile
+ endif
+
+
+ " When "inside" parenthesis: If at the first line below the parenthesis add
+ " one 'shiftwidth' ("inside" is simplified and not really checked)
+ " my_var = (
+ " a
+ " + b
+ " + c
+ " )
+ if pline =~# '[({\[]\s*$'
+ return indent(plnum) + shiftwidth()
+ endif
+
+
+ " If the previous line ended with a colon, indent this line
+ if pline =~# ':\s*$'
+ return plindent + shiftwidth()
+ endif
+
+ " If the previous line was a stop-execution statement...
+ if getline(plnum) =~# '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+ " See if the user has already dedented
+ if indent(v:lnum) > indent(plnum) - shiftwidth()
+ " If not, recommend one dedent
+ return indent(plnum) - shiftwidth()
+ endif
+ " Otherwise, trust the user
+ return -1
+ endif
+
+ " If the current line begins with a keyword that lines up with "try"
+ if getline(v:lnum) =~# '^\s*\(except\|finally\)\>'
+ let lnum = v:lnum - 1
+ while lnum >= 1
+ if getline(lnum) =~# '^\s*\(try\|except\)\>'
+ let ind = indent(lnum)
+ if ind >= indent(v:lnum)
+ return -1 " indent is already less than this
+ endif
+ return ind " line up with previous try or except
+ endif
+ let lnum = lnum - 1
+ endwhile
+ return -1 " no matching "try"!
+ endif
+
+
+ " If the current line begins with a header keyword, dedent
+ if getline(v:lnum) =~# '^\s*\(elif\|else\)\>'
+
+ " Unless the previous line was a one-liner
+ if getline(plnumstart) =~# '^\s*\(for\|if\|try\)\>'
+ return plindent
+ endif
+
+ " Or the user has already dedented
+ if indent(v:lnum) <= plindent - shiftwidth()
+ return -1
+ endif
+
+ return plindent - shiftwidth()
+ endif
+
+ return -1
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/runtime/indent/odin.vim b/runtime/indent/odin.vim
new file mode 100644
index 0000000000..0747b6b155
--- /dev/null
+++ b/runtime/indent/odin.vim
@@ -0,0 +1,124 @@
+" Vim indent plugin file
+" Language: Odin
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-odin
+" Last Change: 2024-01-15
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_indent = 'setlocal cindent< cinoptions< cinkeys< indentexpr<'
+
+setlocal cindent
+setlocal cinoptions=L0,m1,(s,j1,J1,l1,+0,:0,#1
+setlocal cinkeys=0{,0},0),0],!^F,:,o,O
+
+setlocal indentexpr=s:GetOdinIndent(v:lnum)
+
+function s:PrevLine(lnum) abort
+ let plnum = a:lnum - 1
+ while plnum > 1
+ let plnum = prevnonblank(plnum)
+ let pline = getline(plnum)
+ " XXX: take into account nested multiline /* /* */ */ comments
+ if pline =~# '\*/\s*$'
+ while getline(plnum) !~# '/\*' && plnum > 1
+ let plnum -= 1
+ endwhile
+ if getline(plnum) =~# '^\s*/\*'
+ let plnum -= 1
+ else
+ break
+ endif
+ elseif pline =~# '^\s*//'
+ let plnum -= 1
+ else
+ break
+ endif
+ endwhile
+ return plnum
+endfunction
+
+function s:GetOdinIndent(lnum) abort
+ let plnum = s:PrevLine(a:lnum)
+ let pline = getline(plnum)
+ let pindent = indent(plnum)
+ " workaround of cindent "hang"
+ " if the previous line looks like:
+ " : #{}
+ " : #whatever{whateverelse}
+ " and variations where : # { } are in the string
+ " cindent(lnum) hangs
+ if pline =~# ':\s\+#.*{.*}'
+ return pindent
+ endif
+
+ let indent = cindent(a:lnum)
+ let line = getline(a:lnum)
+
+ if line =~# '^\s*#\k\+'
+ if pline =~# '[{:]\s*$'
+ let indent = pindent + shiftwidth()
+ else
+ let indent = pindent
+ endif
+ elseif pline =~# 'switch\s.*{\s*$'
+ let indent = pindent
+ elseif pline =~# 'case\s*.*,\s*\(//.*\)\?$' " https://github.com/habamax/vim-odin/issues/8
+ let indent = pindent + matchstr(pline, 'case\s*')->strcharlen()
+ elseif line =~# '^\s*case\s\+.*,\s*$'
+ let indent = pindent - shiftwidth()
+ elseif pline =~# 'case\s*.*:\s*\(//.*\)\?$'
+ if line !~# '^\s*}\s*$' && line !~# '^\s*case[[:space:]:]'
+ let indent = pindent + shiftwidth()
+ endif
+ elseif pline =~# '^\s*@.*' && line !~# '^\s*}'
+ let indent = pindent
+ elseif pline =~# ':[:=].*}\s*$'
+ let indent = pindent
+ elseif pline =~# '^\s*}\s*$'
+ if line !~# '^\s*}' && line !~# 'case\s*.*:\s*$'
+ let indent = pindent
+ else
+ let indent = pindent - shiftwidth()
+ endif
+ elseif pline =~# '\S:\s*$'
+ " looking up for a case something,
+ " whatever,
+ " anything:
+ " ... 20 lines before
+ for idx in range(plnum - 1, plnum - 21, -1)
+ if plnum < 1
+ break
+ endif
+ if getline(idx) =~# '^\s*case\s.*,\s*$'
+ let indent = indent(idx) + shiftwidth()
+ break
+ endif
+ endfor
+ elseif pline =~# '{[^{]*}\s*$' && line !~# '^\s*[})]\s*$' " https://github.com/habamax/vim-odin/issues/2
+ let indent = pindent
+ elseif pline =~# '^\s*}\s*$' " https://github.com/habamax/vim-odin/issues/3
+ " Find line with opening { and check if there is a label:
+ " If there is, return indent of the closing }
+ call cursor(plnum, 1)
+ silent normal! %
+ let brlnum = line('.')
+ let brline = getline('.')
+ if plnum != brlnum && (brline =~# '^\s*\k\+:\s\+for' || brline =~# '^\s*\k\+\s*:=')
+ let indent = pindent
+ endif
+ endif
+
+ return indent
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/qml.vim b/runtime/indent/qml.vim
index 8c9fa91250..cf0ba41957 100644
--- a/runtime/indent/qml.vim
+++ b/runtime/indent/qml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: QML
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
-" Last Change: 2023 Aug 16
+" Last Change: 2024 Jan 24 by Vim Project
"
" Improved JavaScript indent script.
@@ -40,10 +40,10 @@ function! s:GetQmlIndent()
" bracket/brace/paren blocks
if pline =~ '[{[(]$'
- let ind += &sw
+ let ind += shiftwidth()
endif
if line =~ '^[}\])]'
- let ind -= &sw
+ let ind -= shiftwidth()
endif
" '/*' comments
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
index c86948e95e..3261376d87 100644
--- a/runtime/indent/query.lua
+++ b/runtime/indent/query.lua
@@ -1,5 +1,5 @@
-- Neovim indent file
--- Language: Tree-sitter query
+-- Language: Treesitter query
-- Last Change: 2022 Mar 29
-- it's a lisp!
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim
index 07dfd13881..339c46b172 100644
--- a/runtime/indent/r.vim
+++ b/runtime/indent/r.vim
@@ -1,8 +1,10 @@
" Vim indent file
" 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
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Oct 08 10:45AM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
@@ -13,6 +15,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 +50,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 +96,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 +171,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 +311,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 +324,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 +368,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 +403,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
diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim
index 93bd38fbff..d301cd64f9 100644
--- a/runtime/indent/racket.vim
+++ b/runtime/indent/racket.vim
@@ -3,7 +3,7 @@
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
" Previous Maintainer: Will Langstroth <will@langstroth.com>
" URL: https://github.com/benknoble/vim-racket
-" Last Change: 2022 Aug 12
+" Last Change: 2024 Jan 31
if exists("b:did_indent")
finish
@@ -11,18 +11,25 @@ endif
let b:did_indent = 1
setlocal lisp autoindent nosmartindent
+if has('vim9script')
+ setlocal indentexpr=racket#Indent() lispoptions+=expr:1
+endif
-setlocal lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local
+setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local
setlocal lispwords+=define/contract
setlocal lispwords+=λ
setlocal lispwords+=with-handlers
setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
+setlocal lispwords+=define-syntax-parameter,syntax-parameterize
setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
setlocal lispwords+=define-opt/c,define-syntax-rule
-setlocal lispwords+=define-test-suite
+setlocal lispwords+=define-test-suite,test-case
setlocal lispwords+=struct
setlocal lispwords+=with-input-from-file,with-output-to-file
+setlocal lispwords+=begin,begin0
+setlocal lispwords+=place
+setlocal lispwords+=cond
" Racket OOP
" TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
@@ -41,6 +48,8 @@ setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/fl
setlocal lispwords+=for/async
setlocal lispwords+=for/set,for*/set
setlocal lispwords+=for/first,for*/first
+setlocal lispwords+=for/last,for*/last
+setlocal lispwords+=for/stream,for*/stream
setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
@@ -57,4 +66,4 @@ setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
setlocal lispwords+=case/dep
setlocal lispwords+=define/obs
-let b:undo_indent = "setlocal lisp< ai< si< lw<"
+let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')
diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim
index 334802ab78..97820ae148 100644
--- a/runtime/indent/rhelp.vim
+++ b/runtime/indent/rhelp.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: R Documentation (Help), *.Rd
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:01PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Feb 27 07:01PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim
index a043b0c994..f2d34a3f32 100644
--- a/runtime/indent/rmd.vim
+++ b/runtime/indent/rmd.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rmd
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Wed Nov 09, 2022 09:44PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2022 Nov 09 09:44PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim
index 668cdb7ddd..1bdf7f3b12 100644
--- a/runtime/indent/rnoweb.vim
+++ b/runtime/indent/rnoweb.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rnoweb
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:17PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 27 07:17PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim
index 585c5e6654..73c8b04611 100644
--- a/runtime/indent/rrst.vim
+++ b/runtime/indent/rrst.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rrst
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Feb 25, 2023
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Feb 25
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim
index 8c0ecd0746..45dc869a55 100644
--- a/runtime/indent/sass.vim
+++ b/runtime/indent/sass.vim
@@ -1,14 +1,14 @@
" Vim indent file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2022 Mar 15
+" Last Change: 2023 Dec 28
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
-setlocal autoindent sw=2 et
+setlocal autoindent
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
@@ -26,10 +26,8 @@ function! GetSassIndent()
let lnum = prevnonblank(v:lnum-1)
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
- let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
- let cindent = indent(v:lnum)
if line !~ s:property && line !~ s:extend && cline =~ s:property
return indent + shiftwidth()
else
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 93fd8ea6f6..e5daf9f219 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -3,6 +3,7 @@
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Updates: Lukas Reineke, "lacygoill"
" Last Change: 2022 Jun 17
+" 2024 Feb 29 disable mulitline indent by default (The Vim project)
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -138,11 +139,13 @@ function GetYAMLIndent(lnum)
else
return indent(prevmapline)
endif
- elseif prevline =~# '^\s*- '
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# '^\s*- '
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
\ '\v|' .. s:c_ns_anchor_property ..
\ '\v|' .. s:block_scalar_header ..
\ '\v)%(\s+|\s*%(\#.*)?$))*'