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