aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-07-18 19:37:18 +0000
committerJosh Rahm <rahm@google.com>2022-07-18 19:37:18 +0000
commit308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch)
tree35fe43e01755e0f312650667004487a44d6b7941 /runtime/indent
parent96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff)
parente8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff)
downloadrneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz
rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2
rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/README.txt2
-rw-r--r--runtime/indent/ada.vim3
-rw-r--r--runtime/indent/awk.vim3
-rw-r--r--runtime/indent/basic.vim11
-rw-r--r--runtime/indent/bst.vim6
-rw-r--r--runtime/indent/cdl.vim4
-rw-r--r--runtime/indent/chaiscript.vim3
-rw-r--r--runtime/indent/clojure.vim2
-rw-r--r--runtime/indent/cmake.vim4
-rw-r--r--runtime/indent/cs.vim22
-rw-r--r--runtime/indent/d.vim4
-rw-r--r--runtime/indent/dictconf.vim4
-rw-r--r--runtime/indent/dictdconf.vim2
-rw-r--r--runtime/indent/dtd.vim6
-rw-r--r--runtime/indent/dylan.vim5
-rw-r--r--runtime/indent/falcon.vim3
-rw-r--r--runtime/indent/fennel.vim12
-rw-r--r--runtime/indent/fortran.vim7
-rw-r--r--runtime/indent/freebasic.vim11
-rw-r--r--runtime/indent/gitolite.vim4
-rw-r--r--runtime/indent/haml.vim4
-rw-r--r--runtime/indent/html.vim15
-rw-r--r--runtime/indent/idlang.vim4
-rw-r--r--runtime/indent/julia.vim8
-rw-r--r--runtime/indent/krl.vim130
-rw-r--r--runtime/indent/liquid.vim23
-rw-r--r--runtime/indent/make.vim4
-rw-r--r--runtime/indent/mma.vim3
-rw-r--r--runtime/indent/nginx.vim4
-rw-r--r--runtime/indent/objc.vim6
-rw-r--r--runtime/indent/occam.vim4
-rw-r--r--runtime/indent/perl.vim7
-rw-r--r--runtime/indent/postscr.vim8
-rw-r--r--runtime/indent/pov.vim3
-rw-r--r--runtime/indent/prolog.vim3
-rw-r--r--runtime/indent/qb64.vim (renamed from runtime/indent/systemd.vim)7
-rw-r--r--runtime/indent/query.lua6
-rw-r--r--runtime/indent/ruby.vim48
-rw-r--r--runtime/indent/sas.vim4
-rw-r--r--runtime/indent/sass.vim4
-rw-r--r--runtime/indent/sml.vim5
-rw-r--r--runtime/indent/systemverilog.vim3
-rw-r--r--runtime/indent/testdir/html.in13
-rw-r--r--runtime/indent/testdir/html.ok13
-rw-r--r--runtime/indent/testdir/krl.in148
-rw-r--r--runtime/indent/testdir/krl.ok148
-rw-r--r--runtime/indent/testdir/vim.in6
-rw-r--r--runtime/indent/testdir/vim.ok6
-rw-r--r--runtime/indent/testdir/yaml.in5
-rw-r--r--runtime/indent/testdir/yaml.ok5
-rw-r--r--runtime/indent/tf.vim4
-rw-r--r--runtime/indent/tilde.vim5
-rw-r--r--runtime/indent/treetop.vim9
-rw-r--r--runtime/indent/vim.vim31
-rw-r--r--runtime/indent/xf86conf.vim9
-rw-r--r--runtime/indent/xinetd.vim9
-rw-r--r--runtime/indent/yacc.vim9
-rw-r--r--runtime/indent/yaml.vim40
58 files changed, 761 insertions, 120 deletions
diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt
index 8b114365c6..649870636e 100644
--- a/runtime/indent/README.txt
+++ b/runtime/indent/README.txt
@@ -31,7 +31,7 @@ Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
to other buffers.
To trigger the indenting after typing a word like "endif", add the word to the
-'cinkeys' option with "+=".
+'indentkeys' option with "+=".
You normally set 'indentexpr' to evaluate a function and then define that
function. That function only needs to be defined once for as long as Vim is
diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim
index 6c8ab05267..582d033b23 100644
--- a/runtime/indent/ada.vim
+++ b/runtime/indent/ada.vim
@@ -16,6 +16,7 @@
" 15.10.2006 MK Bram's suggestion for runtime integration
" 05.11.2006 MK Bram suggested to save on spaces
" 19.09.2007 NO g: missing before ada#Comment
+" 2022 April: b:undo_indent added by Doug Kearns
" Help Page: ft-vim-indent
"------------------------------------------------------------------------------
" ToDo:
@@ -35,6 +36,8 @@ setlocal indentexpr=GetAdaIndent()
setlocal indentkeys-=0{,0}
setlocal indentkeys+=0=~then,0=~end,0=~elsif,0=~when,0=~exception,0=~begin,0=~is,0=~record
+let b:undo_indent = "setl inde< indk<"
+
" Only define the functions once.
if exists("*GetAdaIndent")
finish
diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim
index e65331977c..cf8132241c 100644
--- a/runtime/indent/awk.vim
+++ b/runtime/indent/awk.vim
@@ -24,6 +24,7 @@
" 29-04-2002 Fixed problems in function headers and max line width
" Added support for two-line if's without curly braces
" Fixed hang: 2011 Aug 31
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -36,6 +37,8 @@ setlocal indentexpr=GetAwkIndent()
" Mmm, copied from the tcl indent program. Is this okay?
setlocal indentkeys-=:,0#
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*GetAwkIndent")
finish
diff --git a/runtime/indent/basic.vim b/runtime/indent/basic.vim
new file mode 100644
index 0000000000..7228772251
--- /dev/null
+++ b/runtime/indent/basic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: BASIC (QuickBASIC 4.5)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim
index 47e3058810..3dd8d711a8 100644
--- a/runtime/indent/bst.vim
+++ b/runtime/indent/bst.vim
@@ -1,20 +1,18 @@
" Vim indent file
" Language: bst
" Author: Tim Pope <vimNOSPAM@tpope.info>
-" $Id: bst.vim,v 1.1 2007/05/05 18:11:12 vimboss Exp $
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
-setlocal expandtab
setlocal indentexpr=GetBstIndent(v:lnum)
-"setlocal smartindent
setlocal cinkeys&
setlocal cinkeys-=0#
setlocal indentkeys&
-"setlocal indentkeys+=0%
+let b:undo_indent = 'setlocal indentexpr< cinkeys< indentkeys<'
" Only define the function once.
if exists("*GetBstIndent")
diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim
index 0e3c6152b0..2c0fc7988e 100644
--- a/runtime/indent/cdl.vim
+++ b/runtime/indent/cdl.vim
@@ -1,7 +1,7 @@
" Description: Comshare Dimension Definition Language (CDL)
" Maintainer: Raul Segura Acevedo <raulseguraaceved@netscape.net> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: Fri Nov 30 13:35:48 2001 CST
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
"finish
@@ -12,6 +12,8 @@ setlocal indentexpr=CdlGetIndent(v:lnum)
setlocal indentkeys&
setlocal indentkeys+==~else,=~endif,=~then,;,),=
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*CdlGetIndent")
"finish
diff --git a/runtime/indent/chaiscript.vim b/runtime/indent/chaiscript.vim
index 445281cc46..b7a3fe5896 100644
--- a/runtime/indent/chaiscript.vim
+++ b/runtime/indent/chaiscript.vim
@@ -1,6 +1,7 @@
" Vim indent file
" Language: ChaiScript
" Maintainer: Jason Turner <lefticus 'at' gmail com>
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -11,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=GetChaiScriptIndent()
setlocal autoindent
+let b:undo_indent = "setl ai< inde<"
+
" Only define the function once.
if exists("*GetChaiScriptIndent")
finish
diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim
index fadcaf4b4a..5bfbfbb197 100644
--- a/runtime/indent/clojure.vim
+++ b/runtime/indent/clojure.vim
@@ -5,7 +5,7 @@
" Meikel Brandmeyer <mb@kotka.de>
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
-" Last Change: 2021-10-26
+" Last Change: 2022-03-24
if exists("b:did_indent")
finish
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim
index 845bdd7655..af27c0d49b 100644
--- a/runtime/indent/cmake.vim
+++ b/runtime/indent/cmake.vim
@@ -3,7 +3,7 @@
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
-" Last Change: 2017 Sep 24
+" Last Change: 2022 Apr 06
"
" Licence: The CMake license applies to this file. See
" https://cmake.org/licensing
@@ -17,6 +17,8 @@ let b:did_indent = 1
setlocal indentexpr=CMakeGetIndent(v:lnum)
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*CMakeGetIndent")
finish
diff --git a/runtime/indent/cs.vim b/runtime/indent/cs.vim
index 76c12efecf..acc3ba75d5 100644
--- a/runtime/indent/cs.vim
+++ b/runtime/indent/cs.vim
@@ -3,13 +3,10 @@
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainers: Aquila Deus
" Johannes Zellner <johannes@zellner.org>
-" Last Change: 2018-11-21
-" Filenames: *.cs
+" Last Change: 2020-03-26
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs
-"
-" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
@@ -22,19 +19,23 @@ set cpoptions&vim
setlocal indentexpr=GetCSIndent(v:lnum)
function! s:IsCompilerDirective(line)
- return a:line =~? '^\s*#'
+ " Exclude #region and #endregion - these should be indented normally
+ return a:line =~# '^\s*#' && !s:IsRegionDirective(a:line)
+endf
+
+function! s:IsRegionDirective(line)
+ return a:line =~# '^\s*#\s*region' || a:line =~# '^\s*#\s*endregion'
endf
function! s:IsAttributeLine(line)
- return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$'
+ return a:line =~# '^\s*\[[A-Za-z]' && a:line =~# '\]$'
endf
function! s:FindPreviousNonCompilerDirectiveLine(start_lnum)
for delta in range(0, a:start_lnum)
let lnum = a:start_lnum - delta
let line = getline(lnum)
- let is_directive = s:IsCompilerDirective(line)
- if !is_directive
+ if !s:IsCompilerDirective(line) && !s:IsRegionDirective(line)
return lnum
endif
endfor
@@ -58,8 +59,9 @@ function! GetCSIndent(lnum) abort
let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1)
let previous_code_line = getline(lnum)
if s:IsAttributeLine(previous_code_line)
- let ind = indent(lnum)
- return ind
+ return indent(lnum)
+ elseif s:IsRegionDirective(this_line)
+ return cindent(lnum)
else
return cindent(a:lnum)
endif
diff --git a/runtime/indent/d.vim b/runtime/indent/d.vim
index 57f9125890..80c9a2f559 100644
--- a/runtime/indent/d.vim
+++ b/runtime/indent/d.vim
@@ -2,7 +2,7 @@
" Language: D
" Maintainer: Jason Mills <jmills@cs.mun.ca> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2005 Nov 22
+" Last Change: 2022 Apr 06
" Version: 0.1
"
" Please email me with bugs, comments, and suggestion. Put vim in the subject
@@ -19,4 +19,6 @@ let b:did_indent = 1
" D indenting is a lot like the built-in C indenting.
setlocal cindent
+let b:undo_indent = "setl cin<"
+
" vim: ts=8 noet
diff --git a/runtime/indent/dictconf.vim b/runtime/indent/dictconf.vim
index 2e15c76146..fa40585a92 100644
--- a/runtime/indent/dictconf.vim
+++ b/runtime/indent/dictconf.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: dict(1) configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -11,3 +11,5 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},!^F,o,O cinwords= autoindent smartindent
setlocal nosmartindent
inoremap <buffer> # X#
+
+let b:undo_indent = "setl ai< cinw< indk< si< | silent! iunmap <buffer> #"
diff --git a/runtime/indent/dictdconf.vim b/runtime/indent/dictdconf.vim
index 5c4fbdafb5..5c0e7c566c 100644
--- a/runtime/indent/dictdconf.vim
+++ b/runtime/indent/dictdconf.vim
@@ -11,3 +11,5 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},!^F,o,O cinwords= autoindent smartindent
setlocal nosmartindent
inoremap <buffer> # X#
+
+let b:undo_indent = "setl ai< cinw< indk< si< | silent! iunmap <buffer> #"
diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim
index c2b3c0c58e..9fca296c0b 100644
--- a/runtime/indent/dtd.vim
+++ b/runtime/indent/dtd.vim
@@ -4,6 +4,12 @@
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Last Change: 24 Sep 2021
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
setlocal indentexpr=GetDTDIndent()
setlocal indentkeys=!^F,o,O,>
setlocal nosmartindent
diff --git a/runtime/indent/dylan.vim b/runtime/indent/dylan.vim
index 55255ddfa9..e2a6d1039c 100644
--- a/runtime/indent/dylan.vim
+++ b/runtime/indent/dylan.vim
@@ -3,7 +3,7 @@
" Maintainer: Brent A. Fulgham <bfulgham@debian.org> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
" Version: 0.01
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -15,6 +15,9 @@ setlocal indentkeys+==~begin,=~block,=~case,=~cleanup,=~define,=~end,=~else,=~el
" Define the appropriate indent function but only once
setlocal indentexpr=DylanGetIndent()
+
+let b:undo_indent = "setl inde< indk<"
+
if exists("*DylanGetIndent")
finish
endif
diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim
index 664ad61aa5..a58ccad870 100644
--- a/runtime/indent/falcon.vim
+++ b/runtime/indent/falcon.vim
@@ -3,6 +3,7 @@
" Maintainer: Steven Oliver <oliver.steven@gmail.com>
" Website: https://steveno@github.com/steveno/falconpl-vim.git
" Credits: This is, to a great extent, a copy n' paste of ruby.vim.
+" 2022 April: b:undo_indent added by Doug Kearns
" 1. Setup {{{1
" ============
@@ -20,6 +21,8 @@ setlocal indentexpr=FalconGetIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
setlocal indentkeys+==~case,=~catch,=~default,=~elif,=~else,=~end,=~\"
+let b:undo_indent = "setl inde< indk< si<"
+
" Define the appropriate indent function but only once
if exists("*FalconGetIndent")
finish
diff --git a/runtime/indent/fennel.vim b/runtime/indent/fennel.vim
new file mode 100644
index 0000000000..e12aa18a8a
--- /dev/null
+++ b/runtime/indent/fennel.vim
@@ -0,0 +1,12 @@
+" Vim indent file
+" Language: Fennel
+" Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com>
+" Last Change: 2022 Apr 20
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+" Use the Lisp indenting
+runtime! indent/lisp.vim
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index 26ed33a54d..9623014818 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,13 +1,13 @@
" Vim indent file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: (v48) 2020 October 07
-" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
+" Version: (v49) 2022 May 14
+" Maintainer: Ajit J. Thakkar <thakkar.ajit@gmail.com>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
" Since then, useful suggestions and contributions have been made, in order, by:
" Albert Oliver Serra, Takuya Fujiwara, Philipp Edelmann, Eisuke Kawashima,
-" and Louis Cochen.
+" Louis Cochen, and Doug Kearns.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -17,6 +17,7 @@ let b:did_indent = 1
let s:cposet=&cpoptions
set cpoptions&vim
+let b:undo_indent = "setl inde< indk<"
setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select
setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect,=~elseif
diff --git a/runtime/indent/freebasic.vim b/runtime/indent/freebasic.vim
new file mode 100644
index 0000000000..248b928635
--- /dev/null
+++ b/runtime/indent/freebasic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/gitolite.vim b/runtime/indent/gitolite.vim
index b36f30a494..22be6872cb 100644
--- a/runtime/indent/gitolite.vim
+++ b/runtime/indent/gitolite.vim
@@ -4,7 +4,7 @@
" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim)
" Maintainer: Sitaram Chamarty <sitaramc@gmail.com>
" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>)
-" Last Change: 2017 Oct 05
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -15,6 +15,8 @@ setlocal autoindent
setlocal indentexpr=GetGitoliteIndent()
setlocal indentkeys=o,O,*<Return>,!^F,=repo,\",=
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetGitoliteIndent")
finish
diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim
index baca1d49d9..acd99d9c7d 100644
--- a/runtime/indent/haml.vim
+++ b/runtime/indent/haml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2019 Dec 05
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
@@ -14,6 +14,8 @@ setlocal autoindent
setlocal indentexpr=GetHamlIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetHamlIndent")
finish
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index d4b91f6421..a3c32d6342 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,7 +1,7 @@
" Vim indent script for HTML
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
-" Last Change: 2021 Jun 13
+" Last Change: 2022 Jan 31
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -149,6 +149,15 @@ func HtmlIndent_CheckUserSettings()
let b:html_indent_line_limit = 200
endif
endif
+
+ if exists('b:html_indent_attribute')
+ let b:hi_attr_indent = b:html_indent_attribute
+ elseif exists('g:html_indent_attribute')
+ let b:hi_attr_indent = g:html_indent_attribute
+ else
+ let b:hi_attr_indent = 2
+ endif
+
endfunc "}}}
" Init Script Vars
@@ -946,11 +955,11 @@ func s:InsideTag(foundHtmlString)
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
endif
if idx == -1
- " after just "<tag" indent two levels more
+ " after just "<tag" indent two levels more by default
let idx = match(text, '<' . s:tagname . '$')
if idx >= 0
call cursor(lnum, idx + 1)
- return virtcol('.') - 1 + shiftwidth() * 2
+ return virtcol('.') - 1 + shiftwidth() * b:hi_attr_indent
endif
endif
if idx > 0
diff --git a/runtime/indent/idlang.vim b/runtime/indent/idlang.vim
index e6a1d73775..1519865ab5 100644
--- a/runtime/indent/idlang.vim
+++ b/runtime/indent/idlang.vim
@@ -2,7 +2,7 @@
" Language: IDL (ft=idlang)
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last change: 2017 Jun 13
+" Last change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +14,8 @@ setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHIL
setlocal indentexpr=GetIdlangIndent(v:lnum)
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*GetIdlangIndent")
finish
diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim
index a90cff49e4..8e4c60322e 100644
--- a/runtime/indent/julia.vim
+++ b/runtime/indent/julia.vim
@@ -2,9 +2,15 @@
" Language: Julia
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
" Homepage: https://github.com/JuliaEditorSupport/julia-vim
-" Last Change: 2016 jun 16
+" Last Change: 2022 Jun 14
" Notes: originally based on Bram Molenaar's indent file for vim
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
setlocal autoindent
setlocal indentexpr=GetJuliaIndent()
diff --git a/runtime/indent/krl.vim b/runtime/indent/krl.vim
new file mode 100644
index 0000000000..cc3cbd1abb
--- /dev/null
+++ b/runtime/indent/krl.vim
@@ -0,0 +1,130 @@
+" Vim indent file
+" Language: Kuka Robot Language
+" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
+" Version: 3.0.0
+" Last Change: 15. Apr 2022
+" Credits: Based on indent/vim.vim
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nolisp
+setlocal nocindent
+setlocal nosmartindent
+setlocal autoindent
+setlocal indentexpr=GetKrlIndent()
+setlocal indentkeys=!^F,o,O,=~end,0=~else,0=~case,0=~default,0=~until,0=~continue,=~part
+let b:undo_indent = "setlocal lisp< cindent< smartindent< autoindent< indentexpr< indentkeys<"
+
+if get(g:,'krlSpaceIndent',1)
+ " Use spaces, not tabs, for indention, 2 is enough.
+ " More or even tabs would waste valuable space on the teach pendant.
+ setlocal softtabstop=2
+ setlocal shiftwidth=2
+ setlocal expandtab
+ setlocal shiftround
+ let b:undo_indent = b:undo_indent." softtabstop< shiftwidth< expandtab< shiftround<"
+endif
+
+" Only define the function once.
+if exists("*GetKrlIndent")
+ finish
+endif
+let s:keepcpo = &cpo
+set cpo&vim
+
+function GetKrlIndent() abort
+
+ let currentLine = getline(v:lnum)
+ if currentLine =~? '\v^;(\s*(end)?fold>)@!' && !get(g:, 'krlCommentIndent', 0)
+ " If current line has a ; in column 1 and is no fold, keep zero indent.
+ " This may be usefull if code is commented out at the first column.
+ return 0
+ endif
+
+ " Find a non-blank line above the current line.
+ let preNoneBlankLineNum = s:KrlPreNoneBlank(v:lnum - 1)
+ if preNoneBlankLineNum == 0
+ " At the start of the file use zero indent.
+ return 0
+ endif
+
+ let preNoneBlankLine = getline(preNoneBlankLineNum)
+ let ind = indent(preNoneBlankLineNum)
+
+ " Define add 'shiftwidth' pattern
+ let addShiftwidthPattern = '\v^\s*('
+ if get(g:, 'krlIndentBetweenDef', 1)
+ let addShiftwidthPattern ..= '(global\s+)?def(fct|dat)?\s+\$?\w'
+ let addShiftwidthPattern ..= '|'
+ endif
+ let addShiftwidthPattern ..= 'if>|while>|for>|loop>'
+ let addShiftwidthPattern ..= '|else>'
+ let addShiftwidthPattern ..= '|case>|default>'
+ let addShiftwidthPattern ..= '|repeat>'
+ let addShiftwidthPattern ..= '|skip>|(ptp_)?spline>'
+ let addShiftwidthPattern ..= '|time_block\s+(start|part)>'
+ let addShiftwidthPattern ..= '|const_vel\s+start>'
+ let addShiftwidthPattern ..= ')'
+
+ " Define Subtract 'shiftwidth' pattern
+ let subtractShiftwidthPattern = '\v^\s*('
+ if get(g:, 'krlIndentBetweenDef', 1)
+ let subtractShiftwidthPattern ..= 'end(fct|dat)?>'
+ let subtractShiftwidthPattern ..= '|'
+ endif
+ let subtractShiftwidthPattern ..= 'end(if|while|for|loop)>'
+ let subtractShiftwidthPattern ..= '|else>'
+ let subtractShiftwidthPattern ..= '|case>|default>|endswitch>'
+ let subtractShiftwidthPattern ..= '|until>'
+ let subtractShiftwidthPattern ..= '|end(skip|spline)>'
+ let subtractShiftwidthPattern ..= '|time_block\s+(part|end)>'
+ let subtractShiftwidthPattern ..= '|const_vel\s+end>'
+ let subtractShiftwidthPattern ..= ')'
+
+ " Add shiftwidth
+ if preNoneBlankLine =~? addShiftwidthPattern
+ let ind += &sw
+ endif
+
+ " Subtract shiftwidth
+ if currentLine =~? subtractShiftwidthPattern
+ let ind = ind - &sw
+ endif
+
+ " First case after a switch gets the indent of the switch.
+ if currentLine =~? '\v^\s*case>'
+ \&& preNoneBlankLine =~? '\v^\s*switch>'
+ let ind = ind + &sw
+ endif
+
+ " align continue with the following instruction
+ if currentLine =~? '\v^\s*continue>'
+ \&& getline(v:lnum + 1) =~? subtractShiftwidthPattern
+ let ind = ind - &sw
+ endif
+
+ return ind
+endfunction
+
+" This function works almost like prevnonblank() but handles &-headers,
+" comments and continue instructions like blank lines
+function s:KrlPreNoneBlank(lnum) abort
+
+ let nPreNoneBlank = prevnonblank(a:lnum)
+
+ while nPreNoneBlank > 0 && getline(nPreNoneBlank) =~? '\v^\s*(\&\w\+|;|continue>)'
+ " Previouse none blank line irrelevant. Look further aback.
+ let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1)
+ endwhile
+
+ return nPreNoneBlank
+endfunction
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
+" vim:sw=2 sts=2 et
diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim
index 7beb0388d1..6fc933797e 100644
--- a/runtime/indent/liquid.vim
+++ b/runtime/indent/liquid.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Mar 15
if exists('b:did_indent')
finish
@@ -29,17 +29,19 @@ let b:did_indent = 1
setlocal indentexpr=GetLiquidIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists('*GetLiquidIndent')
finish
endif
-function! s:count(string,pattern)
+function! s:count(string, pattern) abort
let string = substitute(a:string,'\C'.a:pattern,"\n",'g')
return strlen(substitute(string,"[^\n]",'','g'))
endfunction
-function! GetLiquidIndent(...)
+function! GetLiquidIndent(...) abort
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
@@ -51,13 +53,14 @@ function! GetLiquidIndent(...)
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
- let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
- let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
- let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
+ let line = substitute(line,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','')
+ let line = substitute(line,'\C\%(\s*{%-\=\s*if.\+-\=%}.\+{%-\=\s*endif\s*-\=%}\)\+','','g')
+ let line .= matchstr(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+')
+ let cline = substitute(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','')
let sw = shiftwidth()
- let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
- let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
- let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
- let ind -= sw * s:count(cline,'{%\s*end\w*$')
+ let ind += sw * s:count(line,'{%-\=\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
+ let ind -= sw * s:count(line,'{%-\=\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
+ let ind -= sw * s:count(cline,'{%-\=\s*\%(elsif\|else\|when\|empty\)\>')
+ let ind -= sw * s:count(cline,'{%-\=\s*end\w*$')
return ind
endfunction
diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim
index 76c8f83399..4d1838b3aa 100644
--- a/runtime/indent/make.vim
+++ b/runtime/indent/make.vim
@@ -2,7 +2,7 @@
" Language: Makefile
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Last Change: 24 Sep 2021
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -13,7 +13,7 @@ setlocal indentexpr=GetMakeIndent()
setlocal indentkeys=!^F,o,O,<:>,=else,=endif
setlocal nosmartindent
-let b:undo_indent = "setl ai< inde< indk<"
+let b:undo_indent = "setl inde< indk< si<"
if exists("*GetMakeIndent")
finish
diff --git a/runtime/indent/mma.vim b/runtime/indent/mma.vim
index ebf98b9a38..9dbfd74d66 100644
--- a/runtime/indent/mma.vim
+++ b/runtime/indent/mma.vim
@@ -3,6 +3,7 @@
" Maintainer: Steve Layland <layland@wolfram.com> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
" Last Change: Sat May 10 18:56:22 CDT 2005
+" 2022 April: b:undo_indent added by Doug Kearns
" Source: http://vim.sourceforge.net/scripts/script.php?script_id=1274
" http://members.wolfram.com/layland/vim/indent/mma.vim
"
@@ -26,6 +27,8 @@ setlocal indentexpr=GetMmaIndent()
setlocal indentkeys+=0[,0],0(,0)
setlocal nosi "turn off smart indent so we don't over analyze } blocks
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetMmaIndent")
finish
endif
diff --git a/runtime/indent/nginx.vim b/runtime/indent/nginx.vim
index d4afec1c11..8cef7662e0 100644
--- a/runtime/indent/nginx.vim
+++ b/runtime/indent/nginx.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: nginx.conf
" Maintainer: Chris Aumann <me@chr4.org>
-" Last Change: Apr 15, 2017
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -15,3 +15,5 @@ setlocal cindent
" Just make sure that the comments are not reset as defs would be.
setlocal cinkeys-=0#
+
+let b:undo_indent = "setl inde< cin< cink<"
diff --git a/runtime/indent/objc.vim b/runtime/indent/objc.vim
index a5451a5a11..1d107050dd 100644
--- a/runtime/indent/objc.vim
+++ b/runtime/indent/objc.vim
@@ -1,9 +1,7 @@
" Vim indent file
" Language: Objective-C
" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
-" Last Change: 2004 May 16
-"
-
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -19,6 +17,8 @@ setlocal indentexpr=GetObjCIndent()
setlocal indentkeys-=:
setlocal indentkeys+=<:>
+let b:undo_indent = "setl cin< inde< indk<"
+
" Only define the function once.
if exists("*GetObjCIndent")
finish
diff --git a/runtime/indent/occam.vim b/runtime/indent/occam.vim
index 2979ac16ac..673940a7ec 100644
--- a/runtime/indent/occam.vim
+++ b/runtime/indent/occam.vim
@@ -2,7 +2,7 @@
" Language: occam
" Maintainer: Mario Schweigler <ms44@kent.ac.uk> (Invalid email address)
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 23 April 2003
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -17,6 +17,8 @@ setlocal indentexpr=GetOccamIndent()
setlocal indentkeys=o,O,0=:
"}}}
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once
if exists("*GetOccamIndent")
finish
diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
index 5fc8b7008a..4c91fa1b33 100644
--- a/runtime/indent/perl.vim
+++ b/runtime/indent/perl.vim
@@ -1,9 +1,10 @@
" Vim indent file
-" Language: Perl 5
+" Language: Perl
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
-" Last Change: 2020 Apr 15
+" License: Vim License (see :help license)
+" Last Change: 2021 Sep 24
" Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints)
@@ -35,6 +36,8 @@ if !b:indent_use_syntax
setlocal indentkeys+=0=EO
endif
+let b:undo_indent = "setl inde< indk<"
+
let s:cpo_save = &cpo
set cpo-=C
diff --git a/runtime/indent/postscr.vim b/runtime/indent/postscr.vim
index 0691cd237c..8430ccf8b8 100644
--- a/runtime/indent/postscr.vim
+++ b/runtime/indent/postscr.vim
@@ -1,9 +1,7 @@
" PostScript indent file
" Language: PostScript
-" Maintainer: Mike Williams <mrw@netcomuk.co.uk> (Invalid email address)
-" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2nd July 2001
-"
+" Maintainer: Mike Williams <mrw@eandem.co.uk>
+" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=PostscrIndentGet(v:lnum)
setlocal indentkeys+=0],0=>>,0=%%,0=end,0=restore,0=grestore indentkeys-=:,0#,e
+let b:undo_indent = "setl inde< indk<"
+
" Catch multiple instantiations
if exists("*PostscrIndentGet")
finish
diff --git a/runtime/indent/pov.vim b/runtime/indent/pov.vim
index f74c96b7f7..60077ffffe 100644
--- a/runtime/indent/pov.vim
+++ b/runtime/indent/pov.vim
@@ -2,6 +2,7 @@
" Language: PoV-Ray Scene Description Language
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
" Last Change: 2017 Jun 13
+" 2022 April: b:undo_indent added by Doug Kearns
" URI: http://trific.ath.cx/Ftp/vim/indent/pov.vim
" Only load this indent file when no other was loaded.
@@ -16,6 +17,8 @@ setlocal nolisp " Make sure lisp indenting doesn't supersede us.
setlocal indentexpr=GetPoVRayIndent()
setlocal indentkeys+==else,=end,0]
+let b:undo_indent = "setl inde< indk< lisp<"
+
" Only define the function once.
if exists("*GetPoVRayIndent")
finish
diff --git a/runtime/indent/prolog.vim b/runtime/indent/prolog.vim
index ac03c28064..0c4fd541f9 100644
--- a/runtime/indent/prolog.vim
+++ b/runtime/indent/prolog.vim
@@ -4,6 +4,7 @@
" Doug Kearns <dougkearns@gmail.com>
" Revised on: 2002.02.18. 23:34:05
" Last change by: Takuya Fujiwara, 2018 Sep 23
+" 2022 April: b:undo_indent added by Doug Kearns
" TODO:
" checking with respect to syntax highlighting
@@ -21,6 +22,8 @@ setlocal indentexpr=GetPrologIndent()
setlocal indentkeys-=:,0#
setlocal indentkeys+=0%,-,0;,>,0)
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
"if exists("*GetPrologIndent")
" finish
diff --git a/runtime/indent/systemd.vim b/runtime/indent/qb64.vim
index a05a87bb1c..09f815c43d 100644
--- a/runtime/indent/systemd.vim
+++ b/runtime/indent/qb64.vim
@@ -1,10 +1,11 @@
" Vim indent file
-" Language: systemd.unit(5)
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
-" Looks a lot like dosini files.
-runtime! indent/dosini.vim
+runtime! indent/vb.vim
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
new file mode 100644
index 0000000000..c86948e95e
--- /dev/null
+++ b/runtime/indent/query.lua
@@ -0,0 +1,6 @@
+-- Neovim indent file
+-- Language: Tree-sitter query
+-- Last Change: 2022 Mar 29
+
+-- it's a lisp!
+vim.cmd([[ runtime! indent/lisp.vim ]])
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 559d8652a6..6ce8529fd1 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -4,7 +4,7 @@
" Previous Maintainer: Nikolai Weibull <now at bitwi.se>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Feb 03
+" Last Change: 2022 Mar 22
" 0. Initialization {{{1
" =================
@@ -40,9 +40,11 @@ setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetRubyIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,.
-setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
+setlocal indentkeys+==end,=else,=elsif,=when,=in\ ,=ensure,=rescue,==begin,==end
setlocal indentkeys+==private,=protected,=public
+let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<"
+
" Only define the function once.
if exists("*GetRubyIndent")
finish
@@ -85,14 +87,17 @@ let s:skip_expr =
" Regex used for words that, at the start of a line, add a level of indent.
let s:ruby_indent_keywords =
\ '^\s*\zs\<\%(module\|class\|if\|for' .
- \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' .
+ \ '\|while\|until\|else\|elsif\|case\|when\|in\|unless\|begin\|ensure\|rescue' .
\ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
+" Def without an end clause: def method_call(...) = <expression>
+let s:ruby_endless_def = '\<def\s\+\k\+[!?]\=\%((.*)\|\s\)\s*='
+
" Regex used for words that, at the start of a line, remove a level of indent.
let s:ruby_deindent_keywords =
- \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>'
+ \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|in\|end\):\@!\>'
" Regex that defines the start-match for the 'end' keyword.
"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
@@ -104,15 +109,31 @@ let s:end_start_regex =
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
-let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
+let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|\%(\%(^\|;\)\s*\)\@<=\<in\|elsif\):\@!\>'
" Regex that defines the end-match for the 'end' keyword.
let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
-" Expression used for searchpair() call for finding match for 'end' keyword.
-let s:end_skip_expr = s:skip_expr .
- \ ' || (expand("<cword>") == "do"' .
- \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
+" Expression used for searchpair() call for finding a match for an 'end' keyword.
+function! s:EndSkipExpr()
+ if eval(s:skip_expr)
+ return 1
+ elseif expand('<cword>') == 'do'
+ \ && getline(".") =~ '^\s*\<\(while\|until\|for\):\@!\>'
+ return 1
+ elseif getline('.') =~ s:ruby_endless_def
+ return 1
+ elseif getline('.') =~ '\<def\s\+\k\+[!?]\=([^)]*$'
+ " Then it's a `def method(` with a possible `) =` later
+ call search('\<def\s\+\k\+\zs(', 'W', line('.'))
+ normal! %
+ return getline('.') =~ ')\s*='
+ else
+ return 0
+ endif
+endfunction
+
+let s:end_skip_expr = function('s:EndSkipExpr')
" Regex that defines continuation lines, not including (, {, or [.
let s:non_bracket_continuation_regex =
@@ -572,6 +593,11 @@ function! s:AfterUnbalancedBracket(pline_info) abort
call cursor(info.plnum, closing.pos + 1)
normal! %
+ if strpart(info.pline, closing.pos) =~ '^)\s*='
+ " special case: the closing `) =` of an endless def
+ return indent(s:GetMSL(line('.')))
+ endif
+
if s:Match(line('.'), s:ruby_indent_keywords)
return indent('.') + info.sw
else
@@ -610,7 +636,7 @@ function! s:AfterIndentKeyword(pline_info) abort
let info = a:pline_info
let col = s:Match(info.plnum, s:ruby_indent_keywords)
- if col > 0
+ if col > 0 && s:Match(info.plnum, s:ruby_endless_def) <= 0
call cursor(info.plnum, col)
let ind = virtcol('.') - 1 + info.sw
" TODO: make this better (we need to count them) (or, if a searchpair
@@ -657,7 +683,7 @@ function! s:IndentingKeywordInMSL(msl_info) abort
" TODO: this does not take into account contrived things such as
" module Foo; class Bar; end
let col = s:Match(info.plnum_msl, s:ruby_indent_keywords)
- if col > 0
+ if col > 0 && s:Match(info.plnum_msl, s:ruby_endless_def) <= 0
let ind = indent(info.plnum_msl) + info.sw
if s:Match(info.plnum_msl, s:end_end_regex)
let ind = ind - info.sw
diff --git a/runtime/indent/sas.vim b/runtime/indent/sas.vim
index 9cc9e025c4..bbbbbf02eb 100644
--- a/runtime/indent/sas.vim
+++ b/runtime/indent/sas.vim
@@ -2,7 +2,7 @@
" Language: SAS
" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com>
" Version: 3.0.3
-" Last Change: Jun 26, 2018
+" Last Change: 2022 Apr 06
if exists("b:did_indent")
finish
@@ -12,6 +12,8 @@ let b:did_indent = 1
setlocal indentexpr=GetSASIndent()
setlocal indentkeys+=;,=~data,=~proc,=~macro
+let b:undo_indent = "setl inde< indk<"
+
if exists("*GetSASIndent")
finish
endif
diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim
index d6dbf3a8bb..8c0ecd0746 100644
--- a/runtime/indent/sass.vim
+++ b/runtime/indent/sass.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
@@ -12,6 +12,8 @@ setlocal autoindent sw=2 et
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
+let b:undo_indent = "setl ai< inde< indk<"
+
" Only define the function once.
if exists("*GetSassIndent")
finish
diff --git a/runtime/indent/sml.vim b/runtime/indent/sml.vim
index e760a8e350..a0b0c3e911 100644
--- a/runtime/indent/sml.vim
+++ b/runtime/indent/sml.vim
@@ -7,10 +7,11 @@
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus@oefai.at>
" OCaml URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim
-" Last Change: 2003 Jan 04 - Adapted to SML
+" Last Change: 2022 Apr 06
" 2002 Nov 06 - Some fixes (JY)
" 2002 Oct 28 - Fixed bug with indentation of ']' (MM)
" 2002 Oct 22 - Major rewrite (JY)
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -26,6 +27,8 @@ setlocal nosmartindent
setlocal textwidth=80
setlocal shiftwidth=2
+let b:undo_indent = "setl et< inde< indk< lisp< si< sw< tw<"
+
" Comment formatting
if (has("comments"))
set comments=sr:(*,mb:*,ex:*)
diff --git a/runtime/indent/systemverilog.vim b/runtime/indent/systemverilog.vim
index 16fb4515c5..f6114dc1fd 100644
--- a/runtime/indent/systemverilog.vim
+++ b/runtime/indent/systemverilog.vim
@@ -2,6 +2,7 @@
" Language: SystemVerilog
" Maintainer: kocha <kocha.lsifrontend@gmail.com>
" Last Change: 05-Feb-2017 by Bilal Wasim
+" 2022 April: b:undo_indent added by Doug Kearns
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -16,6 +17,8 @@ setlocal indentkeys+==endclass,=endpackage,=endsequence,=endclocking
setlocal indentkeys+==endinterface,=endgroup,=endprogram,=endproperty,=endchecker
setlocal indentkeys+==`else,=`endif
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*SystemVerilogIndent")
finish
diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in
index 1acf8c0402..b62c67ddb2 100644
--- a/runtime/indent/testdir/html.in
+++ b/runtime/indent/testdir/html.in
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ dd text
dt text
</dt>
</dl>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
@@ -50,6 +55,7 @@ dt text
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok
index c0dfc9dc72..938e965d8c 100644
--- a/runtime/indent/testdir/html.ok
+++ b/runtime/indent/testdir/html.ok
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ div#d2 { color: green; }
dt text
</dt>
</dl>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
@@ -50,6 +55,7 @@ div#d2 { color: green; }
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/krl.in b/runtime/indent/testdir/krl.in
new file mode 100644
index 0000000000..ec90feb08b
--- /dev/null
+++ b/runtime/indent/testdir/krl.in
@@ -0,0 +1,148 @@
+; vim: set ft=krl :
+
+; START_INDENT
+
+def One()
+int i
+If i==1 then
+While i>=1
+For i=1 to 5 step 2
+Loop
+i = i+1
+EndLoop
+EndFor
+EndWhile
+Else
+Repeat
+Switch i
+Case 1
+Skip 123
+i = i+1
+EndSkip 123
+Spline with $acc=100, $vel.cp=3
+slin {x 100}
+scirc {x 110, y 110}, {x 120, y 90}
+slin {x 200} c_dis
+Time_Block Start
+slin {x 300} c_dis
+Time_Block Part = 22.2
+slin {y 400} c_dis
+Time_Block Part = 33.3
+Time_Block End = 10
+slin {y 200} c_dis
+Const_Vel Start +100 OnStart
+slin {y 300} c_dis
+slin {x 100}
+Const_Vel End -5.5
+slin {y 200} c_dis
+EndSpline
+Case 2,3
+PTP_Spline with $acc=100, $vel.ptp=100
+sptp {a1 0} c_ptp
+sptp {a1 90}
+EndSpline c_spl
+Default
+i = i+1
+EndSwitch
+Continue
+Until False
+EndIf
+end
+
+DEF Two()
+int i
+END
+
+global def Three()
+int i
+end
+
+GLOBAL DEF Four()
+int i
+END
+
+Global Def Five()
+int i
+End
+
+deffct bool fOne()
+int i
+endfct
+
+DEFFCT bool fTwo()
+int i
+ENDFCT
+
+global deffct bool fThree()
+int i
+endfct
+
+GLOBAL DEFFCT bool fFour()
+int i
+ENDFCT
+
+Global DefFct bool fFive()
+int i
+EndFct
+
+DefDat datfile()
+global int i=1
+; don't indent column 1 comments unless g:krlCommentIndent is set
+; global int o=2
+EndDat
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlSpaceIndent = 0
+; INDENT_EXE set shiftwidth=4
+
+def bla()
+int i
+end
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlCommentIndent = 1
+def bla()
+; indent this first column comment because of g:krlCommentIndent=1
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlIndentBetweenDef = 0
+def bla()
+int i ; don't indent this line because of g:krlIndentBetweenDef=0
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_AT this-line
+def Some()
+int f
+if true then
+f = 1 ; this-line
+endif
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_NEXT next-line
+def Some()
+ int i
+ ; next-line
+i = 1 ; should get indent of line 'int i' above
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_PREV prev-line
+def Some()
+int f
+if true then
+f = 1
+; prev-line
+endif
+end
+; END_INDENT
diff --git a/runtime/indent/testdir/krl.ok b/runtime/indent/testdir/krl.ok
new file mode 100644
index 0000000000..34dc0f57b1
--- /dev/null
+++ b/runtime/indent/testdir/krl.ok
@@ -0,0 +1,148 @@
+; vim: set ft=krl :
+
+; START_INDENT
+
+def One()
+ int i
+ If i==1 then
+ While i>=1
+ For i=1 to 5 step 2
+ Loop
+ i = i+1
+ EndLoop
+ EndFor
+ EndWhile
+ Else
+ Repeat
+ Switch i
+ Case 1
+ Skip 123
+ i = i+1
+ EndSkip 123
+ Spline with $acc=100, $vel.cp=3
+ slin {x 100}
+ scirc {x 110, y 110}, {x 120, y 90}
+ slin {x 200} c_dis
+ Time_Block Start
+ slin {x 300} c_dis
+ Time_Block Part = 22.2
+ slin {y 400} c_dis
+ Time_Block Part = 33.3
+ Time_Block End = 10
+ slin {y 200} c_dis
+ Const_Vel Start +100 OnStart
+ slin {y 300} c_dis
+ slin {x 100}
+ Const_Vel End -5.5
+ slin {y 200} c_dis
+ EndSpline
+ Case 2,3
+ PTP_Spline with $acc=100, $vel.ptp=100
+ sptp {a1 0} c_ptp
+ sptp {a1 90}
+ EndSpline c_spl
+ Default
+ i = i+1
+ EndSwitch
+ Continue
+ Until False
+ EndIf
+end
+
+DEF Two()
+ int i
+END
+
+global def Three()
+ int i
+end
+
+GLOBAL DEF Four()
+ int i
+END
+
+Global Def Five()
+ int i
+End
+
+deffct bool fOne()
+ int i
+endfct
+
+DEFFCT bool fTwo()
+ int i
+ENDFCT
+
+global deffct bool fThree()
+ int i
+endfct
+
+GLOBAL DEFFCT bool fFour()
+ int i
+ENDFCT
+
+Global DefFct bool fFive()
+ int i
+EndFct
+
+DefDat datfile()
+ global int i=1
+; don't indent column 1 comments unless g:krlCommentIndent is set
+; global int o=2
+EndDat
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlSpaceIndent = 0
+; INDENT_EXE set shiftwidth=4
+
+def bla()
+ int i
+end
+
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlCommentIndent = 1
+def bla()
+ ; indent this first column comment because of g:krlCommentIndent=1
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_EXE let g:krlIndentBetweenDef = 0
+def bla()
+int i ; don't indent this line because of g:krlIndentBetweenDef=0
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_AT this-line
+def Some()
+int f
+if true then
+ f = 1 ; this-line
+endif
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_NEXT next-line
+def Some()
+ int i
+ ; next-line
+ i = 1 ; should get indent of line 'int i' above
+end
+; END_INDENT
+
+; START_INDENT
+; INDENT_PREV prev-line
+def Some()
+int f
+if true then
+ f = 1
+; prev-line
+endif
+end
+; END_INDENT
diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in
index 699e4c243d..873045bc2c 100644
--- a/runtime/indent/testdir/vim.in
+++ b/runtime/indent/testdir/vim.in
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+\ {
+\ 'k': 'val',
+\ },
+\ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok
index f597d97e80..8e70abe619 100644
--- a/runtime/indent/testdir/vim.ok
+++ b/runtime/indent/testdir/vim.ok
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+ \ {
+ \ 'k': 'val',
+ \ },
+ \ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/yaml.in b/runtime/indent/testdir/yaml.in
index 8515e1752c..bf99668da2 100644
--- a/runtime/indent/testdir/yaml.in
+++ b/runtime/indent/testdir/yaml.in
@@ -14,6 +14,7 @@ map: val
# END_INDENT
# START_INDENT
-map: multiline
-value
+map: |
+line1
+line2
# END_INDENT
diff --git a/runtime/indent/testdir/yaml.ok b/runtime/indent/testdir/yaml.ok
index 5ca2871fc9..8b38633e71 100644
--- a/runtime/indent/testdir/yaml.ok
+++ b/runtime/indent/testdir/yaml.ok
@@ -14,6 +14,7 @@ map: val
# END_INDENT
# START_INDENT
-map: multiline
- value
+map: |
+ line1
+ line2
# END_INDENT
diff --git a/runtime/indent/tf.vim b/runtime/indent/tf.vim
index a980538506..bb40bf6f01 100644
--- a/runtime/indent/tf.vim
+++ b/runtime/indent/tf.vim
@@ -2,7 +2,7 @@
" Language: tf (TinyFugue)
" Maintainer: Christian J. Robinson <heptite@gmail.com>
" URL: http://www.vim.org/scripts/script.php?script_id=174
-" Last Change: 2017 Feb 25
+" Last Change: 2022 Apr 25
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +14,8 @@ setlocal indentexpr=GetTFIndent()
setlocal indentkeys-=0{,0} indentkeys-=0# indentkeys-=:
setlocal indentkeys+==/endif,=/then,=/else,=/done,0;
+let b:undo_indent = "setlocal indentexpr< indentkeys<"
+
" Only define the function once:
if exists("*GetTFIndent")
finish
diff --git a/runtime/indent/tilde.vim b/runtime/indent/tilde.vim
index e722a0994c..8658035f72 100644
--- a/runtime/indent/tilde.vim
+++ b/runtime/indent/tilde.vim
@@ -1,7 +1,8 @@
"Description: Indent scheme for the tilde weblanguage
-"Author: Tobias Rundström <tobi@tobi.nu>
+"Author: Tobias Rundström <tobi@tobi.nu> (Invalid email address)
"URL: http://tilde.tildesoftware.net
"Last Change: May 8 09:15:09 CEST 2002
+" 2022 April: b:undo_indent added by Doug Kearns
if exists ("b:did_indent")
finish
@@ -13,6 +14,8 @@ setlocal autoindent
setlocal indentexpr=GetTildeIndent(v:lnum)
setlocal indentkeys=o,O,)
+let b:undo_indent = "setl ai< inde< indk<"
+
if exists("*GetTildeIndent")
finish
endif
diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim
index 42ec1c8ad9..6c39c69687 100644
--- a/runtime/indent/treetop.vim
+++ b/runtime/indent/treetop.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: Treetop
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2011-03-14
+" Language: Treetop
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetTreetopIndent()
setlocal indentkeys=0{,0},!^F,o,O,=end
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetTreetopIndent")
finish
endif
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 7c03ff2873..8076b2df07 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Nov 27
+" Last Change: 2022 Jun 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -10,7 +10,7 @@ endif
let b:did_indent = 1
setlocal indentexpr=GetVimIndent()
-setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\
+setlocal indentkeys+==endif,=enddef,=endfu,=endfor,=endwh,=endtry,=},=else,=cat,=finall,=END,0\\,0=\"\\\
setlocal indentkeys-=0#
setlocal indentkeys-=:
@@ -36,6 +36,14 @@ endfunc
let s:lineContPat = '^\s*\(\\\|"\\ \)'
function GetVimIndentIntern()
+ " If the current line has line continuation and the previous one too, use
+ " the same indent. This does not skip empty lines.
+ let cur_text = getline(v:lnum)
+ let cur_has_linecont = cur_text =~ s:lineContPat
+ if cur_has_linecont && v:lnum > 1 && getline(v:lnum - 1) =~ s:lineContPat
+ return indent(v:lnum - 1)
+ endif
+
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -44,8 +52,7 @@ function GetVimIndentIntern()
" If the current line doesn't start with '\' or '"\ ' and below a line that
" starts with '\' or '"\ ', use the indent of the line above it.
- let cur_text = getline(v:lnum)
- if cur_text !~ s:lineContPat
+ if !cur_has_linecont
while lnum > 0 && getline(lnum) =~ s:lineContPat
let lnum = lnum - 1
endwhile
@@ -103,10 +110,11 @@ function GetVimIndentIntern()
" A line starting with :au does not increment/decrement indent.
" A { may start a block or a dict. Assume that when a } follows it's a
" terminated dict.
+ " ":function" starts a block but "function(" doesn't.
if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}'
- let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
+ let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|def\|el\%[seif]\)\>\|fu\%[nction][! ]\)')
if i >= 0
- let ind += shiftwidth()
+ let ind += shiftwidth()
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
\ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\|PatSep\)$'
let ind -= shiftwidth()
@@ -170,10 +178,15 @@ function GetVimIndentIntern()
let ind = ind + shiftwidth()
endif
- " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
- " :endfun, :else and :augroup END.
- if cur_text =~ '^\s*\(ene\@!\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
+ " Subtract a 'shiftwidth' on a :endif, :endwhile, :endfor, :catch, :finally,
+ " :endtry, :endfun, :enddef, :else and :augroup END.
+ " Although ":en" would be enough only match short command names as in
+ " 'indentkeys'.
+ if cur_text =~ '^\s*\(endif\|endwh\|endfor\|endtry\|endfu\|enddef\|cat\|finall\|else\|aug\%[roup]\s\+[eE][nN][dD]\)'
let ind = ind - shiftwidth()
+ if ind < 0
+ let ind = 0
+ endif
endif
return ind
diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim
index 5a8bc0fec1..834eb00b25 100644
--- a/runtime/indent/xf86conf.vim
+++ b/runtime/indent/xf86conf.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: XFree86 Configuration File
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: XFree86 Configuration File
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetXF86ConfIndent()
setlocal indentkeys=!^F,o,O,=End
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetXF86ConfIndent")
finish
endif
diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim
index 977ee3d33b..21000b7bc4 100644
--- a/runtime/indent/xinetd.vim
+++ b/runtime/indent/xinetd.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: xinetd.conf(5) configuration file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: xinetd.conf(5) configuration file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
if exists("b:did_indent")
finish
@@ -12,6 +13,8 @@ setlocal indentexpr=GetXinetdIndent()
setlocal indentkeys=0{,0},!^F,o,O
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
if exists("*GetXinetdIndent")
finish
endif
diff --git a/runtime/indent/yacc.vim b/runtime/indent/yacc.vim
index 01ad4fc56d..253ccc5371 100644
--- a/runtime/indent/yacc.vim
+++ b/runtime/indent/yacc.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: YACC input file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2006-12-20
+" Language: YACC input file
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Last Change: 2022 April 25
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -14,6 +15,8 @@ setlocal indentexpr=GetYaccIndent()
setlocal indentkeys=!^F,o,O
setlocal nosmartindent
+let b:undo_indent = "setl inde< indk< si<"
+
" Only define the function once.
if exists("*GetYaccIndent")
finish
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index ed57e68d8b..d732c37c05 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -2,7 +2,7 @@
" Language: YAML
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Update: Lukas Reineke
-" Last Change: 2021 Aug 13
+" Last Change: 2022 Jun 17
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -44,30 +44,30 @@ function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex)
return plilnum
endfunction
-let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''.
- \ '|\"%([^"\\]|\\.)*\"'.
+let s:mapkeyregex = '\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\''' ..
+ \ '|\"%([^"\\]|\\.)*\"' ..
\ '|%(%(\:\ )@!.)*)\:%(\ |$)'
-let s:liststartregex='\v^\s*%(\-%(\ |$))'
+let s:liststartregex = '\v^\s*%(\-%(\ |$))'
let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)'
-let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
-let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name
+let s:c_ns_anchor_name = s:c_ns_anchor_char .. '+'
+let s:c_ns_anchor_property = '\v\&' .. s:c_ns_anchor_name
let s:ns_word_char = '\v[[:alnum:]_\-]'
-let s:ns_tag_char = '\v%('.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
-let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!'
+let s:ns_tag_char = '\v%(%\x\x|' .. s:ns_word_char .. '|[#/;?:@&=+$.~*''()])'
+let s:c_named_tag_handle = '\v\!' .. s:ns_word_char .. '+\!'
let s:c_secondary_tag_handle = '\v\!\!'
let s:c_primary_tag_handle = '\v\!'
-let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
- \ '|'.s:c_secondary_tag_handle.
- \ '|'.s:c_primary_tag_handle.')'
-let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
+let s:c_tag_handle = '\v%(' .. s:c_named_tag_handle.
+ \ '|' .. s:c_secondary_tag_handle.
+ \ '|' .. s:c_primary_tag_handle .. ')'
+let s:c_ns_shorthand_tag = '\v' .. s:c_tag_handle .. s:ns_tag_char .. '+'
let s:c_non_specific_tag = '\v\!'
-let s:ns_uri_char = '\v%('.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
-let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
-let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
- \ '\v|'.s:c_ns_shorthand_tag.
- \ '\v|'.s:c_non_specific_tag
+let s:ns_uri_char = '\v%(%\x\x|' .. s:ns_word_char .. '\v|[#/;?:@&=+$,.!~*''()[\]])'
+let s:c_verbatim_tag = '\v\!\<' .. s:ns_uri_char.. '+\>'
+let s:c_ns_tag_property = '\v' .. s:c_verbatim_tag.
+ \ '\v|' .. s:c_ns_shorthand_tag.
+ \ '\v|' .. s:c_non_specific_tag
let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?'
@@ -142,9 +142,9 @@ function GetYAMLIndent(lnum)
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property.
- \ '\v|'.s:c_ns_anchor_property.
- \ '\v|'.s:block_scalar_header.
+ elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
+ \ '\v|' .. s:c_ns_anchor_property ..
+ \ '\v|' .. s:block_scalar_header ..
\ '\v)%(\s+|\s*%(\#.*)?$))*'
" Mapping with: value
" that is multiline scalar