Mercurial > vim
annotate runtime/colors/tools/check_colors.vim @ 20601:75ef263d09d6 v8.2.0854
patch 8.2.0854: xxd cannot show offset as a decimal number
Commit: https://github.com/vim/vim/commit/363d6148dfc2cc17fb0d286c7a36c305f56f5813
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 30 20:50:25 2020 +0200
patch 8.2.0854: xxd cannot show offset as a decimal number
Problem: Xxd cannot show offset as a decimal number.
Solution: Add the "-d" flag. (Aapo Rantalainen, closes https://github.com/vim/vim/issues/5616
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 May 2020 21:00:12 +0200 |
parents | 072ae5089541 |
children | 0db0640e16e0 |
rev | line source |
---|---|
16808 | 1 " This script tests a color scheme for some errors and lists potential errors. |
2 " Load the scheme and source this script, like this: | |
3 " :edit colors/desert.vim | :so colors/tools/check_colors.vim | |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 let s:save_cpo= &cpo |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 set cpo&vim |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func! Test_check_colors() |
16808 | 9 let l:savedview = winsaveview() |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call cursor(1,1) |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
11 let err = {} |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 " 1) Check g:colors_name is existing |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 if !search('\<\%(g:\)\?colors_name\>', 'cnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 let err['colors_name'] = 'g:colors_name not set' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 else |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let err['colors_name'] = 'OK' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " 2) Check for some well-defined highlighting groups |
16808 | 21 let hi_groups = [ |
22 \ 'ColorColumn', | |
23 \ 'Comment', | |
24 \ 'Conceal', | |
25 \ 'Constant', | |
26 \ 'Cursor', | |
27 \ 'CursorColumn', | |
28 \ 'CursorLine', | |
29 \ 'CursorLineNr', | |
30 \ 'DiffAdd', | |
31 \ 'DiffChange', | |
32 \ 'DiffDelete', | |
33 \ 'DiffText', | |
34 \ 'Directory', | |
35 \ 'EndOfBuffer', | |
36 \ 'Error', | |
37 \ 'ErrorMsg', | |
38 \ 'FoldColumn', | |
39 \ 'Folded', | |
40 \ 'Identifier', | |
41 \ 'Ignore', | |
42 \ 'IncSearch', | |
43 \ 'LineNr', | |
44 \ 'MatchParen', | |
45 \ 'ModeMsg', | |
46 \ 'MoreMsg', | |
47 \ 'NonText', | |
48 \ 'Normal', | |
49 \ 'Pmenu', | |
50 \ 'PmenuSbar', | |
51 \ 'PmenuSel', | |
52 \ 'PmenuThumb', | |
53 \ 'PreProc', | |
54 \ 'Question', | |
55 \ 'QuickFixLine', | |
56 \ 'Search', | |
57 \ 'SignColumn', | |
58 \ 'Special', | |
59 \ 'SpecialKey', | |
60 \ 'SpellBad', | |
61 \ 'SpellCap', | |
62 \ 'SpellLocal', | |
63 \ 'SpellRare', | |
64 \ 'Statement', | |
65 \ 'StatusLine', | |
66 \ 'StatusLineNC', | |
67 \ 'StatusLineTerm', | |
68 \ 'StatusLineTermNC', | |
69 \ 'TabLine', | |
70 \ 'TabLineFill', | |
71 \ 'TabLineSel', | |
72 \ 'Title', | |
73 \ 'Todo', | |
74 \ 'ToolbarButton', | |
75 \ 'ToolbarLine', | |
76 \ 'Type', | |
77 \ 'Underlined', | |
78 \ 'VertSplit', | |
79 \ 'Visual', | |
80 \ 'VisualNOS', | |
81 \ 'WarningMsg', | |
82 \ 'WildMenu', | |
83 \ ] | |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
84 let groups = {} |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 for group in hi_groups |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
86 if search('\c@suppress\s\+\<' .. group .. '\>', 'cnW') |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " skip check, if the script contains a line like |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 " @suppress Visual: |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 continue |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 endif |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
91 if search('hi\%[ghlight]!\= \+link \+' .. group, 'cnW') " Linked group |
16808 | 92 continue |
93 endif | |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
94 if !search('hi\%[ghlight] \+\<' .. group .. '\>', 'cnW') |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
95 let groups[group] = 'No highlight definition for ' .. group |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 continue |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 endif |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
98 if !search('hi\%[ghlight] \+\<' .. group .. '\>.*[bf]g=', 'cnW') |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
99 let groups[group] = 'Missing foreground or background color for ' .. group |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
100 continue |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
101 endif |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
102 if search('hi\%[ghlight] \+\<' .. group .. '\>.*guibg=', 'cnW') && |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
103 \ !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermbg=', 'cnW') |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
104 \ && group != 'Cursor' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
105 let groups[group] = 'Missing bg terminal color for ' .. group |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 continue |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 endif |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
108 if !search('hi\%[ghlight] \+\<' .. group .. '\>.*guifg=', 'cnW') |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
109 \ && group !~ '^Diff' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
110 let groups[group] = 'Missing guifg definition for ' .. group |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 continue |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 endif |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
113 if !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermfg=', 'cnW') |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
114 \ && group !~ '^Diff' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
115 \ && group != 'Cursor' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
116 let groups[group] = 'Missing ctermfg definition for ' .. group |
16808 | 117 continue |
118 endif | |
119 " do not check for background colors, they could be intentionally left out | |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 call cursor(1,1) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 endfor |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 let err['highlight'] = groups |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 " 3) Check, that it does not set background highlighting |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 " Doesn't ':hi Normal ctermfg=253 ctermfg=233' also set the background sometimes? |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
126 let bg_set = '\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
127 let bg_let = 'let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
128 let bg_pat = '\%(' .. bg_set .. '\|' .. bg_let .. '\)' |
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
129 let line = search(bg_pat, 'cnW') |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 if search(bg_pat, 'cnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 exe line |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 if search('hi \U\w\+\s\+\S', 'cbnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 let err['background'] = 'Should not set background option after :hi statement' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 else |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 let err['background'] = 'OK' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call cursor(1,1) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 " 4) Check, that t_Co is checked |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 let pat = '[&]t_Co\s*[<>=]=\?\s*\d\+' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 if !search(pat, 'ncW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 let err['t_Co'] = 'Does not check terminal for capable colors' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 " 5) Initializes correctly, e.g. should have a section like |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 " hi clear |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 " if exists("syntax_on") |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 " syntax reset |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 " endif |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
151 let pat = 'hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif' |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 if !search(pat, 'cnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 let err['init'] = 'No initialization' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 " 6) Does not use :syn on |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 if search('syn\%[tax]\s\+on', 'cnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 let err['background'] = 'Should not issue :syn on' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 |
14123 | 161 " 7) Does not define filetype specific groups like vimCommand, htmlTag, |
16808 | 162 let hi_groups = filter(getcompletion('', 'filetype'), { _,v -> v !~# '\%[no]syn\%(color\|load\|tax\)' }) |
163 let ft_groups = [] | |
164 " let group = '\%('.join(hi_groups, '\|').'\)' " More efficient than a for loop, but less informative | |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 for group in hi_groups |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
166 let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\w\+\>\ze \+.' " Skips `hi clear` |
16808 | 167 if search(pat, 'cW') |
168 call add(ft_groups, matchstr(getline('.'), pat)) | |
169 endif | |
170 call cursor(1,1) | |
171 endfor | |
172 if !empty(ft_groups) | |
173 let err['filetype'] = get(err, 'filetype', 'Should not define: ') . join(uniq(sort(ft_groups))) | |
174 endif | |
175 | |
176 " 8) Were debugPC and debugBreakpoint defined? | |
177 for group in ['debugPC', 'debugBreakpoint'] | |
17350
072ae5089541
patch 8.1.1674: script to check a colorscheme can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16808
diff
changeset
|
178 let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\>' |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 if search(pat, 'cnW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 let line = search(pat, 'cW') |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 let err['filetype'] = get(err, 'filetype', 'Should not define: ') . matchstr(getline('.'), pat). ' ' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 call cursor(1,1) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 endfor |
16808 | 185 |
186 " 9) Normal should be defined first, not use reverse, fg or bg | |
187 call cursor(1,1) | |
188 let pat = 'hi\%[light] \+\%(link\|clear\)\@!\w\+\>' | |
189 call search(pat, 'cW') " Look for the first hi def, skipping `hi link` and `hi clear` | |
190 if getline('.') !~# '\m\<Normal\>' | |
191 let err['highlight']['Normal'] = 'Should be defined first' | |
192 elseif getline('.') =~# '\m\%(=\%(fg\|bg\)\)' | |
193 let err['highlight']['Normal'] = "Should not use 'fg' or 'bg'" | |
194 elseif getline('.') =~# '\m=\%(inv\|rev\)erse' | |
195 let err['highlight']['Normal'] = 'Should not use reverse mode' | |
196 endif | |
197 | |
198 call winrestview(l:savedview) | |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 let g:err = err |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 " print Result |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 call Result(err) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 endfu |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 fu! Result(err) |
16808 | 206 let do_groups = 0 |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 echohl Title|echomsg "---------------"|echohl Normal |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 for key in sort(keys(a:err)) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 if key is# 'highlight' |
16808 | 210 let do_groups = !empty(a:err[key]) |
13049
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 continue |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 else |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 if a:err[key] !~ 'OK' |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 echohl Title |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 echomsg printf("%15s: %s", key, a:err[key]) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 echohl Normal |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 endfor |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 echohl Title|echomsg "---------------"|echohl Normal |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 if do_groups |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 echohl Title | echomsg "Groups" | echohl Normal |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 for v1 in sort(keys(a:err['highlight'])) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 echomsg printf("%25s: %s", v1, a:err['highlight'][v1]) |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 endfor |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 endif |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 endfu |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call Test_check_colors() |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 let &cpo = s:save_cpo |
0d23a49da746
patch 8.0.1400: color scheme check script shows up as color scheme
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 unlet s:save_cpo |