annotate runtime/syntax/hitest.vim @ 26539:45d9468fd3f8

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