annotate runtime/syntax/hitest.vim @ 2823:8bd38abda314 v7.3.187

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