blob: 1e39451dcd95bf4c22da136e61fa676b93bd8dbe [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: none; used to see highlighting
3" Maintainer: Ronald Schild <rs@scutum.de>
Bram Moolenaarf55e4c82017-08-01 20:44:53 +02004" Last Change: 2017 Jul 28
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114" we don't want to save this temporary file
115set nomodified
116
117" the following trick avoids the "Press RETURN ..." prompt
1180 append
119.
120
121" restore global options and registers
122let &hidden = s:hidden
123let &lazyredraw = s:lazyredraw
124let &more = s:more
125let &report = s:report
126let &shortmess = s:shortmess
127let &wrapscan = s:wrapscan
128let @a = s:register_a
129
130" restore last search pattern
131call histdel("search", -1)
132let @/ = s:register_se
133
134" remove variables
135unlet s:hidden s:lazyredraw s:more s:report s:shortmess
136unlet s:wrapscan s:register_a s:register_se
137
138" vim: ts=8