neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 1e498b8f772c9d04fa18bd0251818506043bdf51
parent e3c36f31e3a0863db0458c339eddf6e22cf0c2ec
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 27 Sep 2025 20:22:24 +0800

Merge pull request #35911 from e-kwsm/do-not-install-testdir

build(vim-patch.sh): ignore runtime/*/testdir/ 
Diffstat:
Druntime/indent/Makefile | 14--------------
Mruntime/indent/README.txt | 2--
Druntime/indent/testdir/README.txt | 97-------------------------------------------------------------------------------
Druntime/indent/testdir/bash.in | 22----------------------
Druntime/indent/testdir/bash.ok | 22----------------------
Druntime/indent/testdir/bitbake.in | 19-------------------
Druntime/indent/testdir/bitbake.ok | 19-------------------
Druntime/indent/testdir/dts.in | 46----------------------------------------------
Druntime/indent/testdir/dts.ok | 46----------------------------------------------
Druntime/indent/testdir/html.in | 77-----------------------------------------------------------------------------
Druntime/indent/testdir/html.ok | 77-----------------------------------------------------------------------------
Druntime/indent/testdir/krl.in | 148-------------------------------------------------------------------------------
Druntime/indent/testdir/krl.ok | 148-------------------------------------------------------------------------------
Druntime/indent/testdir/lua.in | 19-------------------
Druntime/indent/testdir/lua.ok | 19-------------------
Druntime/indent/testdir/make.in | 20--------------------
Druntime/indent/testdir/make.ok | 20--------------------
Druntime/indent/testdir/matlab.in | 89-------------------------------------------------------------------------------
Druntime/indent/testdir/matlab.ok | 89-------------------------------------------------------------------------------
Druntime/indent/testdir/python.in | 94-------------------------------------------------------------------------------
Druntime/indent/testdir/python.ok | 94-------------------------------------------------------------------------------
Druntime/indent/testdir/rapid.in | 266-------------------------------------------------------------------------------
Druntime/indent/testdir/rapid.ok | 266-------------------------------------------------------------------------------
Druntime/indent/testdir/runtest.vim | 146-------------------------------------------------------------------------------
Druntime/indent/testdir/sshconfig.in | 53-----------------------------------------------------
Druntime/indent/testdir/sshconfig.ok | 53-----------------------------------------------------
Druntime/indent/testdir/tcl.in | 20--------------------
Druntime/indent/testdir/tcl.ok | 19-------------------
Druntime/indent/testdir/thrift.in | 38--------------------------------------
Druntime/indent/testdir/thrift.ok | 38--------------------------------------
Druntime/indent/testdir/vb.in | 134-------------------------------------------------------------------------------
Druntime/indent/testdir/vb.ok | 134-------------------------------------------------------------------------------
Druntime/indent/testdir/vim.in | 113-------------------------------------------------------------------------------
Druntime/indent/testdir/vim.ok | 113-------------------------------------------------------------------------------
Druntime/indent/testdir/xml.in | 32--------------------------------
Druntime/indent/testdir/xml.ok | 32--------------------------------
Druntime/indent/testdir/yaml.in | 20--------------------
Druntime/indent/testdir/yaml.ok | 20--------------------
Mscripts/vim-patch.sh | 22+++++++++++++---------
39 files changed, 13 insertions(+), 2687 deletions(-)

diff --git a/runtime/indent/Makefile b/runtime/indent/Makefile @@ -1,14 +0,0 @@ -# Portable Makefile for running indent tests. - -VIM = vim -VIMRUNTIME = .. - -# Run the tests that didn't run yet or failed previously. -# If a test succeeds a testdir/*.out file will be written. -# If a test fails a testdir/*.fail file will be written. -test: - VIMRUNTIME=$(VIMRUNTIME) $(VIM) --clean --not-a-term -u testdir/runtest.vim - - -clean testclean: - rm -f testdir/*.fail testdir/*.out diff --git a/runtime/indent/README.txt b/runtime/indent/README.txt @@ -44,5 +44,3 @@ running. Add a test if the function exists and use ":finish", like this: The user may have several options set unlike you, try to write the file such that it works with any option settings. Also be aware of certain features not being compiled in. - -To test the indent file, see testdir/README.txt. diff --git a/runtime/indent/testdir/README.txt b/runtime/indent/testdir/README.txt @@ -1,97 +0,0 @@ -TESTING INDENT SCRIPTS - -We'll use FILETYPE for the filetype name here. - - -FORMAT OF THE FILETYPE.IN FILE - -First of all, create a FILETYPE.in file. It should contain: - -- A modeline setting the 'filetype' and any other option values. - This must work like a comment for FILETYPE. E.g. for vim: - " vim: set ft=vim sw=4 : - -- At least one block of lines to indent, prefixed with START_INDENT and - followed by END_INDENT. These lines must also look like a comment for your - FILETYPE. You would normally leave out all indent, so that the effect of - the indent command results in adding indent. Example: - - " START_INDENT - func Some() - let x = 1 - endfunc - " END_INDENT - - If you just want to test normal indenting with default options, you can make - this a large number of lines. Just add all kinds of language constructs, - nested statements, etc. with valid syntax. - -- Optionally, add lines with INDENT_EXE after START_INDENT, followed by a Vim - command. This will be executed before indenting the lines. Example: - - " START_INDENT - " INDENT_EXE let g:vim_indent_cont = 6 - let cmd = - \ 'some ' - \ 'string' - " END_INDENT - - Note that the command is not undone, you may need to reverse the effect for - the next block of lines. - -- Alternatively to indenting all the lines between START_INDENT and - END_INDENT, use an INDENT_AT line, which specifies a pattern to find the - line to indent. Example: - - " START_INDENT - " INDENT_AT this-line - func Some() - let f = x " this-line - endfunc - " END_INDENT - - Alternatively you can use INDENT_NEXT to indent the line below the matching - pattern. Keep in mind that quite often it will indent relative to the - matching line: - - " START_INDENT - " INDENT_NEXT next-line - func Some() - " next-line - let f = x - endfunc - " END_INDENT - - Or use INDENT_PREV to indent the line above the matching pattern: - - " START_INDENT - " INDENT_PREV prev-line - func Some() - let f = x - " prev-line - endfunc - " END_INDENT - -It's best to keep the whole file valid for FILETYPE, so that syntax -highlighting works normally, and any indenting that depends on the syntax -highlighting also works. - - -RUNNING THE TEST - -Before running the test, create a FILETYPE.ok file. You can leave it empty at -first. - -Now run "make test" from the parent directory. After Vim has done the -indenting you will see a FILETYPE.fail file. This contains the actual result -of indenting, and it's different from the FILETYPE.ok file. - -Check the contents of the FILETYPE.fail file. If it is perfectly OK, then -rename it to overwrite the FILETYPE.ok file. If you now run "make test" again, -the test will pass and create a FILETYPE.out file, which is identical to the -FILETYPE.ok file. The FILETYPE.fail file will be deleted. - -If you try to run "make test" again you will notice that nothing happens, -because the FILETYPE.out file already exists. Delete it, or do "make clean", -so that the text runs again. If you edit the FILETYPE.in file, so that it's -newer than the FILETYPE.out file, the test will also run. diff --git a/runtime/indent/testdir/bash.in b/runtime/indent/testdir/bash.in @@ -1,22 +0,0 @@ -#!/bin/bash -# vim: set ft=bash sw=2 noet: - -# START_INDENT -a = 10 -b = 20 - -function add() { -c = $((a + b)) -} - -function print { -# do nothing -} - -if [[ $c -ge 15 ]]; -then -print("ok") -else -print("not ok") -fi -# END_INDENT diff --git a/runtime/indent/testdir/bash.ok b/runtime/indent/testdir/bash.ok @@ -1,22 +0,0 @@ -#!/bin/bash -# vim: set ft=bash sw=2 noet: - -# START_INDENT -a = 10 -b = 20 - -function add() { - c = $((a + b)) -} - -function print { - # do nothing -} - -if [[ $c -ge 15 ]]; -then - print("ok") -else - print("not ok") -fi -# END_INDENT diff --git a/runtime/indent/testdir/bitbake.in b/runtime/indent/testdir/bitbake.in @@ -1,19 +0,0 @@ -# vim: set filetype=bitbake : - -# START_INDENT -FOO = " \ - bar \ - baz \ - qux \ - " - -do_configure() { -oe_conf -} - -python do_task() { -def foo(x): -if y: -print(x) -} -# END_INDENT diff --git a/runtime/indent/testdir/bitbake.ok b/runtime/indent/testdir/bitbake.ok @@ -1,19 +0,0 @@ -# vim: set filetype=bitbake : - -# START_INDENT -FOO = " \ - bar \ - baz \ - qux \ -" - -do_configure() { - oe_conf -} - -python do_task() { - def foo(x): - if y: - print(x) -} -# END_INDENT diff --git a/runtime/indent/testdir/dts.in b/runtime/indent/testdir/dts.in @@ -1,46 +0,0 @@ -/* vim: set ft=dts noet sw=8 : */ - -/* START_INDENT */ -/dts-v1/; -#include <dt-bindings/pinctrl/pinctrl-imx6q.h> - #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 @@ -1,46 +0,0 @@ -/* vim: set ft=dts noet sw=8 : */ - -/* START_INDENT */ -/dts-v1/; -#include <dt-bindings/pinctrl/pinctrl-imx6q.h> -#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/html.in b/runtime/indent/testdir/html.in @@ -1,77 +0,0 @@ -% vim: set ft=html sw=4 ts=8 : - - -% START_INDENT -<html> - <body> -<style> -div#d1 { color: red; } -div#d2 { color: green; } -</style> - <script> - var v1 = "v1"; -var v2 = "v2"; - </script> -<div> -<div> -text -</div> -</div> - -<div -class="foo bar"> -text -</div> - -<div class="foo bar" -data="something"> -text -</div> - -<div class="foo -bar"> -text -</div> - -<dl> -<dd> -dd text -</dd> -<dt> -dt text -</dt> -</dl> -<div -class="test" -style="color: yellow"> -text -</div> - - </body> -</html> - -% END_INDENT - -% START_INDENT -% INDENT_EXE let g:html_indent_style1 = "inc" -% INDENT_EXE let g:html_indent_script1 = "zero" -% INDENT_EXE let g:html_indent_attribute = 1 -% INDENT_EXE call HtmlIndent_CheckUserSettings() -<html> - <body> -<style> -div#d1 { color: red; } -div#d2 { color: green; } -</style> - <script> - var v1 = "v1"; -var v2 = "v2"; - </script> -<div -class="test" -style="color: yellow"> -text -</div> -</body> -</html> -% END_INDENT diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok @@ -1,77 +0,0 @@ -% vim: set ft=html sw=4 ts=8 : - - -% START_INDENT -<html> - <body> - <style> -div#d1 { color: red; } -div#d2 { color: green; } - </style> - <script> - var v1 = "v1"; - var v2 = "v2"; - </script> - <div> - <div> - text - </div> - </div> - - <div - class="foo bar"> - text - </div> - - <div class="foo bar" - data="something"> - text - </div> - - <div class="foo - bar"> - text - </div> - - <dl> - <dd> - dd text - </dd> - <dt> - dt text - </dt> - </dl> - <div - class="test" - style="color: yellow"> - text - </div> - - </body> -</html> - -% END_INDENT - -% START_INDENT -% INDENT_EXE let g:html_indent_style1 = "inc" -% INDENT_EXE let g:html_indent_script1 = "zero" -% INDENT_EXE let g:html_indent_attribute = 1 -% INDENT_EXE call HtmlIndent_CheckUserSettings() -<html> - <body> - <style> - div#d1 { color: red; } - div#d2 { color: green; } - </style> - <script> -var v1 = "v1"; -var v2 = "v2"; - </script> - <div - class="test" - style="color: yellow"> - text - </div> - </body> -</html> -% END_INDENT diff --git a/runtime/indent/testdir/krl.in b/runtime/indent/testdir/krl.in @@ -1,148 +0,0 @@ -; vim: set ft=krl : - -; START_INDENT - -def One() -int i -If i==1 then -While i>=1 -For i=1 to 5 step 2 -Loop -i = i+1 -EndLoop -EndFor -EndWhile -Else -Repeat -Switch i -Case 1 -Skip 123 -i = i+1 -EndSkip 123 -Spline with $acc=100, $vel.cp=3 -slin {x 100} -scirc {x 110, y 110}, {x 120, y 90} -slin {x 200} c_dis -Time_Block Start -slin {x 300} c_dis -Time_Block Part = 22.2 -slin {y 400} c_dis -Time_Block Part = 33.3 -Time_Block End = 10 -slin {y 200} c_dis -Const_Vel Start +100 OnStart -slin {y 300} c_dis -slin {x 100} -Const_Vel End -5.5 -slin {y 200} c_dis -EndSpline -Case 2,3 -PTP_Spline with $acc=100, $vel.ptp=100 -sptp {a1 0} c_ptp -sptp {a1 90} -EndSpline c_spl -Default -i = i+1 -EndSwitch -Continue -Until False -EndIf -end - -DEF Two() -int i -END - -global def Three() -int i -end - -GLOBAL DEF Four() -int i -END - -Global Def Five() -int i -End - -deffct bool fOne() -int i -endfct - -DEFFCT bool fTwo() -int i -ENDFCT - -global deffct bool fThree() -int i -endfct - -GLOBAL DEFFCT bool fFour() -int i -ENDFCT - -Global DefFct bool fFive() -int i -EndFct - -DefDat datfile() -global int i=1 -; don't indent column 1 comments unless g:krlCommentIndent is set -; global int o=2 -EndDat - -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlSpaceIndent = 0 -; INDENT_EXE set shiftwidth=4 - -def bla() -int i -end - -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlCommentIndent = 1 -def bla() -; indent this first column comment because of g:krlCommentIndent=1 -end -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlIndentBetweenDef = 0 -def bla() -int i ; don't indent this line because of g:krlIndentBetweenDef=0 -end -; END_INDENT - -; START_INDENT -; INDENT_AT this-line -def Some() -int f -if true then -f = 1 ; this-line -endif -end -; END_INDENT - -; START_INDENT -; INDENT_NEXT next-line -def Some() - int i - ; next-line -i = 1 ; should get indent of line 'int i' above -end -; END_INDENT - -; START_INDENT -; INDENT_PREV prev-line -def Some() -int f -if true then -f = 1 -; prev-line -endif -end -; END_INDENT diff --git a/runtime/indent/testdir/krl.ok b/runtime/indent/testdir/krl.ok @@ -1,148 +0,0 @@ -; vim: set ft=krl : - -; START_INDENT - -def One() - int i - If i==1 then - While i>=1 - For i=1 to 5 step 2 - Loop - i = i+1 - EndLoop - EndFor - EndWhile - Else - Repeat - Switch i - Case 1 - Skip 123 - i = i+1 - EndSkip 123 - Spline with $acc=100, $vel.cp=3 - slin {x 100} - scirc {x 110, y 110}, {x 120, y 90} - slin {x 200} c_dis - Time_Block Start - slin {x 300} c_dis - Time_Block Part = 22.2 - slin {y 400} c_dis - Time_Block Part = 33.3 - Time_Block End = 10 - slin {y 200} c_dis - Const_Vel Start +100 OnStart - slin {y 300} c_dis - slin {x 100} - Const_Vel End -5.5 - slin {y 200} c_dis - EndSpline - Case 2,3 - PTP_Spline with $acc=100, $vel.ptp=100 - sptp {a1 0} c_ptp - sptp {a1 90} - EndSpline c_spl - Default - i = i+1 - EndSwitch - Continue - Until False - EndIf -end - -DEF Two() - int i -END - -global def Three() - int i -end - -GLOBAL DEF Four() - int i -END - -Global Def Five() - int i -End - -deffct bool fOne() - int i -endfct - -DEFFCT bool fTwo() - int i -ENDFCT - -global deffct bool fThree() - int i -endfct - -GLOBAL DEFFCT bool fFour() - int i -ENDFCT - -Global DefFct bool fFive() - int i -EndFct - -DefDat datfile() - global int i=1 -; don't indent column 1 comments unless g:krlCommentIndent is set -; global int o=2 -EndDat - -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlSpaceIndent = 0 -; INDENT_EXE set shiftwidth=4 - -def bla() - int i -end - -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlCommentIndent = 1 -def bla() - ; indent this first column comment because of g:krlCommentIndent=1 -end -; END_INDENT - -; START_INDENT -; INDENT_EXE let g:krlIndentBetweenDef = 0 -def bla() -int i ; don't indent this line because of g:krlIndentBetweenDef=0 -end -; END_INDENT - -; START_INDENT -; INDENT_AT this-line -def Some() -int f -if true then - f = 1 ; this-line -endif -end -; END_INDENT - -; START_INDENT -; INDENT_NEXT next-line -def Some() - int i - ; next-line - i = 1 ; should get indent of line 'int i' above -end -; END_INDENT - -; START_INDENT -; INDENT_PREV prev-line -def Some() -int f -if true then - f = 1 -; prev-line -endif -end -; END_INDENT diff --git a/runtime/indent/testdir/lua.in b/runtime/indent/testdir/lua.in @@ -1,19 +0,0 @@ --- vim: set ft=lua sw=2 noet: - --- START_INDENT -function foo(a, b, c, d) - return { a, b, c, d } -end - -local a = foo( -1, -2, -"longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", -4 -) - -local b = { -1, - 2, -} --- END_INDENT diff --git a/runtime/indent/testdir/lua.ok b/runtime/indent/testdir/lua.ok @@ -1,19 +0,0 @@ --- vim: set ft=lua sw=2 noet: - --- START_INDENT -function foo(a, b, c, d) - return { a, b, c, d } -end - -local a = foo( - 1, - 2, - "longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - 4 -) - -local b = { - 1, - 2, -} --- END_INDENT diff --git a/runtime/indent/testdir/make.in b/runtime/indent/testdir/make.in @@ -1,20 +0,0 @@ -# vim:ft=make -# START_INDENT -.POSIX : -MAKEFLAGS += -rR - -.SUFFIXES: .F .f -FC = f95 -FFLAGS = -CPPFLAGS = - -.PHONY: help -help: -@echo indentation test - -.F.f: -$(FC) $(CPPFLAGS) -E $< > $@ - -.f.o: -$(FC) $(FFLAGS) -c -o $@ $< -# END_INDENT diff --git a/runtime/indent/testdir/make.ok b/runtime/indent/testdir/make.ok @@ -1,20 +0,0 @@ -# vim:ft=make -# START_INDENT -.POSIX : -MAKEFLAGS += -rR - -.SUFFIXES: .F .f -FC = f95 -FFLAGS = -CPPFLAGS = - -.PHONY: help -help: - @echo indentation test - -.F.f: - $(FC) $(CPPFLAGS) -E $< > $@ - -.f.o: - $(FC) $(FFLAGS) -c -o $@ $< -# END_INDENT diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in @@ -1,89 +0,0 @@ -% vim: set ft=matlab sw=4 : - -% START_INDENT -if true -disp foo -elseif false -disp bar -end -% END_INDENT - -% START_INDENT -try -statements -catch exception -statements -end -% END_INDENT - -% START_INDENT -if true, ... -if true -disp hello -end -end -% END_INDENT - -% START_INDENT -switch a -case expr -if true, foo; end -disp hello -otherwise -disp bar -end -% END_INDENT - -% START_INDENT -if true -A(1:end - 1) -C{1:end - 1} -disp foo -end -% END_INDENT - -% START_INDENT -A = [{ -} -] ... -disp foo -disp bar -% END_INDENT - -% START_INDENT -if true -% end -%% end -disp foo -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 0 -function foo -disp foo -function nested -disp bar -end -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 1 -function foo -disp foo -function nested -disp bar -end -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 2 -function foo -disp foo -function nested -disp bar -end -end -% END_INDENT diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok @@ -1,89 +0,0 @@ -% vim: set ft=matlab sw=4 : - -% START_INDENT -if true - disp foo -elseif false - disp bar -end -% END_INDENT - -% START_INDENT -try - statements -catch exception - statements -end -% END_INDENT - -% START_INDENT -if true, ... - if true - disp hello - end -end -% END_INDENT - -% START_INDENT -switch a - case expr - if true, foo; end - disp hello - otherwise - disp bar -end -% END_INDENT - -% START_INDENT -if true - A(1:end - 1) - C{1:end - 1} - disp foo -end -% END_INDENT - -% START_INDENT -A = [{ - } - ] ... - disp foo -disp bar -% END_INDENT - -% START_INDENT -if true - % end - %% end - disp foo -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 0 -function foo -disp foo - function nested - disp bar - end -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 1 -function foo -disp foo - function nested - disp bar - end -end -% END_INDENT - -% START_INDENT -% INDENT_EXE let b:MATLAB_function_indent = 2 -function foo - disp foo - function nested - disp bar - end -end -% END_INDENT diff --git a/runtime/indent/testdir/python.in b/runtime/indent/testdir/python.in @@ -1,94 +0,0 @@ -# vim: set ft=python sw=4 et: - -# START_INDENT -dict = { -'a': 1, -'b': 2, -'c': 3, -} -# END_INDENT - -# START_INDENT -# INDENT_EXE let [g:python_indent.open_paren, g:python_indent.closed_paren_align_last_line] = ['shiftwidth()', v:false] -dict = { -'a': 1, -'b': 2, -'c': 3, -} -# END_INDENT - -# START_INDENT -# INDENT_EXE let g:python_indent.open_paren = 'shiftwidth() * 2' -# INDENT_EXE syntax match pythonFoldMarkers /{{{\d*/ contained containedin=pythonComment -# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {{{1 - -if True: -pass -# END_INDENT - -# START_INDENT -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -open_paren_not_at_EOL(100, -(200, -300), -400) - -open_paren_at_EOL( -100, 200, 300, 400) - -# END_INDENT diff --git a/runtime/indent/testdir/python.ok b/runtime/indent/testdir/python.ok @@ -1,94 +0,0 @@ -# vim: set ft=python sw=4 et: - -# START_INDENT -dict = { - 'a': 1, - 'b': 2, - 'c': 3, - } -# END_INDENT - -# START_INDENT -# INDENT_EXE let [g:python_indent.open_paren, g:python_indent.closed_paren_align_last_line] = ['shiftwidth()', v:false] -dict = { - 'a': 1, - 'b': 2, - 'c': 3, -} -# END_INDENT - -# START_INDENT -# INDENT_EXE let g:python_indent.open_paren = 'shiftwidth() * 2' -# INDENT_EXE syntax match pythonFoldMarkers /{{{\d*/ contained containedin=pythonComment -# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {{{1 - -if True: - pass -# END_INDENT - -# START_INDENT -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -open_paren_not_at_EOL(100, - (200, - 300), - 400) - -open_paren_at_EOL( - 100, 200, 300, 400) - -# END_INDENT diff --git a/runtime/indent/testdir/rapid.in b/runtime/indent/testdir/rapid.in @@ -1,266 +0,0 @@ -! 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 @@ -1,266 +0,0 @@ -! 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/runtest.vim b/runtime/indent/testdir/runtest.vim @@ -1,146 +0,0 @@ -" Runs all the indent tests for which there is no .out file. -" -" Current directory must be runtime/indent. - -" Only do this with the +eval feature -if 1 - -set nocp -filetype indent on -syn on -set nowrapscan -set report=9999 -set modeline -set debug=throw -set nomore - -au! SwapExists * call HandleSwapExists() -func HandleSwapExists() - " Ignore finding a swap file for the test input and output, the user might be - " editing them and that's OK. - if expand('<afile>') =~ '.*\.\(in\|out\|fail\|ok\)' - let v:swapchoice = 'e' - endif -endfunc - -let failed_count = 0 -for fname in glob('testdir/*.in', 1, 1) - let root = substitute(fname, '\.in', '', '') - - " Execute the test if the .out file does not exist of when the .in file is - " newer. - let in_time = getftime(fname) - let out_time = getftime(root . '.out') - if out_time < 0 || in_time > out_time - call delete(root . '.fail') - call delete(root . '.out') - - set sw& ts& filetype= - exe 'split ' . fname - - let did_some = 0 - let failed = 0 - let end = 1 - while 1 - " Indent all the lines between "START_INDENT" and "END_INDENT" - exe end - let start = search('\<START_INDENT\>') - let end = search('\<END_INDENT\>') - if start <= 0 || end <= 0 || end <= start - if did_some == 0 - call append(0, 'ERROR: START_INDENT and/or END_INDENT not found') - let failed = 1 - endif - break - else - let did_some = 1 - - " Execute all commands marked with INDENT_EXE and find any pattern. - let lnum = start - let pattern = '' - let at = '' - while 1 - exe lnum + 1 - let lnum_exe = search('\<INDENT_EXE\>') - exe lnum + 1 - let indent_at = search('\<INDENT_\(AT\|NEXT\|PREV\)\>') - if lnum_exe > 0 && lnum_exe < end && (indent_at <= 0 || lnum_exe < indent_at) - exe substitute(getline(lnum_exe), '.*INDENT_EXE', '', '') - let lnum = lnum_exe - let start = lnum - elseif indent_at > 0 && indent_at < end - if pattern != '' - call append(indent_at, 'ERROR: duplicate pattern') - let failed = 1 - break - endif - let text = getline(indent_at) - let pattern = substitute(text, '.*INDENT_\S*\s*', '', '') - let at = substitute(text, '.*INDENT_\(\S*\).*', '\1', '') - let lnum = indent_at - let start = lnum - else - break - endif - endwhile - - exe start + 1 - if pattern == '' - try - exe 'normal =' . (end - 1) . 'G' - catch - call append(indent_at, 'ERROR: ' . v:exception) - let failed = 1 - endtry - else - let lnum = search(pattern) - if lnum <= 0 - call append(indent_at, 'ERROR: pattern not found: ' . pattern) - let failed = 1 - break - endif - if at == 'AT' - exe lnum - elseif at == 'NEXT' - exe lnum + 1 - else - exe lnum - 1 - endif - try - normal == - catch - call append(indent_at, 'ERROR: ' . v:exception) - let failed = 1 - endtry - endif - endif - endwhile - - if !failed - " Check the resulting text equals the .ok file. - if getline(1, '$') != readfile(root . '.ok') - let failed = 1 - endif - endif - - if failed - let failed_count += 1 - exe 'write ' . root . '.fail' - echoerr 'Test ' . fname . ' FAILED!' - else - exe 'write ' . root . '.out' - echo "Test " . fname . " OK\n" - endif - - quit! " close the indented file - endif -endfor - -" Matching "if 1" at the start. -endif - -if failed_count > 0 - " have make report an error - cquit -endif -qall! diff --git a/runtime/indent/testdir/sshconfig.in b/runtime/indent/testdir/sshconfig.in @@ -1,53 +0,0 @@ -# vim: set filetype=sshconfig shiftwidth=4 expandtab : - -# START_INDENT -Host myhost -User myuser -PasswordAuthentication no -# END_INDENT - -# START_INDENT -Host aaa -User bbb -Host ccc -Host ddd -# END_INDENT - -# START_INDENT -host aaa -HOST bbb -hoSt ccc -match ddd -MATCH eee -MatCH fff -# END_INDENT - -# START_INDENT -Host aaa -User host -PasswordAuthentication no -Host * -User user -PasswordAuthentication no -Host match -User bbb -# END_INDENT - -# START_INDENT -Host tab -User myuser -# END_INDENT - -# START_INDENT -Host mix -User myuser -# END_INDENT - -# START_INDENT -Host aaa -User bbb -Match ccc -User ddd -HostKeyAlgorithms ssh-ed25519 -Match eee -# END_INDENT diff --git a/runtime/indent/testdir/sshconfig.ok b/runtime/indent/testdir/sshconfig.ok @@ -1,53 +0,0 @@ -# vim: set filetype=sshconfig shiftwidth=4 expandtab : - -# START_INDENT -Host myhost - User myuser - PasswordAuthentication no -# END_INDENT - -# START_INDENT -Host aaa - User bbb -Host ccc -Host ddd -# END_INDENT - -# START_INDENT -host aaa -HOST bbb -hoSt ccc -match ddd -MATCH eee -MatCH fff -# END_INDENT - -# START_INDENT -Host aaa - User host - PasswordAuthentication no -Host * - User user - PasswordAuthentication no -Host match - User bbb -# END_INDENT - -# START_INDENT -Host tab - User myuser -# END_INDENT - -# START_INDENT -Host mix - User myuser -# END_INDENT - -# START_INDENT -Host aaa - User bbb -Match ccc - User ddd - HostKeyAlgorithms ssh-ed25519 -Match eee -# END_INDENT diff --git a/runtime/indent/testdir/tcl.in b/runtime/indent/testdir/tcl.in @@ -1,19 +0,0 @@ -# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : - -# START_INDENT -proc abc {} { -set a 5 -if {[some_cmd]==1} { -foreach i [list {1 2 3}] { -# Does this comment affect anything? -puts $i -} -} -} - -command_with_a_long_time -arg1 "First" \ --arg2 "Second" \ --arg3 "Third" - -puts "Move indent back after line continuation is complete" -# END_INDENT -\ No newline at end of file diff --git a/runtime/indent/testdir/tcl.ok b/runtime/indent/testdir/tcl.ok @@ -1,19 +0,0 @@ -# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : - -# START_INDENT -proc abc {} { - set a 5 - if {[some_cmd]==1} { - foreach i [list {1 2 3}] { - # Does this comment affect anything? - puts $i - } - } -} - -command_with_a_long_time -arg1 "First" \ - -arg2 "Second" \ - -arg3 "Third" - -puts "Move indent back after line continuation is complete" -# END_INDENT diff --git a/runtime/indent/testdir/thrift.in b/runtime/indent/testdir/thrift.in @@ -1,38 +0,0 @@ -// vim: set ft=thrift sw=4 et: - -# START_INDENT -namespace cpp foo -namespace java com.foo.thrift - -include "Status.thrift" - -// These are supporting structs for JniFrontend.java, which serves as the glue -// between our C++ execution environment and the Java frontend. - -struct TSetSessionParams { - 1: required string user -} - -struct TAuthenticateParams { - 1: required string user - 2: required string passwd - 3: optional string host -4: optional string db_name - 5: optional list<string> table_names; -} - -/* { - * xxxx - * } - */ -// TColumnDesc -struct TColumnDesc { - // { -4: optional string tableName -5: optional string columnDefault - // Let FE control the type, which makes it easier to modify and display complex types -6: optional string columnTypeStr // deprecated -7: optional string dataType - // } -} -# END_INDENT diff --git a/runtime/indent/testdir/thrift.ok b/runtime/indent/testdir/thrift.ok @@ -1,38 +0,0 @@ -// vim: set ft=thrift sw=4 et: - -# START_INDENT -namespace cpp foo -namespace java com.foo.thrift - -include "Status.thrift" - -// These are supporting structs for JniFrontend.java, which serves as the glue -// between our C++ execution environment and the Java frontend. - -struct TSetSessionParams { - 1: required string user -} - -struct TAuthenticateParams { - 1: required string user - 2: required string passwd - 3: optional string host - 4: optional string db_name - 5: optional list<string> table_names; -} - -/* { - * xxxx - * } - */ -// TColumnDesc -struct TColumnDesc { - // { - 4: optional string tableName - 5: optional string columnDefault - // Let FE control the type, which makes it easier to modify and display complex types - 6: optional string columnTypeStr // deprecated - 7: optional string dataType - // } -} -# END_INDENT diff --git a/runtime/indent/testdir/vb.in b/runtime/indent/testdir/vb.in @@ -1,134 +0,0 @@ -' vim: filetype=vb shiftwidth=4 expandtab -' -' START_INDENT -Public Type GEmployeeRecord ' Create user-defined type. -ID As Integer ' Define elements of data type. -Name As String * 20 -Address As String * 30 -Phone As Long -HireDate As Date -End Type - -Public Enum InterfaceColors -icMistyRose = &HE1E4FF& -icSlateGray = &H908070& -icDodgerBlue = &HFF901E& -icDeepSkyBlue = &HFFBF00& -icSpringGreen = &H7FFF00& -icForestGreen = &H228B22& -icGoldenrod = &H20A5DA& -icFirebrick = &H2222B2& -End Enum - -Enum SecurityLevel -IllegalEntry = -1 -SecurityLevel1 = 0 -SecurityLevel2 = 1 -End Enum - -Public Function TestConditional (number As Integer, ext As String) As Boolean -Dim inRange As Boolean - -Select Case number -Case <= 0 -inRange = False -Case > 10 -inRange = False -Case Else -inRange = True -End Select - -' This is a special case identified in the indent script. -Select Case number -End Select - -If ext = ".xlm" Then -If inRange Then -TestConditional = True -Else -TestConditional = False -End If -ElseIf ext = ".xlsx" Then -If inRange Then -TestConditional = False -Else -TestConditional = True -End If -Else -TestConditional = False -End If -End Function - -Private Sub TestIterators (lLimit As Integer, uLimit As Integer) -Dim a() As Variant -Dim elmt As Variant -Dim found As Boolean -Dim indx As Integer -Const specialValue As Integer = 5 - -If uLimit < lLimit Then -Exit Sub -End If - -ReDim a(lLimit To uLimit) -For indx=lLimit To Ulimit -a(indx) = 2 * indx -Next indx - -found = False -For Each elmt in a -If elmt = specialValue Then -found = True -End If -Next elmt - -If found then -indx = uLimit -Do While indx >= lLimit -indx = indx - 1 -Loop -End If - -End Sub - -Public Sub TestMultiline (cellAddr As String, rowNbr As Long) -Dim rng As Range - -Set rng = Range(cellAddr) -With rng -.Cells(1,1).Value = _ -"Line 1 of multiline string; " & _ -"Line 2 of multiline string; " & _ -"Line 3 of multiline string" -End With - -' The following lines have whitespace after the underscore character -' and therefore do not form a valid multiline statement. The indent -' script correctly treats them as four single line statements contrary -' to the author's obvious indent. -rng..Cells(1,1).Value = _ -"Line 1 of multiline string; " & _ -"Line 2 of multiline string; " & _ -"Line 3 of multiline string" - -End Sub - -Private Sub TestStmtLabel() -GoTo stmtLabel - -' Statement labels are never indented -stmtLabel: - -End Sub - -Sub TestTypeKeyword() -Type EmployeeRecord ' Create user-defined type. -ID As Integer ' Define elements of data type. -Name As String * 20 -Address As String * 30 -Phone As Long -HireDate As Date -End Type -Dim varType As EmployeeRecord -End Sub -' END_INDENT diff --git a/runtime/indent/testdir/vb.ok b/runtime/indent/testdir/vb.ok @@ -1,134 +0,0 @@ -' vim: filetype=vb shiftwidth=4 expandtab -' -' START_INDENT -Public Type GEmployeeRecord ' Create user-defined type. - ID As Integer ' Define elements of data type. - Name As String * 20 - Address As String * 30 - Phone As Long - HireDate As Date -End Type - -Public Enum InterfaceColors - icMistyRose = &HE1E4FF& - icSlateGray = &H908070& - icDodgerBlue = &HFF901E& - icDeepSkyBlue = &HFFBF00& - icSpringGreen = &H7FFF00& - icForestGreen = &H228B22& - icGoldenrod = &H20A5DA& - icFirebrick = &H2222B2& -End Enum - -Enum SecurityLevel - IllegalEntry = -1 - SecurityLevel1 = 0 - SecurityLevel2 = 1 -End Enum - -Public Function TestConditional (number As Integer, ext As String) As Boolean - Dim inRange As Boolean - - Select Case number - Case <= 0 - inRange = False - Case > 10 - inRange = False - Case Else - inRange = True - End Select - - ' This is a special case identified in the indent script. - Select Case number - End Select - - If ext = ".xlm" Then - If inRange Then - TestConditional = True - Else - TestConditional = False - End If - ElseIf ext = ".xlsx" Then - If inRange Then - TestConditional = False - Else - TestConditional = True - End If - Else - TestConditional = False - End If -End Function - -Private Sub TestIterators (lLimit As Integer, uLimit As Integer) - Dim a() As Variant - Dim elmt As Variant - Dim found As Boolean - Dim indx As Integer - Const specialValue As Integer = 5 - - If uLimit < lLimit Then - Exit Sub - End If - - ReDim a(lLimit To uLimit) - For indx=lLimit To Ulimit - a(indx) = 2 * indx - Next indx - - found = False - For Each elmt in a - If elmt = specialValue Then - found = True - End If - Next elmt - - If found then - indx = uLimit - Do While indx >= lLimit - indx = indx - 1 - Loop - End If - -End Sub - -Public Sub TestMultiline (cellAddr As String, rowNbr As Long) - Dim rng As Range - - Set rng = Range(cellAddr) - With rng - .Cells(1,1).Value = _ - "Line 1 of multiline string; " & _ - "Line 2 of multiline string; " & _ - "Line 3 of multiline string" - End With - - ' The following lines have whitespace after the underscore character - ' and therefore do not form a valid multiline statement. The indent - ' script correctly treats them as four single line statements contrary - ' to the author's obvious indent. - rng..Cells(1,1).Value = _ - "Line 1 of multiline string; " & _ - "Line 2 of multiline string; " & _ - "Line 3 of multiline string" - -End Sub - -Private Sub TestStmtLabel() - GoTo stmtLabel - - ' Statement labels are never indented -stmtLabel: - -End Sub - -Sub TestTypeKeyword() - Type EmployeeRecord ' Create user-defined type. - ID As Integer ' Define elements of data type. - Name As String * 20 - Address As String * 30 - Phone As Long - HireDate As Date - End Type - Dim varType As EmployeeRecord -End Sub -' END_INDENT diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in @@ -1,113 +0,0 @@ -" vim: set ft=vim sw=4 : - -" START_INDENT - -func Some() -let x = 1 -endfunc - -let cmd = -\ 'some ' -\ 'string' - -if 1 -let x = [ -\ ] -endif - -" TODO: add searchpair() to find matching { -"for x in [ -"{ -"key: 'value' -"}, -"] -"eval 0 -"endfor - -for x in [ -{key: 'value'}, -] -eval 0 -endfor - -let t = [ -\ { -\ 'k': 'val', -\ }, -\ ] - -def Func() - var d = dd - ->extend({ - }) - eval 0 -enddef - -" END_INDENT - -" START_INDENT -" INDENT_EXE let g:vim_indent_cont = 6 - -let cmd = -\ 'some ' -\ 'string' - -" END_INDENT - -" START_INDENT -" INDENT_EXE let g:vim_indent_cont = 5 - -let list = [ -\ 'one', -\ 'two'] - -" END_INDENT - -" START_INDENT -" INDENT_EXE unlet g:vim_indent_cont - -let list = [ -'one', -'two', -] -echo - -" END_INDENT - -" START_INDENT -" INDENT_AT this-line -func Some() -let f = x " this-line -endfunc -" END_INDENT - -" START_INDENT -" INDENT_NEXT next-line -func Some() - " next-line -let f = x -endfunc -" END_INDENT - -" START_INDENT -" INDENT_PREV prev-line -func Some() -let f = x -" prev-line -endfunc -" END_INDENT - -" START_INDENT -let a =<< END -nothing -END -" END_INDENT - -" START_INDENT -" INDENT_AT this-line -let a=<< trim END - blah - blah - blah this-line -END -" END_INDENT diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok @@ -1,113 +0,0 @@ -" vim: set ft=vim sw=4 : - -" START_INDENT - -func Some() - let x = 1 -endfunc - -let cmd = - \ 'some ' - \ 'string' - -if 1 - let x = [ - \ ] -endif - -" TODO: add searchpair() to find matching { -"for x in [ -"{ -"key: 'value' -"}, -"] -"eval 0 -"endfor - -for x in [ - {key: 'value'}, - ] - eval 0 -endfor - -let t = [ - \ { - \ 'k': 'val', - \ }, - \ ] - -def Func() - var d = dd - ->extend({ - }) - eval 0 -enddef - -" END_INDENT - -" START_INDENT -" INDENT_EXE let g:vim_indent_cont = 6 - -let cmd = - \ 'some ' - \ 'string' - -" END_INDENT - -" START_INDENT -" INDENT_EXE let g:vim_indent_cont = 5 - -let list = [ - \ 'one', - \ 'two'] - -" END_INDENT - -" START_INDENT -" INDENT_EXE unlet g:vim_indent_cont - -let list = [ - 'one', - 'two', - ] -echo - -" END_INDENT - -" START_INDENT -" INDENT_AT this-line -func Some() - let f = x " this-line -endfunc -" END_INDENT - -" START_INDENT -" INDENT_NEXT next-line -func Some() - " next-line - let f = x -endfunc -" END_INDENT - -" START_INDENT -" INDENT_PREV prev-line -func Some() - let f = x -" prev-line -endfunc -" END_INDENT - -" START_INDENT -let a =<< END - nothing -END -" END_INDENT - -" START_INDENT -" INDENT_AT this-line -let a=<< trim END - blah - blah - blah this-line -END -" END_INDENT diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in @@ -1,32 +0,0 @@ -<!-- vim: set ft=xml ts=8 sw=0 sts=-1 et : --> -<!-- START_INDENT --> -<?xml version="1.0" encoding="utf-8"?> -<tag0> - <tag1> -<!-- comment --> -<tag2> - <tag3/> -</tag2> -<!-- text comment --> - -<!-- -text comment ---> -</tag1> -<!-- -text comment -end comment --> -</tag0> -<!-- END_INDENT --> - -<!-- START_INDENT --> -<?xml version="1.0" encoding="utf-8"?> -<tag0> - <tag1> -<!-- comment --> -<tag2> - <tag3/> -</tag2> -</tag1> -</tag0> -<!-- END_INDENT --> diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok @@ -1,32 +0,0 @@ -<!-- vim: set ft=xml ts=8 sw=0 sts=-1 et : --> -<!-- START_INDENT --> -<?xml version="1.0" encoding="utf-8"?> -<tag0> - <tag1> - <!-- comment --> - <tag2> - <tag3/> - </tag2> - <!-- text comment --> - - <!-- - text comment - --> - </tag1> - <!-- - text comment - end comment --> -</tag0> -<!-- END_INDENT --> - -<!-- START_INDENT --> -<?xml version="1.0" encoding="utf-8"?> -<tag0> - <tag1> - <!-- comment --> - <tag2> - <tag3/> - </tag2> - </tag1> -</tag0> -<!-- END_INDENT --> diff --git a/runtime/indent/testdir/yaml.in b/runtime/indent/testdir/yaml.in @@ -1,20 +0,0 @@ -# vim: set ft=yaml sw=2 et : - -# START_INDENT -map1: -sub1: -- list item -map2: -- another list -# END_INDENT - -# START_INDENT -map: &anchor -map: val -# END_INDENT - -# START_INDENT -map: | -line1 -line2 -# END_INDENT diff --git a/runtime/indent/testdir/yaml.ok b/runtime/indent/testdir/yaml.ok @@ -1,20 +0,0 @@ -# vim: set ft=yaml sw=2 et : - -# START_INDENT -map1: - sub1: - - list item -map2: - - another list -# END_INDENT - -# START_INDENT -map: &anchor -map: val -# END_INDENT - -# START_INDENT -map: | - line1 - line2 -# END_INDENT diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh @@ -196,43 +196,47 @@ preprocess_patch() { # Remove Filelist, README local na_files='Filelist\|README.*' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/\<\%('"${na_files}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/\<\%('"${na_files}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove *.proto, Make*, INSTALL*, gui_*, beval.*, some if_*, gvim, libvterm, tee, VisVim, xpm, xxd local na_src='auto\|configure.*\|GvimExt\|hardcopy.*\|libvterm\|proto\|tee\|VisVim\|xpm\|xxd\|Make.*\|INSTALL.*\|beval.*\|gui.*\|if_cscop\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove runtime/print/ local na_rt='print\/.*' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('"${na_rt}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/runtime/\<\%('"${na_rt}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove unwanted Vim doc files. local na_doc='channel\.txt\|if_cscop\.txt\|netbeans\.txt\|os_\w\+\.txt\|print\.txt\|term\.txt\|testing\.txt\|todo\.txt\|vim9\.txt\|tags' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('"${na_doc}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/runtime/doc/\<\%('"${na_doc}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove "Last change ..." changes in doc files. 2>/dev/null $nvim --cmd 'set dir=/tmp' +'%s/^@@.*\n.*For Vim version.*Last change.*\n.*For Vim version.*Last change.*//' +w +q "$file" # Remove gui, setup, screen dumps, testdir/Make_*.mak files local na_src_testdir='gui_.*\|Make_amiga\.mak\|Make_dos\.mak\|Make_ming\.mak\|Make_vms\.mms\|dumps/.*\.dump\|setup_gui\.vim' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/src/testdir/\<\%('"${na_src_testdir}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove testdir/test_*.vim files local na_src_testdir='balloon.*\|behave\.vim\|channel.*\|crypt\.vim\|cscope\.vim\|gui.*\|hardcopy\.vim\|job_fails\.vim\|json\.vim\|listener\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|python2\.vim\|pyx2\.vim\|restricted\.vim\|shortpathname\.vim\|sound\.vim\|tcl\.vim\|terminal.*\|xxd\.vim' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + + # Remove runtime/*/testdir/ files + local na_runtime_testdir='.\+' + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/runtime/\f\+/testdir/\%('${na_runtime_testdir}'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove N/A src/*.[ch] files: sound.c, version.c local na_src_c='sound\|version' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\<\%('"${na_src_c}"'\)\.[ch]\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/src/\<\%('"${na_src_c}"'\)\.[ch]\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove some *.po files. #5622 # Also remove vim.pot which is updated on almost every source change. local na_po='sjiscorr\.c\|ja\.sjis\.po\|ko\.po\|pl\.cp1250\.po\|pl\.po\|ru\.cp1251\.po\|uk\.cp1251\.po\|zh_CN\.cp936\.po\|zh_CN\.po\|zh_TW\.po\|vim\.pot' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/src/po/\<\%('${na_po}'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Remove vimrc_example.vim local na_vimrcexample='vimrc_example\.vim' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('${na_vimrcexample}'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git [ab]/runtime/\<\%('${na_vimrcexample}'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file" # Rename src/testdir/ paths to test/old/testdir/ LC_ALL=C sed -Ee 's/( [ab])\/src\/testdir/\1\/test\/old\/testdir/g' \