From ee26b227e15abc263195d4c746d5dba9f0e6dec4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 21 Feb 2023 23:50:29 +0800 Subject: vim-patch:partial:938ae280c79b (#22356) Update runtime files. https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a Partially skip autocmd.txt: needs patch 8.2.5011. Partially skip builtin.txt: needs patch 9.0.0411. Partially skip eval.txt: needs patch 8.2.3783. Cherry-pick :map-meta-keys from patch 9.0.1276. Co-authored-by: Bram Moolenaar --- runtime/indent/fish.vim | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 runtime/indent/fish.vim (limited to 'runtime/indent') diff --git a/runtime/indent/fish.vim b/runtime/indent/fish.vim new file mode 100644 index 0000000000..7455287ec0 --- /dev/null +++ b/runtime/indent/fish.vim @@ -0,0 +1,82 @@ +" Vim indent file +" Language: fish +" Maintainer: Nicholas Boyle (github.com/nickeb96) +" Repository: https://github.com/nickeb96/fish.vim +" Last Change: February 4, 2023 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetFishIndent(v:lnum) +setlocal indentkeys+==end,=else,=case + +function s:PrevCmdStart(linenum) + let l:linenum = a:linenum + " look for the first line that isn't a line continuation + while l:linenum > 1 && getline(l:linenum - 1) =~# '\\$' + let l:linenum = l:linenum - 1 + endwhile + return l:linenum +endfunction + +function GetFishIndent(lnum) + let l:shiftwidth = shiftwidth() + + let l:prevlnum = prevnonblank(a:lnum - 1) + if l:prevlnum ==# 0 + return 0 + endif + + " if the previous line ended with a line continuation + if getline(a:lnum - 1) =~# '\\$' + if a:lnum ==# 0 || getline(a:lnum - 2) !~# '\\$' + " this is the first line continuation in a chain, so indent it + return indent(a:lnum - 1) + l:shiftwidth + else + " use the same indentation as the previous continued line + return indent(a:lnum - 1) + endif + endif + + let l:prevlnum = s:PrevCmdStart(l:prevlnum) + + let l:prevline = getline(l:prevlnum) + if l:prevline =~# '^\s*\(begin\|if\|else\|while\|for\|function\|case\|switch\)\>' + let l:indent = l:shiftwidth + else + let l:indent = 0 + endif + + let l:line = getline(a:lnum) + if l:line =~# '^\s*end\>' + " find end's matching start + let l:depth = 1 + let l:currentlnum = a:lnum + while l:depth > 0 && l:currentlnum > 0 + let l:currentlnum = s:PrevCmdStart(prevnonblank(l:currentlnum - 1)) + let l:currentline = getline(l:currentlnum) + if l:currentline =~# '^\s*end\>' + let l:depth = l:depth + 1 + elseif l:currentline =~# '^\s*\(begin\|if\|while\|for\|function\|switch\)\>' + let l:depth = l:depth - 1 + endif + endwhile + if l:currentline =~# '^\s*switch\>' + return indent(l:currentlnum) + else + return indent(l:prevlnum) + l:indent - l:shiftwidth + endif + elseif l:line =~# '^\s*else\>' + return indent(l:prevlnum) + l:indent - l:shiftwidth + elseif l:line =~# '^\s*case\>' + if getline(l:prevlnum) =~# '^\s*switch\>' + return indent(l:prevlnum) + l:indent + else + return indent(l:prevlnum) + l:indent - l:shiftwidth + endif + else + return indent(l:prevlnum) + l:indent + endif +endfunction -- cgit From 66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Feb 2023 09:34:27 +0100 Subject: vim-patch:partial:dd60c365cd26 (#22437) vim-patch:partial:dd60c365cd26 Update runtime files https://github.com/vim/vim/commit/dd60c365cd2630794be84d63c4fe287124a30b97 Co-authored-by: Bram Moolenaar Skip: eval.txt, repeat.txt (needs `getscriptinfo()`) --- runtime/indent/quarto.vim | 1 + runtime/indent/r.vim | 14 +++++++++----- runtime/indent/rhelp.vim | 4 +++- runtime/indent/rmd.vim | 6 +++++- runtime/indent/rnoweb.vim | 4 +++- runtime/indent/rrst.vim | 4 +++- 6 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 runtime/indent/quarto.vim (limited to 'runtime/indent') diff --git a/runtime/indent/quarto.vim b/runtime/indent/quarto.vim new file mode 100644 index 0000000000..586d232d2b --- /dev/null +++ b/runtime/indent/quarto.vim @@ -0,0 +1 @@ +runtime indent/rmd.vim diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index ca85a2e62d..293dd98175 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -2,7 +2,7 @@ " Language: R " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Aug 19, 2018 09:13PM +" Last Change: Wed Oct 26, 2022 12:04PM " Only load this indent file when no other was loaded. @@ -14,6 +14,8 @@ let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRIndent() +let b:undo_indent = "setl inde< indk<" + " Only define the function once. if exists("*GetRIndent") finish @@ -28,7 +30,7 @@ let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0) let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40) let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0) let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern', - \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$') + \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\||>\)\s*$') function s:RDelete_quotes(line) let i = 0 @@ -359,17 +361,19 @@ function GetRIndent() let olnum = s:Get_prev_line(lnum) let oline = getline(olnum) if olnum > 0 - if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 - if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) else return indent(lnum) + shiftwidth() endif else - if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) - shiftwidth() endif endif + elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + return indent(lnum) + shiftwidth() endif let post_fun = 0 diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index cf69ae3392..2b9d49b915 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:38PM +" Last Change: Feb 25, 2023 " Only load this indent file when no other was loaded. @@ -20,6 +20,8 @@ setlocal nolisp setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetCorrectRHelpIndent() +let b:undo_indent = "setl ai< cin< inde< indk< lisp< si<" + " Only define the functions once. if exists("*GetRHelpIndent") finish diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 8fd57257fa..a043b0c994 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -2,7 +2,7 @@ " Language: Rmd " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Mar 28, 2021 08:05PM +" Last Change: Wed Nov 09, 2022 09:44PM " Only load this indent file when no other was loaded. @@ -16,6 +16,8 @@ let b:did_indent = 1 setlocal indentkeys=0{,0},<:>,!^F,o,O,e setlocal indentexpr=GetRmdIndent() +let b:undo_indent = "setl inde< indk<" + if exists("*GetRmdIndent") finish endif @@ -47,6 +49,8 @@ function s:GetMdIndent() return indent(v:lnum - 1) + 2 elseif pline =~ '^\s*\d\+\.\s\+' return indent(v:lnum - 1) + 3 + elseif pline =~ '^\[\^\S\+\]: ' + return indent(v:lnum - 1) + shiftwidth() endif return indent(prevnonblank(v:lnum - 1)) endfunction diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index 73966868b8..33bc103d18 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -2,7 +2,7 @@ " Language: Rnoweb " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Fri Apr 15, 2016 10:58PM +" Last Change: Feb 25, 2023 " Only load this indent file when no other was loaded. @@ -29,6 +29,8 @@ let b:did_indent = 1 setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item setlocal indentexpr=GetRnowebIndent() +let b:undo_indent = "setl inde< indk<" + if exists("*GetRnowebIndent") finish endif diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim index f3ee53e7fb..585c5e6654 100644 --- a/runtime/indent/rrst.vim +++ b/runtime/indent/rrst.vim @@ -2,7 +2,7 @@ " Language: Rrst " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:38PM +" Last Change: Feb 25, 2023 " Only load this indent file when no other was loaded. @@ -16,6 +16,8 @@ let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRrstIndent() +let b:undo_indent = "setl inde< indk<" + if exists("*GetRrstIndent") finish endif -- cgit From e3f36377c156749bbdafc46d8a8cd017f378b4b5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 23 Apr 2023 15:22:55 +0200 Subject: vim-patch:71badf9547e8 (#23285) Update runtime files https://github.com/vim/vim/commit/71badf9547e8f89571b9a095183671cbb333d528 Co-authored-by: Bram Moolenaar --- runtime/indent/livebook.vim | 9 +++++++++ runtime/indent/r.vim | 10 +++++----- runtime/indent/rhelp.vim | 2 +- runtime/indent/rnoweb.vim | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 runtime/indent/livebook.vim (limited to 'runtime/indent') diff --git a/runtime/indent/livebook.vim b/runtime/indent/livebook.vim new file mode 100644 index 0000000000..6311050e0e --- /dev/null +++ b/runtime/indent/livebook.vim @@ -0,0 +1,9 @@ +" Placeholder livebook indent file. +" This simply uses the markdown indenting. + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +runtime! indent/markdown.vim diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 293dd98175..07dfd13881 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -2,7 +2,7 @@ " Language: R " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Oct 26, 2022 12:04PM +" Last Change: Mon Feb 27, 2023 07:16PM " Only load this indent file when no other was loaded. @@ -110,7 +110,7 @@ function s:RDelete_parens(line) return line1 endfunction -function! s:Get_paren_balance(line, o, c) +function s:Get_paren_balance(line, o, c) let line2 = substitute(a:line, a:o, "", "g") let openp = strlen(a:line) - strlen(line2) let line3 = substitute(line2, a:c, "", "g") @@ -118,7 +118,7 @@ function! s:Get_paren_balance(line, o, c) return openp - closep endfunction -function! s:Get_matching_brace(linenr, o, c, delbrace) +function s:Get_matching_brace(linenr, o, c, delbrace) let line = SanitizeRLine(getline(a:linenr)) if a:delbrace == 1 let line = substitute(line, '{$', "", "") @@ -134,7 +134,7 @@ endfunction " This function is buggy because there 'if's without 'else' " It must be rewritten relying more on indentation -function! s:Get_matching_if(linenr, delif) +function s:Get_matching_if(linenr, delif) let line = SanitizeRLine(getline(a:linenr)) if a:delif let line = substitute(line, "if", "", "g") @@ -162,7 +162,7 @@ function! s:Get_matching_if(linenr, delif) endif endfunction -function! s:Get_last_paren_idx(line, o, c, pb) +function s:Get_last_paren_idx(line, o, c, pb) let blc = a:pb let line = substitute(a:line, '\t', s:curtabstop, "g") let theidx = -1 diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index 2b9d49b915..334802ab78 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Feb 25, 2023 +" Last Change: Mon Feb 27, 2023 07:01PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index 33bc103d18..668cdb7ddd 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -2,7 +2,7 @@ " Language: Rnoweb " Author: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Feb 25, 2023 +" Last Change: Mon Feb 27, 2023 07:17PM " Only load this indent file when no other was loaded. @@ -11,7 +11,7 @@ if exists("b:did_indent") endif runtime indent/tex.vim -function! s:NoTeXIndent() +function s:NoTeXIndent() return indent(line(".")) endfunction -- cgit From c11986ed1a816d7ebcb5a5f707e3ef884f278293 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 15 May 2023 09:38:32 +0200 Subject: vim-patch:b7398fe41c9e (#23627) Update runtime files https://github.com/vim/vim/commit/b7398fe41c9e1e731d058105a34158871ee83e3f Co-authored-by: Bram Moolenaar --- runtime/indent/dts.vim | 63 +++++++++++++++++++++++++++++++++++++++++++ runtime/indent/luau.vim | 14 ++++++++++ runtime/indent/testdir/dts.in | 46 +++++++++++++++++++++++++++++++ runtime/indent/testdir/dts.ok | 46 +++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 runtime/indent/dts.vim create mode 100644 runtime/indent/luau.vim create mode 100644 runtime/indent/testdir/dts.in create mode 100644 runtime/indent/testdir/dts.ok (limited to 'runtime/indent') diff --git a/runtime/indent/dts.vim b/runtime/indent/dts.vim new file mode 100644 index 0000000000..e87f8153c7 --- /dev/null +++ b/runtime/indent/dts.vim @@ -0,0 +1,63 @@ +" Vim indent file +" Language: Device Tree +" Maintainer: Roland Hieber, Pengutronix +" +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent +setlocal nosmartindent +setlocal indentkeys=o,O,0},0<>>,! +setlocal indentexpr=GetDTSIndent() +setlocal nolisp + +let b:undo_indent = 'setl autoindent< smartindent< indentkeys< indentexpr< lisp<' + +function GetDTSIndent() + let sw = shiftwidth() + let lnum = v:lnum + let line = getline(lnum) + let prevline = getline(prevnonblank(lnum-1)) + let prevind = indent(prevnonblank(lnum-1)) + + if prevnonblank(lnum-1) < 1 + return 0 + endif + + " Don't indent header and preprocessor directives + if line =~ '^\s*\(/dts-\|#\(include\|define\|undef\|warn\(ing\)\?\|error\|if\(n\?def\)\?\|else\|elif\|endif\)\)' + return 0 + + " Don't indent /node and &label blocks + elseif line =~ '^\s*[/&].\+{\s*$' + return 0 + + " Indent to matching bracket or remove one shiftwidth if line begins with } or > + elseif line =~ '^\s*[}>]' + " set cursor to closing bracket on current line + let col = matchend(line, '^\s*[>}]') + call cursor(lnum, col) + + " determine bracket type, {} or <> + let pair = strpart('{}<>', stridx('}>', line[col-1]) * 2, 2) + + " find matching bracket pair + let pairline = searchpair(pair[0], '', pair[1], 'bW') + + if pairline > 0 + return indent(pairline) + else + return prevind - sw + endif + + " else, add one level of indent if line ends in { or < or = or , + elseif prevline =~ '[{<=,]$' + return prevind + sw + + else + return prevind + endif + +endfunction diff --git a/runtime/indent/luau.vim b/runtime/indent/luau.vim new file mode 100644 index 0000000000..69893f7399 --- /dev/null +++ b/runtime/indent/luau.vim @@ -0,0 +1,14 @@ +" Vim filetype indent file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +" Luau is a superset of Lua +runtime! indent/lua.vim + + diff --git a/runtime/indent/testdir/dts.in b/runtime/indent/testdir/dts.in new file mode 100644 index 0000000000..64e56e9017 --- /dev/null +++ b/runtime/indent/testdir/dts.in @@ -0,0 +1,46 @@ +/* vim: set ft=dts noet sw=8 : */ + +/* START_INDENT */ +/dts-v1/; +#include + #include "imx6qdl.dtsi" +#include "imx6qdl-someboard.dtsi" + + /delete-node/ &{/memory@10000000}; + + / { +compatible = "some,board"; +/delete-node/ memory; + + chosen { +environment = &{usdhc4/partitions/partition@0}; +}; +} + + &iomuxc { +pinctrl-names = "default"; +pinctrl-0 = <&pinctrl_hog>; + +pinctrl_gpiohog: gpiohoggrp { +fsl,pins = < +MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x130b0 +MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x130b0 +>; +}; +} + +&usdhc4 { +partitions { +compatible = "fixed-partitions"; + +partition@0 { +label = "environment"; +reg = <0x0 0xe0000>; +}; +}; +}; + +&{/aliases} { +usb0 = &usb; +}; +/* END_INDENT */ diff --git a/runtime/indent/testdir/dts.ok b/runtime/indent/testdir/dts.ok new file mode 100644 index 0000000000..d249766fd4 --- /dev/null +++ b/runtime/indent/testdir/dts.ok @@ -0,0 +1,46 @@ +/* vim: set ft=dts noet sw=8 : */ + +/* START_INDENT */ +/dts-v1/; +#include +#include "imx6qdl.dtsi" +#include "imx6qdl-someboard.dtsi" + +/delete-node/ &{/memory@10000000}; + +/ { + compatible = "some,board"; + /delete-node/ memory; + + chosen { + environment = &{usdhc4/partitions/partition@0}; + }; +} + +&iomuxc { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_hog>; + + pinctrl_gpiohog: gpiohoggrp { + fsl,pins = < + MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x130b0 + MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x130b0 + >; + }; +} + +&usdhc4 { + partitions { + compatible = "fixed-partitions"; + + partition@0 { + label = "environment"; + reg = <0x0 0xe0000>; + }; + }; +}; + +&{/aliases} { + usb0 = &usb; +}; +/* END_INDENT */ -- cgit From a24dd0392bc4e00b1cb2a1b9efe62045924489ae Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 26 May 2023 22:13:42 +0800 Subject: vim-patch:9.0.1580: CI: indent test hangs on FreeBSD (#23768) Problem: CI: indent test hangs on FreeBSD. Solution: Set 'nomore' when running the indent tests. (Ozaki Kiichi, closes vim/vim#12446) https://github.com/vim/vim/commit/9f3afe7a70d50447424b8d7404aae0d641cd827c Co-authored-by: ichizok --- runtime/indent/testdir/runtest.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/indent') diff --git a/runtime/indent/testdir/runtest.vim b/runtime/indent/testdir/runtest.vim index fa4e16e381..882a140a8d 100644 --- a/runtime/indent/testdir/runtest.vim +++ b/runtime/indent/testdir/runtest.vim @@ -12,6 +12,7 @@ set nowrapscan set report=9999 set modeline set debug=throw +set nomore au! SwapExists * call HandleSwapExists() func HandleSwapExists() -- cgit From 3d948a4dc4b2cd3c8d3ac497caf3dfe25adfb90d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 10 Aug 2023 17:45:36 +0800 Subject: vim-patch:9.0.1683: Updated runtime files (#24638) This is a collection of various PRs from github that all require a minor patch number: 1) https://github.com/vim/vim/pull/12612 Do not conflate dictionary key with end of block 2) https://github.com/vim/vim/pull/12729: When saving and restoring 'undolevels', the constructs `&undolevels` and `:set undolevels` are problematic. The construct `&undolevels` reads an unpredictable value; it will be the local option value (if one has been set), or the global option value (otherwise), making it unsuitable for saving a value for later restoration. Similarly, if a local option value has been set for 'undolevels', temporarily modifying the option via `:set undolevels` changes the local value as well as the global value, requiring extra work to restore both values. Saving and restoring the option value in one step via the construct `:let &undolevels = &undolevels` appears to make no changes to the 'undolevels' option, but if a local option has been set to a different value than the global option, it has the unintended effect of changing the global 'undolevels' value to the local value. Update the documentation to explain these issues and recommend explicit use of global and local option values when saving and restoring. Update some unit tests to use `g:undolevels`. 3) https://github.com/vim/vim/pull/12702: Problem: Pip requirements files are not recognized. Solution: Add a pattern to match pip requirements files. 4) https://github.com/vim/vim/pull/12688: Add indent file and tests for ABB Rapid 5) https://github.com/vim/vim/pull/12668: Use Lua 5.1 numeric escapes in tests and add to CI Only Lua 5.2+ and LuaJIT understand hexadecimal escapes in strings. Lua 5.1 only supports decimal escapes: > A character in a string can also be specified by its numerical value > using the escape sequence \ddd, where ddd is a sequence of up to three > decimal digits. (Note that if a numerical escape is to be followed by a > digit, it must be expressed using exactly three digits.) Strings in Lua > can contain any 8-bit value, including embedded zeros, which can be > specified as '\0'. To make sure this works with Lua 5.4 and Lua 5.1 change the Vim CI to run with Lua 5.1 as well as Lua 5.4 6) https://github.com/vim/vim/pull/12631: Add hurl filetype detection 7) https://github.com/vim/vim/pull/12573: Problem: Files for haskell persistent library are not recognized Solution: Add pattern persistentmodels for haskell persistent library closes: vim/vim#12612 closes: vim/vim#12729 closes: vim/vim#12702 closes: vim/vim#12688 closes: vim/vim#12668 closes: vim/vim#12631 closes: vim/vim#12573 Already ported but wasn't marked: vim-patch:ad34abee2583 https://github.com/vim/vim/commit/6efb1980336ff324e9c57a4e282530b952fca816 Co-authored-by: Christian Brabandt Co-authored-by: lacygoill Co-authored-by: Michael Henry Co-authored-by: ObserverOfTime Co-authored-by: KnoP-01 Co-authored-by: James McCoy Co-authored-by: Jacob Pfeifer Co-authored-by: Borys Lykah --- runtime/indent/rapid.vim | 255 ++++++++++++++++++++++++++++++++++++++ runtime/indent/testdir/rapid.in | 266 ++++++++++++++++++++++++++++++++++++++++ runtime/indent/testdir/rapid.ok | 266 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 787 insertions(+) create mode 100644 runtime/indent/rapid.vim create mode 100644 runtime/indent/testdir/rapid.in create mode 100644 runtime/indent/testdir/rapid.ok (limited to 'runtime/indent') diff --git a/runtime/indent/rapid.vim b/runtime/indent/rapid.vim new file mode 100644 index 0000000000..f97ebf84db --- /dev/null +++ b/runtime/indent/rapid.vim @@ -0,0 +1,255 @@ +" ABB Rapid Command indent file for Vim +" Language: ABB Rapid Command +" Maintainer: Patrick Meiser-Knosowski +" Version: 2.2.7 +" Last Change: 12. May 2023 +" Credits: Based on indent/vim.vim +" +" Suggestions of improvement are very welcome. Please email me! +" +" Known bugs: ../doc/rapid.txt +" +" TODO +" * indent wrapped lines which do not end with an ; or special key word, +" maybe this is a better idea, but then () and [] has to be changed as +" well +" + +if exists("g:rapidNoSpaceIndent") + if !exists("g:rapidSpaceIndent") + let g:rapidSpaceIndent = !g:rapidNoSpaceIndent + endif + unlet g:rapidNoSpaceIndent +endif + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") || get(g:,'rapidNoIndent',0) + finish +endif +let b:did_indent = 1 + +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentexpr=GetRapidIndent() +if get(g:,'rapidNewStyleIndent',0) + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,:,<[>,<]>,<(>,<)> +else + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,: +endif +let b:undo_indent="setlocal lisp< si< ai< inde< indk<" + +if get(g:,'rapidSpaceIndent',1) + " Use spaces for indention, 2 is enough. + " More or even tabs wastes space on the teach pendant. + setlocal softtabstop=2 + setlocal shiftwidth=2 + setlocal expandtab + setlocal shiftround + let b:undo_indent = b:undo_indent." sts< sw< et< sr<" +endif + +" Only define the function once. +if exists("*GetRapidIndent") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +function GetRapidIndent() + let ignorecase_save = &ignorecase + try + let &ignorecase = 0 + return s:GetRapidIndentIntern() + finally + let &ignorecase = ignorecase_save + endtry +endfunction + +function s:GetRapidIndentIntern() abort + + let l:currentLineNum = v:lnum + let l:currentLine = getline(l:currentLineNum) + + if l:currentLine =~ '^!' && !get(g:,'rapidCommentIndent',0) + " If current line is ! line comment, do not change 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 l:preNoneBlankLineNum = s:RapidPreNoneBlank(v:lnum - 1) + if l:preNoneBlankLineNum == 0 + " At the start of the file use zero indent. + return 0 + endif + + let l:preNoneBlankLine = getline(l:preNoneBlankLineNum) + let l:ind = indent(l:preNoneBlankLineNum) + + " Define add a 'shiftwidth' pattern + let l:addShiftwidthPattern = '\c\v^\s*(' + let l:addShiftwidthPattern .= '((local|task)\s+)?(module|record|proc|func|trap)\s+\k' + let l:addShiftwidthPattern .= '|(backward|error|undo)>' + let l:addShiftwidthPattern .= ')' + " + " Define Subtract 'shiftwidth' pattern + let l:subtractShiftwidthPattern = '\c\v^\s*(' + let l:subtractShiftwidthPattern .= 'end(module|record|proc|func|trap)>' + let l:subtractShiftwidthPattern .= '|(backward|error|undo)>' + let l:subtractShiftwidthPattern .= ')' + + " Add shiftwidth + if l:preNoneBlankLine =~ l:addShiftwidthPattern + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "then", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "do", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "default", 0)>=0 + let l:ind += &sw + endif + + " Subtract shiftwidth + if l:currentLine =~ l:subtractShiftwidthPattern + \|| s:RapidLenTilStr(l:currentLineNum, "endif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endfor", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endwhile", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endtest", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "elseif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0 + let l:ind = l:ind - &sw + endif + + " First case (or default) after a test gets the indent of the test. + if (s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 || s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0) && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>=0 + let l:ind += &sw + endif + + " continued lines with () or [] + let l:OpenSum = s:RapidLoneParen(l:preNoneBlankLineNum,"(") + s:RapidLoneParen(l:preNoneBlankLineNum,"[") + if get(g:,'rapidNewStyleIndent',0) + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:currentLineNum,"]") + else + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:preNoneBlankLineNum,"]") + endif + if l:OpenSum > l:CloseSum + let l:ind += (l:OpenSum * 4 * &sw) + elseif l:OpenSum < l:CloseSum + let l:ind -= (l:CloseSum * 4 * &sw) + endif + + return l:ind +endfunction + +" Returns the length of the line until a:str occur outside a string or +" comment. Search starts at string index a:startIdx. +" If a:str is a word also add word bounderies and case insesitivity. +" Note: rapidTodoComment and rapidDebugComment are not taken into account. +function s:RapidLenTilStr(lnum, str, startIdx) abort + + let l:line = getline(a:lnum) + let l:len = strlen(l:line) + let l:idx = a:startIdx + let l:str = a:str + if l:str =~ '^\k\+$' + let l:str = '\c\<' . l:str . '\>' + endif + + while l:len > l:idx + let l:idx = match(l:line, l:str, l:idx) + if l:idx < 0 + " a:str not found + return -1 + endif + let l:synName = synIDattr(synID(a:lnum,l:idx+1,0),"name") + if l:synName != "rapidString" + \&& l:synName != "rapidConcealableString" + \&& (l:synName != "rapidComment" || l:str =~ '^!') + " a:str found outside string or line comment + return l:idx + endif + " a:str is part of string or line comment + let l:idx += 1 " continue search for a:str + endwhile + + " a:str not found or l:len <= a:startIdx + return -1 +endfunction + +" a:lchar shoud be one of (, ), [, ], { or } +" returns the number of opening/closing parenthesise which have no +" closing/opening match in getline(a:lnum) +function s:RapidLoneParen(lnum,lchar) abort + if a:lchar == "(" || a:lchar == ")" + let l:opnParChar = "(" + let l:clsParChar = ")" + elseif a:lchar == "[" || a:lchar == "]" + let l:opnParChar = "[" + let l:clsParChar = "]" + elseif a:lchar == "{" || a:lchar == "}" + let l:opnParChar = "{" + let l:clsParChar = "}" + else + return 0 + endif + + let l:line = getline(a:lnum) + + " look for the first ! which is not part of a string + let l:len = s:RapidLenTilStr(a:lnum,"!",0) + if l:len == 0 + return 0 " first char is !; ignored + endif + + let l:opnParen = 0 + " count opening brakets + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:opnParChar, l:i) + if l:i >= 0 + let l:opnParen += 1 + let l:i += 1 + endif + endwhile + + let l:clsParen = 0 + " count closing brakets + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:clsParChar, l:i) + if l:i >= 0 + let l:clsParen += 1 + let l:i += 1 + endif + endwhile + + if (a:lchar == "(" || a:lchar == "[" || a:lchar == "{") && l:opnParen>l:clsParen + return (l:opnParen-l:clsParen) + elseif (a:lchar == ")" || a:lchar == "]" || a:lchar == "}") && l:clsParen>l:opnParen + return (l:clsParen-l:opnParen) + endif + + return 0 +endfunction + +" This function works almost like prevnonblank() but handles %%%-headers and +" comments like blank lines +function s:RapidPreNoneBlank(lnum) abort + + let nPreNoneBlank = prevnonblank(a:lnum) + + while nPreNoneBlank>0 && getline(nPreNoneBlank) =~ '\v\c^\s*(\%\%\%|!)' + " 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/testdir/rapid.in b/runtime/indent/testdir/rapid.in new file mode 100644 index 0000000000..515912ed89 --- /dev/null +++ b/runtime/indent/testdir/rapid.in @@ -0,0 +1,266 @@ +! vim: set ft=rapid : + +! START_INDENT + +%%% + VERSION:1 + LANGUAGE:ENGLISH +%%% + +module LowerCaseModule + +task pers num n1 := 0; +local pers num n2 := 1; +var bool b1 := false; +var intnum i1; + +! put some stuff in those strings that may confuse indentation +const string st1 := "endmodule ("; +pers string st_Appl_Info{3,3}:=[ +[ +"[" +, +"default" +, +"case" +], +[ +"else" +, +"then" +, +"endif" +], +[ +"do" +, +"}" +, +")" +], +]; + +pers tooldata tTool1:=[TRUE, +[ +[97.4, 0, 223.1], +[0.924, 0, 0.383 ,0] +], +[5, +[23, 0, 75], +[1, 0, 0, 0], 0, 0, 0 +] +]; +const robtarget p1:=[ +[600, 500, 225.3], +[1, 0, 0, 0], +[1, 1, 0, 0], +[ 11, 12.3, 9E9, 9E9, 9E9, 9E9] +]; + +record myRec +num nRecNum1 +bool bRecBool1 +endrecord + +proc proc1(num n1, +num n2) +var string st1; +n1 := n1+1; +MoveJSync p1, vmax, z30, tool1, "proc2"; +backward +MoveJSync p1, v100, fine, tool1, "proc2"; +undo +n1 := n1-1; +error +trynext; +endproc + +func num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +var num nVar; +if not Present(s1) return; +if Present(s1) then +Incr n1;' +elseif Present(s2) then +b1:=false; +else +while n1>0 do +Decr n1; +test n1 + +case 1: +test1; +case 2: +test2; +default: +WaitUntil false; +endtest +endwhile +endif +for i from 1 to 10 step 2 do +for j from 1 to 10 do +st_Appl_Info{i,j} := ""; +endfor +endfor +! return 1; +return 0; +error +return -1; +endfunc + +trap Trap1 +Reset do1; +endtrap + +endmodule + +MODULE UpperCaseModule(SYSMODULE,NOSTEPIN) +TASK pers num n1 := 0; +LOCAL pers num n2 := 1; +VAR bool b1 := false; +VAR intnum i1; + +LOCAL FUNC num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +VAR num nVar; +IF NOT PRESENT(s1) RETURN; +IF PRESENT(s1) THEN +INCR n1;' +ELSEIF PRESENT(s2) THEN +b1:=FALSE; +ELSE +WHILE n1>0 DO +DECR n1; +TEST n1 + +CASE 1: +test1; +CASE 2: +test2; +DEFAULT: +WAITUNTIL FALSE; +ENDTEST +ENDWHILE +ENDIF +FOR i FROM 1 TO 10 STEP 2 DO +FOR j FROM 1 TO 10 DO +st_Appl_Info{i,j} := ""; +ENDFOR +ENDFOR +! RETURN 1; +RETURN 0; +ERROR +RETURN -1; +ENDFUNC + +TRAP Trap1 +Reset do1; +ENDTRAP + +ENDMODULE + +Module MixedCaseModule(SysModule) +Task pers num n1 := 0; +Local pers num n2 := 1; +Var bool b1 := false; +Var intnum i1; + +Task Func num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +Var num nVar; +If Not Present(s1) Return; +If Present(s1) Then +Incr n1;' +ElseIf Present(s2) Then +b1:=false; +Else +While n1>0 Do +Decr n1; +Test n1 + +Case 1: +test1; +Case 2: +test2; +Default: +WaitUntil false; +EndTest +EndWhile +EndIf +For i From 1 To 10 Step 2 Do +For j From 1 To 10 Do +st_Appl_Info{i,j} := ""; +EndFor +EndFor +! Return 1; +Return 0; +Error +Return -1; +EndFunc + +Trap Trap1 +Reset do1; +EndTrap + +EndModule + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidSpaceIndent = 0 +! INDENT_EXE set shiftwidth=4 + +proc bla() +var num i; +Incr i; +endproc + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidCommentIndent = 1 +! +proc bla() +! indent this first column comment because of g:rapidCommentIndent=1 +endproc +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidNewStyleIndent = 1 +pers string st_Appl_Info{3,3}:= +[ +[ +"[" +, +"default" +, +"case" +] +, +[ +"else" +, +"then" +, +"endif" +] +, +[ +"do" +, +"}" +, +")" +] +, +]; +! END_INDENT diff --git a/runtime/indent/testdir/rapid.ok b/runtime/indent/testdir/rapid.ok new file mode 100644 index 0000000000..ce336821c4 --- /dev/null +++ b/runtime/indent/testdir/rapid.ok @@ -0,0 +1,266 @@ +! vim: set ft=rapid : + +! START_INDENT + +%%% +VERSION:1 +LANGUAGE:ENGLISH +%%% + +module LowerCaseModule + + task pers num n1 := 0; + local pers num n2 := 1; + var bool b1 := false; + var intnum i1; + +! put some stuff in those strings that may confuse indentation + const string st1 := "endmodule ("; + pers string st_Appl_Info{3,3}:=[ + [ + "[" + , + "default" + , + "case" + ], + [ + "else" + , + "then" + , + "endif" + ], + [ + "do" + , + "}" + , + ")" + ], + ]; + + pers tooldata tTool1:=[TRUE, + [ + [97.4, 0, 223.1], + [0.924, 0, 0.383 ,0] + ], + [5, + [23, 0, 75], + [1, 0, 0, 0], 0, 0, 0 + ] + ]; + const robtarget p1:=[ + [600, 500, 225.3], + [1, 0, 0, 0], + [1, 1, 0, 0], + [ 11, 12.3, 9E9, 9E9, 9E9, 9E9] + ]; + + record myRec + num nRecNum1 + bool bRecBool1 + endrecord + + proc proc1(num n1, + num n2) + var string st1; + n1 := n1+1; + MoveJSync p1, vmax, z30, tool1, "proc2"; + backward + MoveJSync p1, v100, fine, tool1, "proc2"; + undo + n1 := n1-1; + error + trynext; + endproc + + func num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + var num nVar; + if not Present(s1) return; + if Present(s1) then + Incr n1;' + elseif Present(s2) then + b1:=false; + else + while n1>0 do + Decr n1; + test n1 + + case 1: + test1; + case 2: + test2; + default: + WaitUntil false; + endtest + endwhile + endif + for i from 1 to 10 step 2 do + for j from 1 to 10 do + st_Appl_Info{i,j} := ""; + endfor + endfor +! return 1; + return 0; + error + return -1; + endfunc + + trap Trap1 + Reset do1; + endtrap + +endmodule + +MODULE UpperCaseModule(SYSMODULE,NOSTEPIN) + TASK pers num n1 := 0; + LOCAL pers num n2 := 1; + VAR bool b1 := false; + VAR intnum i1; + + LOCAL FUNC num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + VAR num nVar; + IF NOT PRESENT(s1) RETURN; + IF PRESENT(s1) THEN + INCR n1;' + ELSEIF PRESENT(s2) THEN + b1:=FALSE; + ELSE + WHILE n1>0 DO + DECR n1; + TEST n1 + + CASE 1: + test1; + CASE 2: + test2; + DEFAULT: + WAITUNTIL FALSE; + ENDTEST + ENDWHILE + ENDIF + FOR i FROM 1 TO 10 STEP 2 DO + FOR j FROM 1 TO 10 DO + st_Appl_Info{i,j} := ""; + ENDFOR + ENDFOR +! RETURN 1; + RETURN 0; + ERROR + RETURN -1; + ENDFUNC + + TRAP Trap1 + Reset do1; + ENDTRAP + +ENDMODULE + +Module MixedCaseModule(SysModule) + Task pers num n1 := 0; + Local pers num n2 := 1; + Var bool b1 := false; + Var intnum i1; + + Task Func num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + Var num nVar; + If Not Present(s1) Return; + If Present(s1) Then + Incr n1;' + ElseIf Present(s2) Then + b1:=false; + Else + While n1>0 Do + Decr n1; + Test n1 + + Case 1: + test1; + Case 2: + test2; + Default: + WaitUntil false; + EndTest + EndWhile + EndIf + For i From 1 To 10 Step 2 Do + For j From 1 To 10 Do + st_Appl_Info{i,j} := ""; + EndFor + EndFor +! Return 1; + Return 0; + Error + Return -1; + EndFunc + + Trap Trap1 + Reset do1; + EndTrap + +EndModule + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidSpaceIndent = 0 +! INDENT_EXE set shiftwidth=4 + +proc bla() + var num i; + Incr i; +endproc + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidCommentIndent = 1 +! +proc bla() + ! indent this first column comment because of g:rapidCommentIndent=1 +endproc +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidNewStyleIndent = 1 +pers string st_Appl_Info{3,3}:= +[ + [ + "[" + , + "default" + , + "case" + ] + , + [ + "else" + , + "then" + , + "endif" + ] + , + [ + "do" + , + "}" + , + ")" + ] + , +]; +! END_INDENT -- cgit From cbf54ec2a5aaa1a00ff89e26bab44a30d09d4631 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 13 Aug 2023 13:25:10 +0100 Subject: vim-patch:e978b4534a5e (#24697) Farewell to Bram and dedicate upcoming Vim 9.1 to him (vim/vim#12749) https://github.com/vim/vim/commit/e978b4534a5e10471108259118c0ef791106fd92 Also update the header for the following files that were converted to Vim9 script upstream: - autoload/ccomplete.lua (vim9jitted) - ftplugin.vim - ftplugof.vim - indent.vim - indent/vim.vim - makemenu.vim This also updates the "Last Change" dates, even if some changes (due to rewrites to Vim9 script) were not ported. There's still a few other places where Bram is still mentioned as a maintainer in the files we and Vim have: - ftplugin/bash.vim - indent/bash.vim - indent/html.vim - indent/mail.vim - macros/accents.vim - macros/editexisting.vim - syntax/bash.vim - syntax/shared/typescriptcommon.vim - syntax/tar.vim - syntax/typescript.vim - syntax/typescriptreact.vim - syntax/zimbu.vim Maybe future patches will address that. Also exclude changes to .po files that didn't apply automatically (the `:messages` maintainer string isn't used in Nvim anyway). Co-authored-by: Christian Brabandt --- runtime/indent/README.txt | 6 +++--- runtime/indent/aap.vim | 5 +++-- runtime/indent/c.vim | 5 +++-- runtime/indent/cpp.vim | 5 +++-- runtime/indent/cuda.vim | 5 +++-- runtime/indent/python.vim | 7 ++++--- runtime/indent/vim.vim | 5 +++-- runtime/indent/xhtml.vim | 5 +++-- runtime/indent/zimbu.vim | 5 +++-- 9 files changed, 28 insertions(+), 20 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt index 649870636e..8628ecccb7 100644 --- a/runtime/indent/README.txt +++ b/runtime/indent/README.txt @@ -6,9 +6,9 @@ at ":help indent-expression". Looking at the existing files should give you inspiration. If you make a new indent file which would be useful for others, please send it -to Bram@vim.org. Include instructions for detecting the file type for this -language, by file name extension or by checking a few lines in the file. -And please stick to the rules below. +to the vim-dev mailing list . Include instructions for +detecting the file type for this language, by file name extension or by +checking a few lines in the file. And please stick to the rules below. If you have remarks about an existing file, send them to the maintainer of that file. Only when you get no response send a message to Bram@vim.org. diff --git a/runtime/indent/aap.vim b/runtime/indent/aap.vim index 35828b4c1a..23c104985e 100644 --- a/runtime/indent/aap.vim +++ b/runtime/indent/aap.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Aap recipe -" Maintainer: Bram Moolenaar -" Last Change: 2005 Jun 24 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/c.vim b/runtime/indent/c.vim index e224382f63..7f285e1b98 100644 --- a/runtime/indent/c.vim +++ b/runtime/indent/c.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: C -" Maintainer: Bram Moolenaar -" Last Change: 2005 Mar 27 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/cpp.vim b/runtime/indent/cpp.vim index ffa37d7208..bb4dfd185e 100644 --- a/runtime/indent/cpp.vim +++ b/runtime/indent/cpp.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: C++ -" Maintainer: Bram Moolenaar -" Last Change: 2008 Nov 29 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/cuda.vim b/runtime/indent/cuda.vim index 68ee9cec0c..5980ddda44 100644 --- a/runtime/indent/cuda.vim +++ b/runtime/indent/cuda.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: CUDA -" Maintainer: Bram Moolenaar -" Last Change: 2008 Nov 29 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 8c3d0b0670..42ab4f3778 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -1,8 +1,9 @@ " Vim indent file -" Language: Python -" Maintainer: Bram Moolenaar +" Language: Python +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Original Author: David Bustos -" Last Change: 2021 Sep 26 " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 3beb70d255..b2fb57f51f 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Vim script -" Maintainer: Bram Moolenaar -" Last Change: 2022 Jun 24 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/xhtml.vim b/runtime/indent/xhtml.vim index 2197b7901c..e5c9cc307f 100644 --- a/runtime/indent/xhtml.vim +++ b/runtime/indent/xhtml.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: XHTML -" Maintainer: Bram Moolenaar (for now) -" Last Change: 2005 Jun 24 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/zimbu.vim b/runtime/indent/zimbu.vim index 0e6e2ab1d1..08369e42e5 100644 --- a/runtime/indent/zimbu.vim +++ b/runtime/indent/zimbu.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Zimbu -" Maintainer: Bram Moolenaar -" Last Change: 2021 Sep 26 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar " Only load this indent file when no other was loaded. if exists("b:did_indent") -- cgit From a5b6468e9bc19d3e01846c9a6a47a766b8b81a5a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 21 Aug 2023 09:46:44 +0900 Subject: vim-patch:9.0.1766: Runtime: Missing QML support Problem: Runtime: Missing QML support Solution: Add QML support to Vim closes: vim/vim#12810 https://github.com/vim/vim/commit/bedc69f9d67b117ab05aa735c701cd3899d1ae2d Co-authored-by: ChaseKnowlden --- runtime/indent/qml.vim | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 runtime/indent/qml.vim (limited to 'runtime/indent') diff --git a/runtime/indent/qml.vim b/runtime/indent/qml.vim new file mode 100644 index 0000000000..8c9fa91250 --- /dev/null +++ b/runtime/indent/qml.vim @@ -0,0 +1,59 @@ +" Vim indent file +" Language: QML +" Maintainer: Chase Knowlden +" Last Change: 2023 Aug 16 +" +" Improved JavaScript indent script. + +" Indent script in place for this already? +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 +let b:undo_indent = "setlocal indentexpr< indentkeys<" + +setlocal indentexpr=s:GetQmlIndent() +setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*,=*/ + +" Only define functions once per session +if exists("*s:GetQmlIndent") + finish +endif + +" Clean up a line of code by removing trailing '//' and '/* */' comments, and trimming +" whitespace +function! s:Trim(line) + return substitute(substitute(substitute(a:line, '// .*', '', ''), '/\* .* \*/', '', ''), '^\s*\|\s*$', '', 'g') +endfunction + +function! s:GetQmlIndent() + let num = v:lnum + let line = s:Trim(getline(num)) + + let pnum = prevnonblank(num - 1) + if pnum == 0 + return 0 + endif + let pline = s:Trim(getline(pnum)) + + let ind = indent(pnum) + + " bracket/brace/paren blocks + if pline =~ '[{[(]$' + let ind += &sw + endif + if line =~ '^[}\])]' + let ind -= &sw + endif + + " '/*' comments + if pline =~ '^/\*.*\*/' + " no indent for single-line form + elseif pline =~ '^/\*' + let ind += 1 + elseif pline =~ '^\*/' + let ind -= 1 + endif + + return ind +endfunction -- cgit From abc3721e4fce2ddacc7fc51f729637f87819efbd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 21 Aug 2023 09:51:47 +0900 Subject: vim-patch:478668013f06 runtime(rust): fix rust indent (vim/vim#12542) https://github.com/vim/vim/commit/478668013f060a75b8cd8cc6ca2cf2abb3bcc4a5 Co-authored-by: Raphael --- runtime/indent/rust.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'runtime/indent') diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim index d30629b64e..2b544f4a67 100644 --- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -132,6 +132,22 @@ function GetRustIndent(lnum) return indent(prevlinenum) + 6 endif + "match newline after struct with generic bound like + "struct SomeThing + "| <-- newline indent should same as prevline + if prevline[len(prevline) - 1] == ">" + \ && prevline =~# "\s*struct.*>$" + return indent(prevlinenum) + endif + + "match newline after where like: + "struct SomeThing + "where + " T: Display, + if prevline =~# '^\s*where$' + return indent(prevlinenum) + 4 + endif + if prevline[len(prevline) - 1] == "," \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' \ && prevline !~ '^\s*fn\s' -- cgit From 3f877657dd1be891bdf6b5fa79d92319b720426d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 21 Aug 2023 09:51:59 +0900 Subject: vim-patch:6633611f4280 runtime(lua): indent curly bracket followed by line comment (vim/vim#12306) fixes vim/vim#12305 https://github.com/vim/vim/commit/6633611f4280f33934c2ab9b6a3e84c04f054ad3 Co-authored-by: champignoom <66909116+champignoom@users.noreply.github.com> --- runtime/indent/lua.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/indent') diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 0d1f934a03..ff0f64be29 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -41,7 +41,7 @@ function! GetLuaIndent() let prevline = getline(prevlnum) let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)') if midx == -1 - let midx = match(prevline, '{\s*$') + let midx = match(prevline, '{\s*\%(--\%([^[].*\)\?\)\?$') if midx == -1 let midx = match(prevline, '\\s*\%(\k\|[.:]\)\{-}\s*(') endif -- cgit From c9764bf331b4238ea60af382b013e0d058318d58 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 21 Aug 2023 09:52:42 +0900 Subject: vim-patch:9fa35b1c38b8 runtime(lua): fix lua indentation of non-lowercase "keywords" (vim/vim#11759) https://github.com/vim/vim/commit/9fa35b1c38b84d95b5c8e083aa742e0e0490fa1f Co-authored-by: beardedsakimonkey <54521218+beardedsakimonkey@users.noreply.github.com> --- runtime/indent/lua.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'runtime/indent') diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index ff0f64be29..35b08d4037 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -27,6 +27,16 @@ if exists("*GetLuaIndent") endif function! GetLuaIndent() + let ignorecase_save = &ignorecase + try + let &ignorecase = 0 + return GetLuaIndentIntern() + finally + let &ignorecase = ignorecase_save + endtry +endfunction + +function! GetLuaIndentIntern() " Find a non-blank line above the current line. let prevlnum = prevnonblank(v:lnum - 1) -- cgit From a5565499c8ff49a13ea9aee3ccda62a9e19af97e Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 13 Aug 2023 17:00:03 +0100 Subject: vim-patch:1688938dd5ac runtime: Add a few more remarks about Bram and new runtime files https://github.com/vim/vim/commit/1688938dd5ac78ab67e54299b9d5b93499dba762 Co-authored-by: Christian Brabandt --- runtime/indent/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/indent') diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt index 8628ecccb7..5f56d56690 100644 --- a/runtime/indent/README.txt +++ b/runtime/indent/README.txt @@ -14,7 +14,7 @@ If you have remarks about an existing file, send them to the maintainer of that file. Only when you get no response send a message to Bram@vim.org. If you are the maintainer of an indent file and make improvements, e-mail the -new version to Bram@vim.org. +new version to the vim-dev mailing list: . Rules for making an indent file: -- cgit From 947e6d9346352096e04a419f603361d250a51149 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 13 Aug 2023 17:38:34 +0100 Subject: vim-patch:96d6c4aabed1 runtime: Remove Brams email in indent/README.txt https://github.com/vim/vim/commit/96d6c4aabed15266bc4acfa66f9b35c2820dfa59 Co-authored-by: Christian Brabandt --- runtime/indent/README.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/indent') diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt index 5f56d56690..05ab126c8c 100644 --- a/runtime/indent/README.txt +++ b/runtime/indent/README.txt @@ -11,7 +11,8 @@ detecting the file type for this language, by file name extension or by checking a few lines in the file. And please stick to the rules below. If you have remarks about an existing file, send them to the maintainer of -that file. Only when you get no response send a message to Bram@vim.org. +that file. Only when you get no response send a message to the vim-dev +mailing list: . If you are the maintainer of an indent file and make improvements, e-mail the new version to the vim-dev mailing list: . -- cgit From 23cc36bd99a4e16a0d9d24c7fca62554211a5b1d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Wed, 23 Aug 2023 20:31:48 +0100 Subject: vim-patch:e8d6f03f6a61 runtime: Remove Brams name from a few more runtime files (vim/vim#12780) syntax/model.vim: minor wording improvement https://github.com/vim/vim/commit/e8d6f03f6a61f60de6893253621d057f63dd6a23 Use the updated "Last Change" date for all. Co-authored-by: Christian Brabandt Co-authored-by: Adri Verhoef --- runtime/indent/bash.vim | 4 ++-- runtime/indent/html.vim | 4 ++-- runtime/indent/mail.vim | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/bash.vim b/runtime/indent/bash.vim index b91640687c..407081232c 100644 --- a/runtime/indent/bash.vim +++ b/runtime/indent/bash.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: bash -" Maintainer: Bram -" Last Change: 2019 Sep 27 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 13 " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 65e0ffc40c..2fa10cc91e 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -1,7 +1,7 @@ " Vim indent script for HTML -" Maintainer: Bram Moolenaar +" Maintainer: The Vim Project " Original Author: Andy Wokula -" Last Change: 2022 Jan 31 +" Last Change: 2023 Aug 13 " Version: 1.0 "{{{ " Description: HTML indent script with cached state for faster indenting on a " range of lines. diff --git a/runtime/indent/mail.vim b/runtime/indent/mail.vim index 22bb0f7e12..eec9b4e43d 100644 --- a/runtime/indent/mail.vim +++ b/runtime/indent/mail.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Mail -" Maintainer: Bram Moolenaar -" Last Change: 2021 Sep 26 +" Maintainer: The Vim Project +" Last Change: 2023 Aug 13 if exists("b:did_indent") finish -- cgit From 0b7e1730bcd4c6ec1b55d541bc612445a4ff0c65 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 23 Aug 2023 10:09:32 +0900 Subject: vim-patch:e34b51e95fd0 runtime(solidity): add new ftplugin (vim/vim#12877) Set undo_{ftplugin,indent} closes vim/vim#11240 https://github.com/vim/vim/commit/e34b51e95fd0ea7b0e34a625db0f9ed7e051e0dd Co-authored-by: dkearns Co-authored-by: cothi --- runtime/indent/solidity.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/solidity.vim b/runtime/indent/solidity.vim index caed726c0a..55a07c015a 100644 --- a/runtime/indent/solidity.vim +++ b/runtime/indent/solidity.vim @@ -1,9 +1,11 @@ " Vim indent file -" Language: Solidity -" Acknowledgement: Based off of vim-javascript -" Maintainer: Cothi (jiungdev@gmail.com) -" Original Author: tomlion (https://github.com/tomlion/vim-solidity) -" Last Changed: 2022 Sep 27 +" Language: Solidity +" Maintainer: Cothi (jiungdev@gmail.com) +" Original Author: tomlion (https://github.com/tomlion/vim-solidity) +" Last Change: 2022 Sep 27 +" 2023 Aug 22 Vim Project (undo_indent) +" +" Acknowledgement: Based off of vim-javascript " " 0. Initialization {{{1 " ================= @@ -20,6 +22,8 @@ setlocal nosmartindent setlocal indentexpr=GetSolidityIndent() setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e +let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<" + " Only define the function once. if exists("*GetSolidityIndent") finish -- cgit From 327e3fab9e66701334a55dd7893283acb85899a2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 24 Aug 2023 09:07:35 +0900 Subject: vim-patch:3fc7a7e44abd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime: Fix typos in various files closes: vim/vim#12836 https://github.com/vim/vim/commit/3fc7a7e44abda6505ccd39a6d067db6e5173cbf6 Co-authored-by: Viktor Szépe --- runtime/indent/nsis.vim | 2 +- runtime/indent/php.vim | 16 ++++++++-------- runtime/indent/rapid.vim | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/nsis.vim b/runtime/indent/nsis.vim index 5d3decca37..3731781201 100644 --- a/runtime/indent/nsis.vim +++ b/runtime/indent/nsis.vim @@ -15,7 +15,7 @@ setlocal nosmartindent setlocal noautoindent setlocal indentexpr=GetNsisIndent(v:lnum) setlocal indentkeys=!^F,o,O -setlocal indentkeys+==~${Else,=~${EndIf,=~${EndUnless,=~${AndIf,=~${AndUnless,=~${OrIf,=~${OrUnless,=~${Case,=~${Default,=~${EndSelect,=~${EndSwith,=~${Loop,=~${Next,=~${MementoSectionEnd,=~FunctionEnd,=~SectionEnd,=~SectionGroupEnd,=~PageExEnd,0=~!macroend,0=~!if,0=~!else,0=~!endif +setlocal indentkeys+==~${Else,=~${EndIf,=~${EndUnless,=~${AndIf,=~${AndUnless,=~${OrIf,=~${OrUnless,=~${Case,=~${Default,=~${EndSelect,=~${EndSwitch,=~${Loop,=~${Next,=~${MementoSectionEnd,=~FunctionEnd,=~SectionEnd,=~SectionGroupEnd,=~PageExEnd,0=~!macroend,0=~!if,0=~!else,0=~!endif let b:undo_indent = "setl ai< inde< indk< si<" diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 0e623689d5..6b3d700059 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -327,13 +327,13 @@ endfun function! FindArrowIndent (lnum) " {{{ - let parrentArrowPos = -1 + let parentArrowPos = -1 let cursorPos = -1 let lnum = a:lnum while lnum > 1 let last_line = getline(lnum) if last_line =~ '^\s*->' - let parrentArrowPos = indent(a:lnum) + let parentArrowPos = indent(a:lnum) break else @@ -355,28 +355,28 @@ function! FindArrowIndent (lnum) " {{{ else endif else - let parrentArrowPos = -1 + let parentArrowPos = -1 break end endif if cleanedLnum =~ '->' call cursor(lnum, cursorPos == -1 ? strwidth(cleanedLnum) : cursorPos) - let parrentArrowPos = searchpos('->', 'cWb', lnum)[1] - 1 + let parentArrowPos = searchpos('->', 'cWb', lnum)[1] - 1 break else - let parrentArrowPos = -1 + let parentArrowPos = -1 break endif endif endwhile - if parrentArrowPos == -1 - let parrentArrowPos = indent(lnum) + shiftwidth() + if parentArrowPos == -1 + let parentArrowPos = indent(lnum) + shiftwidth() end - return parrentArrowPos + return parentArrowPos endfun "}}} function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{ diff --git a/runtime/indent/rapid.vim b/runtime/indent/rapid.vim index f97ebf84db..2c99bb2491 100644 --- a/runtime/indent/rapid.vim +++ b/runtime/indent/rapid.vim @@ -146,7 +146,7 @@ endfunction " Returns the length of the line until a:str occur outside a string or " comment. Search starts at string index a:startIdx. -" If a:str is a word also add word bounderies and case insesitivity. +" If a:str is a word also add word boundaries and case insensitivity. " Note: rapidTodoComment and rapidDebugComment are not taken into account. function s:RapidLenTilStr(lnum, str, startIdx) abort @@ -179,8 +179,8 @@ function s:RapidLenTilStr(lnum, str, startIdx) abort return -1 endfunction -" a:lchar shoud be one of (, ), [, ], { or } -" returns the number of opening/closing parenthesise which have no +" a:lchar should be one of (, ), [, ], { or } +" returns the number of opening/closing parentheses which have no " closing/opening match in getline(a:lnum) function s:RapidLoneParen(lnum,lchar) abort if a:lchar == "(" || a:lchar == ")" @@ -205,7 +205,7 @@ function s:RapidLoneParen(lnum,lchar) abort endif let l:opnParen = 0 - " count opening brakets + " count opening brackets let l:i = 0 while l:i >= 0 let l:i = s:RapidLenTilStr(a:lnum, l:opnParChar, l:i) @@ -216,7 +216,7 @@ function s:RapidLoneParen(lnum,lchar) abort endwhile let l:clsParen = 0 - " count closing brakets + " count closing brackets let l:i = 0 while l:i >= 0 let l:i = s:RapidLenTilStr(a:lnum, l:clsParChar, l:i) @@ -242,7 +242,7 @@ function s:RapidPreNoneBlank(lnum) abort let nPreNoneBlank = prevnonblank(a:lnum) while nPreNoneBlank>0 && getline(nPreNoneBlank) =~ '\v\c^\s*(\%\%\%|!)' - " Previouse none blank line irrelevant. Look further aback. + " Previous none blank line irrelevant. Look further aback. let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1) endwhile -- cgit From ae7ab9015999ba417642a5e0c785709f104d75cf Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 29 Aug 2023 11:03:29 +0200 Subject: vim-patch:0382f05dbd65 runtime: Set b:undo_indent where missing (vim/vim#12944) https://github.com/vim/vim/commit/0382f05dbd659d8e39ee4e71c1e5062ac5c0a8fd Co-authored-by: dkearns --- runtime/indent/ch.vim | 3 +++ runtime/indent/dune.vim | 3 +++ runtime/indent/fish.vim | 3 +++ runtime/indent/go.vim | 3 +++ runtime/indent/hare.vim | 3 +++ runtime/indent/jsonc.vim | 3 +++ runtime/indent/julia.vim | 5 ++++- runtime/indent/logtalk.vim | 3 +++ runtime/indent/ocaml.vim | 5 ++++- runtime/indent/php.vim | 3 ++- runtime/indent/raku.vim | 3 +++ runtime/indent/rst.vim | 3 +++ runtime/indent/rust.vim | 3 +++ runtime/indent/scala.vim | 3 +++ runtime/indent/tex.vim | 4 +++- runtime/indent/typescript.vim | 3 +++ runtime/indent/verilog.vim | 3 +++ runtime/indent/vhdl.vim | 3 +++ 18 files changed, 55 insertions(+), 4 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/ch.vim b/runtime/indent/ch.vim index e1bd8a356c..11b1f67790 100644 --- a/runtime/indent/ch.vim +++ b/runtime/indent/ch.vim @@ -3,6 +3,7 @@ " Maintainer: SoftIntegration, Inc. " URL: http://www.softintegration.com/download/vim/indent/ch.vim " Last change: 2006 Apr 30 +" 2023 Aug 28 by Vim Project (undo_indent) " Created based on cpp.vim " " Ch is a C/C++ interpreter with many high level extensions @@ -16,3 +17,5 @@ let b:did_indent = 1 " Ch indenting is built-in, thus this is very simple setlocal cindent + +let b:undo_indent = "setlocal cindent<" diff --git a/runtime/indent/dune.vim b/runtime/indent/dune.vim index 0590d66d13..a9349e4e04 100644 --- a/runtime/indent/dune.vim +++ b/runtime/indent/dune.vim @@ -3,6 +3,7 @@ " Maintainers: Markus Mottl " URL: https://github.com/ocaml/vim-ocaml " Last Change: 2021 Jan 01 +" 2023 Aug 28 by Vim Project (undo_indent) if exists("b:did_indent") finish @@ -11,3 +12,5 @@ let b:did_indent = 1 " dune format-dune-file uses 1 space to indent setlocal softtabstop=1 shiftwidth=1 expandtab + +let b:undo_indent = "setl et< sts< sw<" diff --git a/runtime/indent/fish.vim b/runtime/indent/fish.vim index 7455287ec0..e7678cb7c8 100644 --- a/runtime/indent/fish.vim +++ b/runtime/indent/fish.vim @@ -3,6 +3,7 @@ " Maintainer: Nicholas Boyle (github.com/nickeb96) " Repository: https://github.com/nickeb96/fish.vim " Last Change: February 4, 2023 +" 2023 Aug 28 by Vim Project (undo_indent) if exists("b:did_indent") finish @@ -12,6 +13,8 @@ let b:did_indent = 1 setlocal indentexpr=GetFishIndent(v:lnum) setlocal indentkeys+==end,=else,=case +let b:undo_indent = "setlocal indentexpr< indentkeys<" + function s:PrevCmdStart(linenum) let l:linenum = a:linenum " look for the first line that isn't a line continuation diff --git a/runtime/indent/go.vim b/runtime/indent/go.vim index bf9ff75e6c..a9b1d8d19b 100644 --- a/runtime/indent/go.vim +++ b/runtime/indent/go.vim @@ -2,6 +2,7 @@ " Language: Go " Maintainer: David Barnett (https://github.com/google/vim-ft-go) " Last Change: 2017 Jun 13 +" 2023 Aug 28 by Vim Project (undo_indent) " " TODO: " - function invocations split across lines @@ -19,6 +20,8 @@ setlocal autoindent setlocal indentexpr=GoIndent(v:lnum) setlocal indentkeys+=<:>,0=},0=) +let b:undo_indent = "setl ai< inde< indk< lisp<" + if exists('*GoIndent') finish endif diff --git a/runtime/indent/hare.vim b/runtime/indent/hare.vim index bc4fea4e61..0a9d8dafd8 100644 --- a/runtime/indent/hare.vim +++ b/runtime/indent/hare.vim @@ -2,6 +2,7 @@ " Language: Hare " Maintainer: Amelia Clarke " Last Change: 2022 Sep 22 +" 2023 Aug 28 by Vim Project (undo_indent) if exists("b:did_indent") finish @@ -40,6 +41,8 @@ setlocal cinwords=if,else,for,switch,match setlocal indentexpr=GetHareIndent() +let b:undo_indent = "setl cin< cino< cinw< inde< indk<" + function! FloorCindent(lnum) return cindent(a:lnum) / shiftwidth() * shiftwidth() endfunction diff --git a/runtime/indent/jsonc.vim b/runtime/indent/jsonc.vim index bf8e501dd5..058634a6d2 100644 --- a/runtime/indent/jsonc.vim +++ b/runtime/indent/jsonc.vim @@ -4,6 +4,7 @@ " Acknowledgement: Based off of vim-json maintained by Eli Parra " https://github.com/elzr/vim-json " Last Change: 2021-07-01 +" 2023 Aug 28 by Vim Project (undo_indent) " 0. Initialization {{{1 " ================= @@ -20,6 +21,8 @@ setlocal nosmartindent setlocal indentexpr=GetJSONCIndent() setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e +let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<" + " Only define the function once. if exists("*GetJSONCIndent") finish diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim index 8e4c60322e..36f39f6652 100644 --- a/runtime/indent/julia.vim +++ b/runtime/indent/julia.vim @@ -3,7 +3,8 @@ " Maintainer: Carlo Baldassi " Homepage: https://github.com/JuliaEditorSupport/julia-vim " Last Change: 2022 Jun 14 -" Notes: originally based on Bram Molenaar's indent file for vim +" 2023 Aug 28 by Vim Project (undo_indent) +" Notes: originally based on Bram Moolenaar's indent file for vim " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -21,6 +22,8 @@ setlocal indentkeys-=0{ setlocal indentkeys-=0} setlocal nosmartindent +let b:undo_indent = "setl ai< inde< indk< si<" + " Only define the function once. if exists("*GetJuliaIndent") finish diff --git a/runtime/indent/logtalk.vim b/runtime/indent/logtalk.vim index 8e36f86115..f7a8b0387c 100644 --- a/runtime/indent/logtalk.vim +++ b/runtime/indent/logtalk.vim @@ -1,5 +1,6 @@ " Maintainer: Paulo Moura " Revised on: 2018.08.04 +" 2023 Aug 28 by Vim Project (undo_indent) " Language: Logtalk " This Logtalk indent file is a modified version of the Prolog @@ -16,6 +17,8 @@ setlocal indentexpr=GetLogtalkIndent() setlocal indentkeys-=:,0# setlocal indentkeys+=0%,-,0;,>,0) +let b:undo_indent = "setlocal indentexpr< indentkeys<" + " Only define the function once. if exists("*GetLogtalkIndent") finish diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim index 19c81f49c4..c9beb8be0b 100644 --- a/runtime/indent/ocaml.vim +++ b/runtime/indent/ocaml.vim @@ -4,7 +4,8 @@ " Mike Leary " Markus Mottl " URL: https://github.com/ocaml/vim-ocaml -" Last Change: 2017 Jun 13 +" Last Change: 2023 Aug 28 - Add undo_indent (Vim Project) +" 2017 Jun 13 " 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working " 2005 May 09 - Added an option to not indent OCaml-indents specially (MM) " 2013 June - commented textwidth (Marc Weber) @@ -24,6 +25,8 @@ setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception, setlocal nolisp setlocal nosmartindent +let b:undo_indent = "setl et< inde< indk< lisp< si<" + " At least Marc Weber and Markus Mottl do not like this: " setlocal textwidth=80 diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 6b3d700059..350accaa11 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -4,6 +4,7 @@ " URL: https://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm " Last Change: 2020 Mar 05 +" 2023 Aug 28 by Vim Project (undo_indent) " Version: 1.70 " " @@ -128,7 +129,7 @@ setlocal nolisp setlocal indentexpr=GetPhpIndent() setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*,=?>,= " Hinrik Örn Sigurðsson " @@ -47,6 +48,8 @@ if !b:indent_use_syntax setlocal indentkeys+=0=EO endif +let b:undo_indent = "setlocal indentexpr< indentkeys<" + let s:cpo_save = &cpo set cpo-=C diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim index a31ad8e080..e3c10865a6 100644 --- a/runtime/indent/rst.vim +++ b/runtime/indent/rst.vim @@ -4,6 +4,7 @@ " Maintainer: Marshall Ward " Previous Maintainer: Nikolai Weibull " Latest Revision: 2020-03-31 +" 2023 Aug 28 by Vim Project (undo_indent) if exists("b:did_indent") finish @@ -14,6 +15,8 @@ setlocal indentexpr=GetRSTIndent() setlocal indentkeys=!^F,o,O setlocal nosmartindent +let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<" + if exists("*GetRSTIndent") finish endif diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim index 2b544f4a67..b27d93c3a2 100644 --- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -2,6 +2,7 @@ " Language: Rust " Author: Chris Morgan " Last Change: 2017 Jun 13 +" 2023 Aug 28 by Vim Project (undo_indent) " For bugs, patches and license go to https://github.com/rust-lang/rust.vim " Only load this indent file when no other was loaded. @@ -24,6 +25,8 @@ setlocal indentkeys=0{,0},!^F,o,O,0[,0] setlocal indentexpr=GetRustIndent(v:lnum) +let b:undo_indent = "setlocal cindent< cinoptions< cinkeys< cinwords< lisp< autoindent< indentkeys< indentexpr<" + " Only define the function once. if exists("*GetRustIndent") finish diff --git a/runtime/indent/scala.vim b/runtime/indent/scala.vim index b5eba29543..c6aba4e388 100644 --- a/runtime/indent/scala.vim +++ b/runtime/indent/scala.vim @@ -4,6 +4,7 @@ " Modifications By: Derek Wyatt " URL: https://github.com/derekwyatt/vim-scala " Last Change: 2016 Aug 26 +" 2023 Aug 28 by Vim Project (undo_indent) if exists("b:did_indent") finish @@ -14,6 +15,8 @@ setlocal autoindent setlocal indentexpr=GetScalaIndent() setlocal indentkeys=0{,0},0),!^F,<>>,o,O,e,=case, +let b:undo_indent = "setl ai< inde< indk<" + if exists("*GetScalaIndent") finish endif diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index d356ba905b..68d13fb116 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -67,7 +67,8 @@ " 2020/04/26 by Yichao Zhou " (*) Fix a bug related to \[ & \]. Thanks Manuel Boni for " reporting. -" +" 2023/08/28 by Vim Project +" (*) Set b:undo_indent. " }}} " Document: {{{ @@ -167,6 +168,7 @@ setlocal indentexpr=GetTeXIndent() setlocal indentkeys& exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g') let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '') +let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys< smartindent<" " }}} function! GetTeXIndent() " {{{ diff --git a/runtime/indent/typescript.vim b/runtime/indent/typescript.vim index e899f83d0f..e26750b8aa 100644 --- a/runtime/indent/typescript.vim +++ b/runtime/indent/typescript.vim @@ -2,6 +2,7 @@ " Language: TypeScript " Maintainer: See https://github.com/HerringtonDarkholme/yats.vim " Last Change: 2019 Oct 18 +" 2023 Aug 28 by Vim Project (undo_indent) " Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org " 0. Initialization {{{1 @@ -20,6 +21,8 @@ setlocal indentexpr=GetTypescriptIndent() setlocal formatexpr=Fixedgq(v:lnum,v:count) setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e +let b:undo_indent = "setlocal formatexpr< indentexpr< indentkeys< smartindent<" + " Only define the function once. if exists("*GetTypescriptIndent") finish diff --git a/runtime/indent/verilog.vim b/runtime/indent/verilog.vim index e81197c3b4..377615c348 100644 --- a/runtime/indent/verilog.vim +++ b/runtime/indent/verilog.vim @@ -1,6 +1,7 @@ " Language: Verilog HDL " Maintainer: Chih-Tsun Huang " Last Change: 2017 Aug 25 by Chih-Tsun Huang +" 2023 Aug 28 by Vim Project (undo_indent) " URL: http://www.cs.nthu.edu.tw/~cthuang/vim/indent/verilog.vim " " Credits: @@ -28,6 +29,8 @@ setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify setlocal indentkeys+==endconfig,=endgenerate,=endprimitive,=endtable setlocal indentkeys+==`else,=`elsif,=`endif +let b:undo_indent = "setlocal indentexpr< indentkeys<" + " Only define the function once. if exists("*GetVerilogIndent") finish diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim index ad318066f4..b01d1156e9 100644 --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -3,6 +3,7 @@ " Maintainer: Gerald Lai " Version: 1.62 " Last Change: 2017 Oct 17 +" 2023 Aug 28 by Vim Project (undo_indent) " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -19,6 +20,8 @@ setlocal indentkeys+==~if,=~then,=~elsif,=~else setlocal indentkeys+==~case,=~loop,=~for,=~generate,=~record,=~units,=~process,=~block,=~function,=~component,=~procedure setlocal indentkeys+==~architecture,=~configuration,=~entity,=~package +let b:undo_indent = "setlocal indentexpr< indentkeys<" + " constants " not a comment let s:NC = '\%(--.*\)\@ Date: Sat, 2 Sep 2023 10:43:23 +0200 Subject: vim-patch:da16a1b471aa runtime(ruby): Update syntax, indent and ftplugin files While making changes to the ruby ftplugin, slightly change the exepath() conditional from patch 9.0.1833 and move it after the :cd invocation. closes: 12981 closes: 12994 https://github.com/vim/vim/commit/da16a1b471aa717f58909cc6531cb6dbbff14d22 Co-authored-by: Doug Kearns Co-authored-by: Tim Pope --- runtime/indent/ruby.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim index 6ce8529fd1..ea5a2a7494 100644 --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -4,7 +4,7 @@ " Previous Maintainer: Nikolai Weibull " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns -" Last Change: 2022 Mar 22 +" Last Change: 2022 Jun 30 " 0. Initialization {{{1 " ================= @@ -93,7 +93,7 @@ let s:ruby_indent_keywords = \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' " Def without an end clause: def method_call(...) = -let s:ruby_endless_def = '\ Date: Mon, 4 Sep 2023 23:17:59 +0200 Subject: vim-patch:3170342af304 runtime(php): Update the php indent script to the 1.75 (from 1.70) (vim/vim#13025) Changes: 1.75: - Fix 2072/PHP-Indenting-for-VImvim/vim#87: The indent optimization was causing wrong indentation of lines preceded by a line ending with '}' when preceded by non white characters. - Fix long standing non-reported regex escaping issue in cleaning end of line comments function. This should help fixing some other unreported issues when parts of codes are commented out at ends of lines... 1.74: - Fix 2072/PHP-Indenting-for-VImvim/vim#86: Add support for `match` expression. 1.73: - Fix 2072/PHP-Indenting-for-VImvim/vim#77 where multi line strings and true/false keywords at beginning of a line would cause indentation failures. 1.72: - Fix vim/vimvim/vim#5722 where it was reported that the option PHP_BracesAtCodeLevel had not been working for the last 6 years. 1.71: - Fix 2072/PHP-Indenting-for-VImvim/vim#75 where the indent script would hang on some multi-line quoted strings. https://github.com/vim/vim/commit/3170342af3049852afb2fbca85df37baf5fec82f Co-authored-by: John Wellesz --- runtime/indent/php.vim | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 350accaa11..377ffd5afb 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,9 +3,8 @@ " Author: John Wellesz " URL: https://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2020 Mar 05 -" 2023 Aug 28 by Vim Project (undo_indent) -" Version: 1.70 +" Last Change: 2023 August 18th +" Version: 1.75 " " " Type :help php-indent for available options @@ -143,10 +142,10 @@ if exists("*GetPhpIndent") endif -let s:endline = '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' +let s:endline = '\s*\%(//.*\|#\[\@!.*\|/\*.*\*/\s*\)\=$' let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' -let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\|end\%(if\|while\|for\|foreach\|switch\)\)' -let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|\%()\s*\)\=use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' +let s:notPhpHereDoc = '\<\%(break\|return\|continue\|exit\|die\|true\|false\|elseif\|else\|end\%(if\|while\|for\|foreach\|match\|switch\)\)\>' +let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|match\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|\%()\s*\)\=use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' let s:functionDeclPrefix = '\\%(\s\+&\='.s:PHP_validVariable.'\)\=\s*(' let s:functionDecl = s:functionDeclPrefix.'.*' let s:multilineFunctionDecl = s:functionDeclPrefix.s:endline @@ -157,7 +156,8 @@ let s:unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@\)'.s:endl let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)' let s:PHP_startindenttag = '\)\@!\|]*>\%(.*<\/script>\)\@!' -let s:structureHead = '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline . '\|\' +let s:matchStart = 'match\s*(\s*\$\?'.s:PHP_validVariable.'\s*)\s*{'. s:endline +let s:structureHead = '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline . '\|\\|' . s:matchStart let s:escapeDebugStops = 0 @@ -224,7 +224,7 @@ function! GetLastRealCodeLNum(startline) " {{{ while getline(lnum) !~? tofind && lnum > 1 let lnum = lnum - 1 endwhile - elseif lastline =~ '^\s*[''"`][;,]' || (lastline =~ '^[^''"`]*[''"`][;,]'.s:endline && IslinePHP(lnum, "") == "SpecStringEntrails") + elseif lastline =~ '^\s*[''"`][;,]'.s:endline || (lastline =~ '^[^''"`]*[''"`][;,]'.s:endline && IslinePHP(lnum, "") == "SpecStringEntrails") let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$\\|^[^\1]\\+[=([]\\s*[\1]', '') let trylnum = lnum @@ -267,7 +267,7 @@ function! Skippmatch2() let line = getline(".") - if line =~ "\\([\"']\\).*/\\*.*\\1" || line =~ '\%(//\|#\).*/\*' + if line =~ "\\([\"']\\).*/\\*.*\\1" || line =~ '\%(//\|#\[\@!\).*/\*' return 1 else return 0 @@ -323,7 +323,11 @@ function! BalanceDirection (str) endfun function! StripEndlineComments (line) - return substitute(a:line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') + + let cleaned = substitute(a:line,'\v(//|#\[\@!)((([^"'']*(["''])[^"'']*\5)+[^"'']*$)|([^"'']*$))','','') + if cleaned != a:line + endif + return cleaned endfun function! FindArrowIndent (lnum) " {{{ @@ -491,7 +495,7 @@ function! ResetPhpOptions() if ! b:optionsset && &filetype =~ "php" if b:PHP_autoformatcomment - setlocal comments=s1:/*,mb:*,ex:*/,://,:# + setlocal comments=s1:/*,mb:*,ex:*/,://,f:#[,:# setlocal formatoptions-=t setlocal formatoptions+=q @@ -507,7 +511,7 @@ endfunc call ResetPhpOptions() function! GetPhpIndentVersion() - return "1.70-bundle" + return "1.75" endfun function! GetPhpIndent() @@ -651,7 +655,7 @@ function! GetPhpIndent() let b:InPHPcode_and_script = 1 endif - elseif last_line =~ '^[^''"`]\+[''"`]$' && last_line !~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)' " a string identifier with nothing after it and no other string identifier before + elseif last_line =~ '^[^''"`]\+[''"`]$' && last_line !~ '^\s*\%(//\|#\[\@!\|/\*.*\*/\s*$\)' " a string identifier with nothing after it and no other string identifier before let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' @@ -675,7 +679,7 @@ function! GetPhpIndent() " Indent successive // or # comment the same way the first is {{{ let addSpecial = 0 - if cline =~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)' + if cline =~ '^\s*\%(//\|#\[\@!\|/\*.*\*/\s*$\)' let addSpecial = b:PHP_outdentSLComments if b:PHP_LastIndentedWasComment == 1 return indent(real_PHP_lastindented) @@ -716,7 +720,7 @@ function! GetPhpIndent() return 0 endif - if cline =~? '^\s*\a\w*;$\|^\a\w*$\|^\s*[''"`][;,]' && cline !~? s:notPhpHereDoc + if (cline =~? '^\s*\a\w*;$\|^\a\w*$' || (cline =~? '^\s*[''"`][;,]' && IslinePHP(v:lnum, '[;,]') !~? '^\(phpString[SD]\|phpBacktick\)') ) && cline !~? s:notPhpHereDoc return 0 endif " }}} @@ -739,6 +743,9 @@ function! GetPhpIndent() if cline =~ '^\s*}\%(}}\)\@!' let ind = indent(FindOpenBracket(v:lnum, 1)) let b:PHP_CurrentIndentLevel = b:PHP_default_indenting + if b:PHP_BracesAtCodeLevel + let ind = ind + shiftwidth() + endif return ind endif @@ -762,7 +769,7 @@ function! GetPhpIndent() if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase && last_line !~ '^\s*[''"`][;,]' if ind==b:PHP_default_indenting return b:PHP_default_indenting + addSpecial - elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline + elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)\|^\(\s*\S\+\s*\)\+}'.endline && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline return b:PHP_CurrentIndentLevel + addSpecial endif endif @@ -930,7 +937,7 @@ function! GetPhpIndent() let ind = ind + shiftwidth() - elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase + elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' && AntepenultimateLine !~? s:matchStart || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase let ind = ind + shiftwidth() endif -- cgit From 0bee75818e79a4a619c0248e17e98e985187732c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 8 Sep 2023 23:34:43 +0200 Subject: vim-patch:4e554d282c50 runtime(perl): Update ftplugin and indent files (vim/vim#13052) https://github.com/vim/vim/commit/4e554d282c50e428932df5fff9917f8a836f7782 Co-authored-by: dkearns --- runtime/indent/perl.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/indent') diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim index 4c91fa1b33..a97c34da53 100644 --- a/runtime/indent/perl.vim +++ b/runtime/indent/perl.vim @@ -4,7 +4,7 @@ " Homepage: https://github.com/vim-perl/vim-perl " Bugs/requests: https://github.com/vim-perl/vim-perl/issues " License: Vim License (see :help license) -" Last Change: 2021 Sep 24 +" Last Change: 2022 Jun 14 " Suggestions and improvements by : " Aaron J. Sherman (use syntax for hints) @@ -133,6 +133,7 @@ function! GetPerlIndent() \ || synid == "perlHereDoc" \ || synid == "perlBraces" \ || synid == "perlStatementIndirObj" + \ || synid == "perlSubDeclaration" \ || synid =~ "^perlFiledescStatement" \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' let brace = strpart(line, bracepos, 1) -- cgit From 2dd5e472df8ed448375910d61c050390f7f17f5f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 12 Sep 2023 22:30:02 +0200 Subject: vim-patch:fc93594d562d runtime(rust): sync rust runtime files with upstream (vim/vim#13075) https://github.com/vim/vim/commit/fc93594d562dbbd9da03c89754538f91efd0c7ca Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> --- runtime/indent/rust.vim | 432 +++++++++++++++++++++++++++--------------------- 1 file changed, 243 insertions(+), 189 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim index b27d93c3a2..7c055ec739 100644 --- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -1,27 +1,26 @@ " Vim indent file " Language: Rust " Author: Chris Morgan -" Last Change: 2017 Jun 13 -" 2023 Aug 28 by Vim Project (undo_indent) +" Last Change: 2023-09-11 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim " Only load this indent file when no other was loaded. if exists("b:did_indent") - finish + finish endif let b:did_indent = 1 setlocal cindent -setlocal cinoptions=L0,(0,Ws,J1,j1 -setlocal cinkeys=0{,0},!^F,o,O,0[,0] +setlocal cinoptions=L0,(s,Ws,J1,j1,m1 +setlocal cinkeys=0{,0},!^F,o,O,0[,0],0(,0) " Don't think cinwords will actually do anything at all... never mind -setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern +setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern,macro " Some preliminary settings setlocal nolisp " Make sure lisp indenting doesn't supersede us setlocal autoindent " indentexpr isn't much help otherwise " Also do indentkeys, otherwise # gets shoved to column 0 :-/ -setlocal indentkeys=0{,0},!^F,o,O,0[,0] +setlocal indentkeys=0{,0},!^F,o,O,0[,0],0(,0) setlocal indentexpr=GetRustIndent(v:lnum) @@ -29,204 +28,259 @@ let b:undo_indent = "setlocal cindent< cinoptions< cinkeys< cinwords< lisp< auto " Only define the function once. if exists("*GetRustIndent") - finish + finish endif +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim +" vint: +ProhibitAbbreviationOption " Come here when loading the script the first time. function! s:get_line_trimmed(lnum) - " Get the line and remove a trailing comment. - " Use syntax highlighting attributes when possible. - " NOTE: this is not accurate; /* */ or a line continuation could trick it - let line = getline(a:lnum) - let line_len = strlen(line) - 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(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo' - let min = 1 - let max = line_len - while min < max - let col = (min + max) / 2 - if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo' - let max = col - else - let min = col + 1 - endif - endwhile - let line = strpart(line, 0, min - 1) - endif - return substitute(line, "\s*$", "", "") - else - " Sorry, this is not complete, nor fully correct (e.g. string "//"). - " Such is life. - return substitute(line, "\s*//.*$", "", "") - endif + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + " NOTE: this is not accurate; /* */ or a line continuation could trick it + let line = getline(a:lnum) + let line_len = strlen(line) + 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(a:lnum, line_len, 1), "name") =~? 'Comment\|Todo' + let min = 1 + let max = line_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(a:lnum, col, 1), "name") =~? 'Comment\|Todo' + let max = col + else + let min = col + 1 + endif + endwhile + let line = strpart(line, 0, min - 1) + endif + return substitute(line, "\s*$", "", "") + else + " Sorry, this is not complete, nor fully correct (e.g. string "//"). + " Such is life. + return substitute(line, "\s*//.*$", "", "") + endif endfunction function! s:is_string_comment(lnum, col) - if has('syntax_items') - for id in synstack(a:lnum, a:col) - let synname = synIDattr(id, "name") - if synname == "rustString" || synname =~ "^rustComment" - return 1 - endif - endfor - else - " without syntax, let's not even try - return 0 - endif + if has('syntax_items') + for id in synstack(a:lnum, a:col) + let synname = synIDattr(id, "name") + if synname ==# "rustString" || synname =~# "^rustComment" + return 1 + endif + endfor + else + " without syntax, let's not even try + return 0 + endif endfunction +if exists('*shiftwidth') + function! s:shiftwidth() + return shiftwidth() + endfunc +else + function! s:shiftwidth() + return &shiftwidth + endfunc +endif + function GetRustIndent(lnum) + " Starting assumption: cindent (called at the end) will do it right + " normally. We just want to fix up a few cases. + + let line = getline(a:lnum) + + if has('syntax_items') + let synname = synIDattr(synID(a:lnum, 1, 1), "name") + if synname ==# "rustString" + " If the start of the line is in a string, don't change the indent + return -1 + elseif synname =~? '\(Comment\|Todo\)' + \ && line !~# '^\s*/\*' " not /* opening line + if synname =~? "CommentML" " multi-line + if line !~# '^\s*\*' && getline(a:lnum - 1) =~# '^\s*/\*' + " This is (hopefully) the line after a /*, and it has no + " leader, so the correct indentation is that of the + " previous line. + return GetRustIndent(a:lnum - 1) + endif + endif + " If it's in a comment, let cindent take care of it now. This is + " for cases like "/*" where the next line should start " * ", not + " "* " as the code below would otherwise cause for module scope + " Fun fact: " /*\n*\n*/" takes two calls to get right! + return cindent(a:lnum) + endif + endif + + " cindent gets second and subsequent match patterns/struct members wrong, + " as it treats the comma as indicating an unfinished statement:: + " + " match a { + " b => c, + " d => e, + " f => g, + " }; + + " Search backwards for the previous non-empty line. + let prevlinenum = prevnonblank(a:lnum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + while prevlinenum > 1 && prevline !~# '[^[:blank:]]' + let prevlinenum = prevnonblank(prevlinenum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + endwhile + + " A standalone '{', '}', or 'where' + let l:standalone_open = line =~# '\V\^\s\*{\s\*\$' + let l:standalone_close = line =~# '\V\^\s\*}\s\*\$' + let l:standalone_where = line =~# '\V\^\s\*where\s\*\$' + if l:standalone_open || l:standalone_close || l:standalone_where + " ToDo: we can search for more items than 'fn' and 'if'. + let [l:found_line, l:col, l:submatch] = + \ searchpos('\<\(fn\)\|\(if\)\>', 'bnWp') + if l:found_line !=# 0 + " Now we count the number of '{' and '}' in between the match + " locations and the current line (there is probably a better + " way to compute this). + let l:i = l:found_line + let l:search_line = strpart(getline(l:i), l:col - 1) + let l:opens = 0 + let l:closes = 0 + while l:i < a:lnum + let l:search_line2 = substitute(l:search_line, '\V{', '', 'g') + let l:opens += strlen(l:search_line) - strlen(l:search_line2) + let l:search_line3 = substitute(l:search_line2, '\V}', '', 'g') + let l:closes += strlen(l:search_line2) - strlen(l:search_line3) + let l:i += 1 + let l:search_line = getline(l:i) + endwhile + if l:standalone_open || l:standalone_where + if l:opens ==# l:closes + return indent(l:found_line) + endif + else + " Expect to find just one more close than an open + if l:opens ==# l:closes + 1 + return indent(l:found_line) + endif + endif + endif + endif + + " A standalone 'where' adds a shift. + let l:standalone_prevline_where = prevline =~# '\V\^\s\*where\s\*\$' + if l:standalone_prevline_where + return indent(prevlinenum) + 4 + endif + + " Handle where clauses nicely: subsequent values should line up nicely. + if prevline[len(prevline) - 1] ==# "," + \ && prevline =~# '^\s*where\s' + return indent(prevlinenum) + 6 + endif - " Starting assumption: cindent (called at the end) will do it right - " normally. We just want to fix up a few cases. - - let line = getline(a:lnum) - - if has('syntax_items') - let synname = synIDattr(synID(a:lnum, 1, 1), "name") - if synname == "rustString" - " If the start of the line is in a string, don't change the indent - return -1 - elseif synname =~ '\(Comment\|Todo\)' - \ && line !~ '^\s*/\*' " not /* opening line - if synname =~ "CommentML" " multi-line - if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*' - " This is (hopefully) the line after a /*, and it has no - " leader, so the correct indentation is that of the - " previous line. - return GetRustIndent(a:lnum - 1) - endif - endif - " If it's in a comment, let cindent take care of it now. This is - " for cases like "/*" where the next line should start " * ", not - " "* " as the code below would otherwise cause for module scope - " Fun fact: " /*\n*\n*/" takes two calls to get right! - return cindent(a:lnum) - endif - endif - - " cindent gets second and subsequent match patterns/struct members wrong, - " as it treats the comma as indicating an unfinished statement:: - " - " match a { - " b => c, - " d => e, - " f => g, - " }; - - " Search backwards for the previous non-empty line. - let prevlinenum = prevnonblank(a:lnum - 1) - let prevline = s:get_line_trimmed(prevlinenum) - while prevlinenum > 1 && prevline !~ '[^[:blank:]]' - let prevlinenum = prevnonblank(prevlinenum - 1) - let prevline = s:get_line_trimmed(prevlinenum) - endwhile - - " Handle where clauses nicely: subsequent values should line up nicely. - if prevline[len(prevline) - 1] == "," - \ && prevline =~# '^\s*where\s' - return indent(prevlinenum) + 6 - endif - - "match newline after struct with generic bound like - "struct SomeThing - "| <-- newline indent should same as prevline - if prevline[len(prevline) - 1] == ">" - \ && prevline =~# "\s*struct.*>$" - return indent(prevlinenum) - endif - - "match newline after where like: - "struct SomeThing - "where - " T: Display, - if prevline =~# '^\s*where$' - return indent(prevlinenum) + 4 - endif - - if prevline[len(prevline) - 1] == "," - \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' - \ && prevline !~ '^\s*fn\s' - \ && prevline !~ '([^()]\+,$' - \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>' - " Oh ho! The previous line ended in a comma! I bet cindent will try to - " take this too far... For now, let's normally use the previous line's - " indent. - - " One case where this doesn't work out is where *this* line contains - " square or curly brackets; then we normally *do* want to be indenting - " further. - " - " Another case where we don't want to is one like a function - " definition with arguments spread over multiple lines: - " - " fn foo(baz: Baz, - " baz: Baz) // <-- cindent gets this right by itself - " - " Another case is similar to the previous, except calling a function - " instead of defining it, or any conditional expression that leaves - " an open paren: - " - " foo(baz, - " baz); - " - " if baz && (foo || - " bar) { - " - " Another case is when the current line is a new match arm. - " - " There are probably other cases where we don't want to do this as - " well. Add them as needed. - return indent(prevlinenum) - endif - - if !has("patch-7.4.355") - " cindent before 7.4.355 doesn't do the module scope well at all; e.g.:: - " - " static FOO : &'static [bool] = [ - " true, - " false, - " false, - " true, - " ]; - " - " uh oh, next statement is indented further! - - " Note that this does *not* apply the line continuation pattern properly; - " that's too hard to do correctly for my liking at present, so I'll just - " start with these two main cases (square brackets and not returning to - " column zero) - - call cursor(a:lnum, 1) - if searchpair('{\|(', '', '}\|)', 'nbW', - \ 's:is_string_comment(line("."), col("."))') == 0 - if searchpair('\[', '', '\]', 'nbW', - \ 's:is_string_comment(line("."), col("."))') == 0 - " Global scope, should be zero - return 0 - else - " At the module scope, inside square brackets only - "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum - if line =~ "^\\s*]" - " It's the closing line, dedent it - return 0 - else - return shiftwidth() - endif - endif - endif - endif - - " Fall back on cindent, which does it mostly right - return cindent(a:lnum) + let l:last_prevline_character = prevline[len(prevline) - 1] + + " A line that ends with '.;' is probably an end of a long list + " of method operations. + if prevline =~# '\V\^\s\*.' && l:last_prevline_character ==# ';' + call cursor(a:lnum - 1, 1) + let l:scope_start = searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') + if l:scope_start != 0 && l:scope_start < a:lnum + return indent(l:scope_start) + 4 + endif + endif + + if l:last_prevline_character ==# "," + \ && s:get_line_trimmed(a:lnum) !~# '^\s*[\[\]{})]' + \ && prevline !~# '^\s*fn\s' + \ && prevline !~# '([^()]\+,$' + \ && s:get_line_trimmed(a:lnum) !~# '^\s*\S\+\s*=>' + " Oh ho! The previous line ended in a comma! I bet cindent will try to + " take this too far... For now, let's normally use the previous line's + " indent. + + " One case where this doesn't work out is where *this* line contains + " square or curly brackets; then we normally *do* want to be indenting + " further. + " + " Another case where we don't want to is one like a function + " definition with arguments spread over multiple lines: + " + " fn foo(baz: Baz, + " baz: Baz) // <-- cindent gets this right by itself + " + " Another case is similar to the previous, except calling a function + " instead of defining it, or any conditional expression that leaves + " an open paren: + " + " foo(baz, + " baz); + " + " if baz && (foo || + " bar) { + " + " Another case is when the current line is a new match arm. + " + " There are probably other cases where we don't want to do this as + " well. Add them as needed. + return indent(prevlinenum) + endif + + if !has("patch-7.4.355") + " cindent before 7.4.355 doesn't do the module scope well at all; e.g.:: + " + " static FOO : &'static [bool] = [ + " true, + " false, + " false, + " true, + " ]; + " + " uh oh, next statement is indented further! + + " Note that this does *not* apply the line continuation pattern properly; + " that's too hard to do correctly for my liking at present, so I'll just + " start with these two main cases (square brackets and not returning to + " column zero) + + call cursor(a:lnum, 1) + if searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + if searchpair('\[', '', '\]', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + " Global scope, should be zero + return 0 + else + " At the module scope, inside square brackets only + "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum + if line =~# "^\\s*]" + " It's the closing line, dedent it + return 0 + else + return &shiftwidth + endif + endif + endif + endif + + " Fall back on cindent, which does it mostly right + return cindent(a:lnum) endfunction +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption + +" vim: set et sw=4 sts=4 ts=8: -- cgit From 1b74d2bf0aceed1866f8a6f07403617fb37a0aa7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 17 Sep 2023 19:19:33 +0200 Subject: vim-patch:e30d8e4ce01d runtime(kotlin): Add Kotlin runtime files (vim/vim#13110) Closes udalov/kotlin-vimvim/vim#39 https://github.com/vim/vim/commit/e30d8e4ce01dc1aca95d25be9fd27c09855fd4be Co-authored-by: dkearns --- runtime/indent/kotlin.vim | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 runtime/indent/kotlin.vim (limited to 'runtime/indent') diff --git a/runtime/indent/kotlin.vim b/runtime/indent/kotlin.vim new file mode 100644 index 0000000000..590a5074d1 --- /dev/null +++ b/runtime/indent/kotlin.vim @@ -0,0 +1,60 @@ +" Vim indent file +" Language: Kotlin +" Maintainer: Alexander Udalov +" URL: https://github.com/udalov/kotlin-vim +" Last Change: 7 November 2021 +" 2023 Sep 17 by Vim Project (undo_indent) + +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +setlocal cinoptions& cinoptions+=j1,L0 +setlocal indentexpr=GetKotlinIndent() +setlocal indentkeys=0},0),!^F,o,O,e, +setlocal autoindent " TODO ? + +let b:undo_indent = "setlocal autoindent< cinoptions< indentexpr< indentkeys<" + +" TODO teach it to count bracket balance, etc. +function! GetKotlinIndent() + if v:lnum == 0 + return 0 + endif + + let prev_num = prevnonblank(v:lnum - 1) + let prev = getline(prev_num) + let prev_indent = indent(prev_num) + let cur = getline(v:lnum) + + if cur =~ '^\s*\*' + return cindent(v:lnum) + endif + + if prev =~ '^\s*\*/' + let st = prev + while st > 1 + if getline(st) =~ '^\s*/\*' + break + endif + let st = st - 1 + endwhile + return indent(st) + endif + + let prev_open_paren = prev =~ '^.*(\s*$' + let cur_close_paren = cur =~ '^\s*).*$' + let prev_open_brace = prev =~ '^.*\({\|->\)\s*$' + let cur_close_brace = cur =~ '^\s*}.*$' + + if prev_open_paren && !cur_close_paren || prev_open_brace && !cur_close_brace + return prev_indent + shiftwidth() + endif + + if cur_close_paren && !prev_open_paren || cur_close_brace && !prev_open_brace + return prev_indent - shiftwidth() + endif + + return prev_indent +endfunction -- cgit From 3222f0ad0079ce4bd4e45886a00e4fe4685fb5dd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 16 Oct 2023 16:36:25 +0800 Subject: vim-patch:dbf749bd5aae (#25665) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime: Fix more typos (vim/vim#13354) * Fix more typos * Fix typos in ignored runtime/ directory https://github.com/vim/vim/commit/dbf749bd5aaef6ea2d28bce081349785d174d96a Co-authored-by: Viktor Szépe --- runtime/indent/cdl.vim | 8 ++++---- runtime/indent/erlang.vim | 2 +- runtime/indent/julia.vim | 2 +- runtime/indent/krl.vim | 4 ++-- runtime/indent/rapid.vim | 2 +- runtime/indent/systemverilog.vim | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim index 2c0fc7988e..da675698cf 100644 --- a/runtime/indent/cdl.vim +++ b/runtime/indent/cdl.vim @@ -21,7 +21,7 @@ endif " find out if an "...=..." expression is an assignment (or a conditional) " it scans 'line' first, and then the previous lines -fun! CdlAsignment(lnum, line) +fun! CdlAssignment(lnum, line) let f = -1 let lnum = a:lnum let line = a:line @@ -90,7 +90,7 @@ fun! CdlGetIndent(lnum) end end - " remove members [a] of [b]:[c]... (inicio remainds valid) + " remove members [a] of [b]:[c]... (inicio remains valid) let line = substitute(line, '\c\(\[[^]]*]\(\s*of\s*\|:\)*\)\+', ' ', 'g') while 1 " search for the next interesting element @@ -111,7 +111,7 @@ fun! CdlGetIndent(lnum) else " c == '=' " if it is an assignment increase indent if f == -1 " we don't know yet, find out - let f = CdlAsignment(lnum, strpart(line, 0, inicio)) + let f = CdlAssignment(lnum, strpart(line, 0, inicio)) end if f == 1 " formula increase it let ind = ind + shiftwidth() @@ -125,7 +125,7 @@ fun! CdlGetIndent(lnum) let ind = ind - shiftwidth() elseif match(thisline, '^\s*=') >= 0 if f == -1 " we don't know yet if is an assignment, find out - let f = CdlAsignment(lnum, "") + let f = CdlAssignment(lnum, "") end if f == 1 " formula increase it let ind = ind + shiftwidth() diff --git a/runtime/indent/erlang.vim b/runtime/indent/erlang.vim index 7aa38587a6..5682c31ef3 100644 --- a/runtime/indent/erlang.vim +++ b/runtime/indent/erlang.vim @@ -1324,7 +1324,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " maybe A else " LTI " - " Note about Emacs compabitility {{{ + " Note about Emacs compatibility {{{ " " It would be fine to indent the examples above the following way: " diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim index 36f39f6652..efc98a2851 100644 --- a/runtime/indent/julia.vim +++ b/runtime/indent/julia.vim @@ -310,7 +310,7 @@ function IsFunctionArgPar(lnum, c) endfunction function JumpToMatch(lnum, last_closed_bracket) - " we use the % command to skip back (tries to ues matchit if possible, + " we use the % command to skip back (tries to use matchit if possible, " otherwise resorts to vim's default, which is buggy but better than " nothing) call cursor(a:lnum, a:last_closed_bracket) diff --git a/runtime/indent/krl.vim b/runtime/indent/krl.vim index cc3cbd1abb..89f45356ba 100644 --- a/runtime/indent/krl.vim +++ b/runtime/indent/krl.vim @@ -41,7 +41,7 @@ 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. + " This may be useful if code is commented out at the first column. return 0 endif @@ -117,7 +117,7 @@ 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. + " Previous none blank line irrelevant. Look further aback. let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1) endwhile diff --git a/runtime/indent/rapid.vim b/runtime/indent/rapid.vim index 2c99bb2491..b1fa00b8cc 100644 --- a/runtime/indent/rapid.vim +++ b/runtime/indent/rapid.vim @@ -74,7 +74,7 @@ function s:GetRapidIndentIntern() abort if l:currentLine =~ '^!' && !get(g:,'rapidCommentIndent',0) " If current line is ! line comment, do not change indent - " This may be usefull if code is commented out at the first column. + " This may be useful if code is commented out at the first column. return 0 endif diff --git a/runtime/indent/systemverilog.vim b/runtime/indent/systemverilog.vim index a5f4d5b90d..42a05a03aa 100644 --- a/runtime/indent/systemverilog.vim +++ b/runtime/indent/systemverilog.vim @@ -78,10 +78,10 @@ function SystemVerilogIndent() " Multiple-line comment count if curr_line =~ '^\s*/\*' && curr_line !~ '/\*.\{-}\*/' let s:multiple_comment += 1 - if vverb | echom vverb_str "Start of multiple-line commnt" | endif + if vverb | echom vverb_str "Start of multiple-line comment" | endif elseif curr_line =~ '\*/\s*$' && curr_line !~ '/\*.\{-}\*/' let s:multiple_comment -= 1 - if vverb | echom vverb_str "End of multiple-line commnt" | endif + if vverb | echom vverb_str "End of multiple-line comment" | endif return ind endif " Maintain indentation during commenting. -- cgit From 9e2248ab586c5e5854da68b5310755ea3557e6c9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 14 Nov 2023 17:38:46 +0100 Subject: vim-patch:9.0.2104: wast filetype should be replaced by wat filetype Problem: wast filetype should be replaced by wat filetype Solution: start using the official wat filetype name runtime: rename `wast` filetype to `wat` (Wasm text format) The problem is the name of the current filetype wast. When the plugin was initially created, the file extension for Wasm text format was not fixed and .wast was more popular. However, recently .wat became the official file extension for WebAssembly text (WAT) format and .wast is now a file extension for the unofficial WAST format, which is a superset of .wat for the convenience to describe the Wasm specification conformance tests. https://webassembly.js.org/docs/contrib-wat-vs-wast.html However for now, let's keep using the `wat` filetype even for the .wast extension, so that we at least do not lose the filetype settings and syntax highlighting. This can be adjusted later, if it turns out to have a separate need for. closes: vim/vim#13533 https://github.com/vim/vim/commit/bc8f79d36a456054ed29f46585830af6d71f57c8 Co-authored-by: rhysd --- runtime/indent/wast.vim | 17 ----------------- runtime/indent/wat.vim | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 runtime/indent/wast.vim create mode 100644 runtime/indent/wat.vim (limited to 'runtime/indent') diff --git a/runtime/indent/wast.vim b/runtime/indent/wast.vim deleted file mode 100644 index 1be234b6e9..0000000000 --- a/runtime/indent/wast.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Vim indent file -" Language: WebAssembly -" Maintainer: rhysd -" Last Change: Jul 29, 2018 -" For bugs, patches and license go to https://github.com/rhysd/vim-wasm - -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -" WebAssembly text format is S-expression. We can reuse LISP indentation -" logic. -setlocal indentexpr=lispindent('.') -setlocal noautoindent nosmartindent - -let b:undo_indent = "setl lisp< indentexpr<" diff --git a/runtime/indent/wat.vim b/runtime/indent/wat.vim new file mode 100644 index 0000000000..08997f1a98 --- /dev/null +++ b/runtime/indent/wat.vim @@ -0,0 +1,17 @@ +" Vim indent file +" Language: WebAssembly +" Maintainer: rhysd +" Last Change: Nov 14, 2023 +" For bugs, patches and license go to https://github.com/rhysd/vim-wasm + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" WebAssembly text format is S-expression. We can reuse LISP indentation +" logic. +setlocal indentexpr=lispindent('.') +setlocal noautoindent nosmartindent + +let b:undo_indent = "setl lisp< indentexpr<" -- cgit From 03b7d35b5485b6a66bcd92027e43c838766bb205 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 25 Nov 2023 16:16:12 +0100 Subject: vim-patch:813a538bb3ce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime(tsx): add indentation plugin (fixes vim/vim#13574) (vim/vim#13576) for now, let's just use the typescript indent file. https://github.com/vim/vim/commit/813a538bb3cec2eee4bf43e16b44fe40666529ef Co-authored-by: Jōshin --- runtime/indent/typescriptreact.vim | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 runtime/indent/typescriptreact.vim (limited to 'runtime/indent') diff --git a/runtime/indent/typescriptreact.vim b/runtime/indent/typescriptreact.vim new file mode 100644 index 0000000000..052bddddbd --- /dev/null +++ b/runtime/indent/typescriptreact.vim @@ -0,0 +1,2 @@ +" Placeholder for backwards compatilibity: .tsx used to stand for TypeScript. +runtime! indent/typescript.vim -- cgit