about summary refs log tree commit diff
path: root/Util
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2019-12-27 06:09:59 +0000
committerDaniel Shahaf <danielsh@apache.org>2019-12-27 06:11:28 +0000
commit4a2a15d8dc8d310d537ababc2abba0fe444276a8 (patch)
treefa6879514df5c9413d95632026c0fee25234928e /Util
parent02a33dd071c616a476465ead1bc2a62d37b297f6 (diff)
downloadzsh-4a2a15d8dc8d310d537ababc2abba0fe444276a8.tar.gz
zsh-4a2a15d8dc8d310d537ababc2abba0fe444276a8.tar.xz
zsh-4a2a15d8dc8d310d537ababc2abba0fe444276a8.zip
unposted: internal: Vim ztst support: Add an ftplugin in addition to the syntax highlighter.
Diffstat (limited to 'Util')
-rw-r--r--Util/ztst-ftplugin.vim29
-rw-r--r--Util/ztst-syntax.vim (renamed from Util/ztst.vim)0
2 files changed, 29 insertions, 0 deletions
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 <CR> 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
index 8d8becfe7..8d8becfe7 100644
--- a/Util/ztst.vim
+++ b/Util/ztst-syntax.vim