1" Vim syntax file
2" Language:	none; used to see highlighting
3" Maintainer:	Ronald Schild <rs@scutum.de>
4" Last Change:	2001 Sep 02
5" Version:	5.4n.1
6
7" To see your current highlight settings, do
8"    :so $VIMRUNTIME/syntax/hitest.vim
9
10" save global options and registers
11let s:hidden      = &hidden
12let s:lazyredraw  = &lazyredraw
13let s:more	  = &more
14let s:report      = &report
15let s:shortmess   = &shortmess
16let s:wrapscan    = &wrapscan
17let s:register_a  = @a
18let s:register_se = @/
19
20" set global options
21set hidden lazyredraw nomore report=99999 shortmess=aoOstTW wrapscan
22
23" print current highlight settings into register a
24redir @a
25highlight
26redir END
27
28" Open a new window if the current one isn't empty
29if line("$") != 1 || getline(1) != ""
30  new
31endif
32
33" edit temporary file
34edit Highlight\ test
35
36" set local options
37setlocal autoindent noexpandtab formatoptions=t shiftwidth=16 noswapfile tabstop=16
38let &textwidth=&columns
39
40" insert highlight settings
41% delete
42put a
43
44" remove the colored xxx items
45g/xxx /s///e
46
47" remove color settings (not needed here)
48global! /links to/ substitute /\s.*$//e
49
50" move linked groups to the end of file
51global /links to/ move $
52
53" move linked group names to the matching preferred groups
54% substitute /^\(\w\+\)\s*\(links to\)\s*\(\w\+\)$/\3\t\2 \1/e
55global /links to/ normal mz3ElD0#$p'zdd
56
57" delete empty lines
58global /^ *$/ delete
59
60" precede syntax command
61% substitute /^[^ ]*/syn keyword &\t&/
62
63" execute syntax commands
64syntax clear
65% yank a
66@a
67
68" remove syntax commands again
69% substitute /^syn keyword //
70
71" pretty formatting
72global /^/ exe "normal Wi\<CR>\t\eAA\ex"
73global /^\S/ join
74
75" find out first syntax highlighting
76let b:various = &highlight.',:Normal,:Cursor,:,'
77let b:i = 1
78while b:various =~ ':'.substitute(getline(b:i), '\s.*$', ',', '')
79   let b:i = b:i + 1
80   if b:i > line("$") | break | endif
81endwhile
82
83" insert headlines
84call append(0, "Highlighting groups for various occasions")
85call append(1, "-----------------------------------------")
86
87if b:i < line("$")-1
88   let b:synhead = "Syntax highlighting groups"
89   if exists("hitest_filetypes")
90      redir @a
91      let
92      redir END
93      let @a = substitute(@a, 'did_\(\w\+\)_syn\w*_inits\s*#1', ', \1', 'g')
94      let @a = substitute(@a, "\n\\w[^\n]*", '', 'g')
95      let @a = substitute(@a, "\n", '', 'g')
96      let @a = substitute(@a, '^,', '', 'g')
97      if @a != ""
98	 let b:synhead = b:synhead." - filetype"
99	 if @a =~ ','
100	    let b:synhead = b:synhead."s"
101	 endif
102	 let b:synhead = b:synhead.":".@a
103      endif
104   endif
105   call append(b:i+1, "")
106   call append(b:i+2, b:synhead)
107   call append(b:i+3, substitute(b:synhead, '.', '-', 'g'))
108endif
109
110" remove 'hls' highlighting
111nohlsearch
112normal 0
113
114" add autocommands to remove temporary file from buffer list
115aug highlighttest
116   au!
117   au BufUnload Highlight\ test if expand("<afile>") == "Highlight test"
118   au BufUnload Highlight\ test    bdelete! Highlight\ test
119   au BufUnload Highlight\ test endif
120   au VimLeavePre * if bufexists("Highlight test")
121   au VimLeavePre *    bdelete! Highlight\ test
122   au VimLeavePre * endif
123aug END
124
125" we don't want to save this temporary file
126set nomodified
127
128" the following trick avoids the "Press RETURN ..." prompt
1290 append
130.
131
132" restore global options and registers
133let &hidden      = s:hidden
134let &lazyredraw  = s:lazyredraw
135let &more	 = s:more
136let &report	 = s:report
137let &shortmess	 = s:shortmess
138let &wrapscan	 = s:wrapscan
139let @a		 = s:register_a
140
141" restore last search pattern
142call histdel("search", -1)
143let @/ = s:register_se
144
145" remove variables
146unlet s:hidden s:lazyredraw s:more s:report s:shortmess
147unlet s:wrapscan s:register_a s:register_se
148
149" vim: ts=8
150