From 4a2a15d8dc8d310d537ababc2abba0fe444276a8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 27 Dec 2019 06:09:59 +0000 Subject: [PATCH] unposted: internal: Vim ztst support: Add an ftplugin in addition to the syntax highlighter. --- ChangeLog | 6 ++++++ Test/B01cd.ztst | 2 +- Util/ztst-ftplugin.vim | 29 +++++++++++++++++++++++++++++ Util/{ztst.vim => ztst-syntax.vim} | 0 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Util/ztst-ftplugin.vim rename Util/{ztst.vim => ztst-syntax.vim} (100%) diff --git a/ChangeLog b/ChangeLog index 399b69f22..1d97bd9ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-12-27 Daniel Shahaf + + * unposted: Test/B01cd.ztst, Util/ztst-ftplugin.vim, + Util/ztst-syntax.vim: internal: Vim ztst support: Add an ftplugin + in addition to the syntax highlighter. + 2019-12-26 dana * 45130: Completion/Base/Utility/_multi_parts: Always pass -f diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst index 6a5308259..f79e18f4b 100644 --- a/Test/B01cd.ztst +++ b/Test/B01cd.ztst @@ -106,7 +106,7 @@ # ZTST_skip: Set this in any test case if that single test case is to be # skipped. Testing resumes at the next test case in the same file. # -# Syntax highlighting for Vim is available, see Util/ztst.vim. +# Syntax highlighting for Vim is available, see Util/ztst-*.vim. cd cdtst.tmp/sub/fake && pwd && print $PWD diff --git a/Util/ztst-ftplugin.vim b/Util/ztst-ftplugin.vim new file mode 100644 index 000000000..60f2b526f --- /dev/null +++ b/Util/ztst-ftplugin.vim @@ -0,0 +1,29 @@ +" ztst filetype plugin + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Inherit zsh.vim +runtime! ftplugin/zsh.vim + +let b:undo_ftplugin .= "| setl fo< comments< commentstring<" + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format expected output/errput lines +setlocal comments+=:*>,:>,:*?,:?,:F: + +" Format comments to be up to 78 characters long +if &textwidth == 0 + setlocal textwidth=78 +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/Util/ztst.vim b/Util/ztst-syntax.vim similarity index 100% rename from Util/ztst.vim rename to Util/ztst-syntax.vim