Mercurial > vim
annotate runtime/syntax/aap.vim @ 33083:79b2eb83f2df v9.0.1827
patch 9.0.1827: xxd: no color support
Commit: https://github.com/vim/vim/commit/e2528ae11134cdf35c312754b124aba4963d8054
Author: Aapo Rantalainen <aapo.rantalainen@gmail.com>
Date: Thu Aug 31 17:58:13 2023 +0200
patch 9.0.1827: xxd: no color support
Problem: xxd: no color support
Solution: Add color support using xxd -R
Add some basic color support for xxd
The hex-value and value are both colored with the same color depending
on the hex-value, e.g.:
0x00 = white
0xff = blue
printable = green
non-printable = red
tabs and linebreaks = yellow
Each character needs 11 more bytes to contain color. (Same color in a
row could contain only one overhead but the logic how xxd creates colums
must be then changed.) Size of colored output is increased by factor of
~6. Also grepping the output will break when colors is used.
Flag for color is "-R", because less uses "-R".
Color uses parameters auto,always,never same as less and grep (among
others).
E.g.
xxd -R always $FILE | less -R
Add some screen-tests (that currently on work on linux) to verify the
feature works as expected.
closes: #12131
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Aapo Rantalainen <aapo.rantalainen@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 31 Aug 2023 18:15:03 +0200 |
parents | 4027cefc2aab |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: A-A-P recipe | |
32770
4027cefc2aab
Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
3 " Maintainer: The Vim Project <https://github.com/vim/vim> |
4027cefc2aab
Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
4 " Last Change: 2023 Aug 10 |
4027cefc2aab
Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> |
7 | 6 |
7 " Quit when a syntax file was already loaded | |
8 if exists("b:current_syntax") | |
9 finish | |
10 endif | |
11 | |
12 let s:cpo_save = &cpo | |
13 set cpo&vim | |
14 | |
15 syn include @aapPythonScript syntax/python.vim | |
16 | |
17 syn match aapVariable /$[-+?*="'\\!]*[a-zA-Z0-9_.]*/ | |
18 syn match aapVariable /$[-+?*="'\\!]*([a-zA-Z0-9_.]*)/ | |
19 syn keyword aapTodo contained TODO Todo | |
20 syn match aapString +'[^']\{-}'+ | |
21 syn match aapString +"[^"]\{-}"+ | |
22 | |
23 syn match aapCommand '^\s*:action\>' | |
24 syn match aapCommand '^\s*:add\>' | |
25 syn match aapCommand '^\s*:addall\>' | |
26 syn match aapCommand '^\s*:asroot\>' | |
27 syn match aapCommand '^\s*:assertpkg\>' | |
28 syn match aapCommand '^\s*:attr\>' | |
29 syn match aapCommand '^\s*:attribute\>' | |
30 syn match aapCommand '^\s*:autodepend\>' | |
31 syn match aapCommand '^\s*:buildcheck\>' | |
32 syn match aapCommand '^\s*:cd\>' | |
33 syn match aapCommand '^\s*:chdir\>' | |
34 syn match aapCommand '^\s*:checkin\>' | |
35 syn match aapCommand '^\s*:checkout\>' | |
36 syn match aapCommand '^\s*:child\>' | |
37 syn match aapCommand '^\s*:chmod\>' | |
38 syn match aapCommand '^\s*:commit\>' | |
39 syn match aapCommand '^\s*:commitall\>' | |
40 syn match aapCommand '^\s*:conf\>' | |
41 syn match aapCommand '^\s*:copy\>' | |
42 syn match aapCommand '^\s*:del\>' | |
43 syn match aapCommand '^\s*:deldir\>' | |
44 syn match aapCommand '^\s*:delete\>' | |
45 syn match aapCommand '^\s*:delrule\>' | |
46 syn match aapCommand '^\s*:dll\>' | |
47 syn match aapCommand '^\s*:do\>' | |
48 syn match aapCommand '^\s*:error\>' | |
49 syn match aapCommand '^\s*:execute\>' | |
50 syn match aapCommand '^\s*:exit\>' | |
51 syn match aapCommand '^\s*:export\>' | |
52 syn match aapCommand '^\s*:fetch\>' | |
53 syn match aapCommand '^\s*:fetchall\>' | |
54 syn match aapCommand '^\s*:filetype\>' | |
55 syn match aapCommand '^\s*:finish\>' | |
56 syn match aapCommand '^\s*:global\>' | |
57 syn match aapCommand '^\s*:import\>' | |
58 syn match aapCommand '^\s*:include\>' | |
59 syn match aapCommand '^\s*:installpkg\>' | |
60 syn match aapCommand '^\s*:lib\>' | |
61 syn match aapCommand '^\s*:local\>' | |
62 syn match aapCommand '^\s*:log\>' | |
63 syn match aapCommand '^\s*:ltlib\>' | |
64 syn match aapCommand '^\s*:mkdir\>' | |
65 syn match aapCommand '^\s*:mkdownload\>' | |
66 syn match aapCommand '^\s*:move\>' | |
67 syn match aapCommand '^\s*:pass\>' | |
68 syn match aapCommand '^\s*:popdir\>' | |
69 syn match aapCommand '^\s*:produce\>' | |
70 syn match aapCommand '^\s*:program\>' | |
71 syn match aapCommand '^\s*:progsearch\>' | |
72 syn match aapCommand '^\s*:publish\>' | |
73 syn match aapCommand '^\s*:publishall\>' | |
74 syn match aapCommand '^\s*:pushdir\>' | |
75 syn match aapCommand '^\s*:quit\>' | |
76 syn match aapCommand '^\s*:recipe\>' | |
77 syn match aapCommand '^\s*:refresh\>' | |
78 syn match aapCommand '^\s*:remove\>' | |
79 syn match aapCommand '^\s*:removeall\>' | |
80 syn match aapCommand '^\s*:require\>' | |
81 syn match aapCommand '^\s*:revise\>' | |
82 syn match aapCommand '^\s*:reviseall\>' | |
83 syn match aapCommand '^\s*:route\>' | |
84 syn match aapCommand '^\s*:rule\>' | |
85 syn match aapCommand '^\s*:start\>' | |
86 syn match aapCommand '^\s*:symlink\>' | |
87 syn match aapCommand '^\s*:sys\>' | |
88 syn match aapCommand '^\s*:sysdepend\>' | |
89 syn match aapCommand '^\s*:syspath\>' | |
90 syn match aapCommand '^\s*:system\>' | |
91 syn match aapCommand '^\s*:tag\>' | |
92 syn match aapCommand '^\s*:tagall\>' | |
93 syn match aapCommand '^\s*:toolsearch\>' | |
94 syn match aapCommand '^\s*:totype\>' | |
95 syn match aapCommand '^\s*:touch\>' | |
96 syn match aapCommand '^\s*:tree\>' | |
97 syn match aapCommand '^\s*:unlock\>' | |
98 syn match aapCommand '^\s*:update\>' | |
99 syn match aapCommand '^\s*:usetool\>' | |
100 syn match aapCommand '^\s*:variant\>' | |
101 syn match aapCommand '^\s*:verscont\>' | |
102 | |
103 syn match aapCommand '^\s*:print\>' nextgroup=aapPipeEnd | |
104 syn match aapPipeCmd '\s*:print\>' nextgroup=aapPipeEnd contained | |
105 syn match aapCommand '^\s*:cat\>' nextgroup=aapPipeEnd | |
106 syn match aapPipeCmd '\s*:cat\>' nextgroup=aapPipeEnd contained | |
107 syn match aapCommand '^\s*:syseval\>' nextgroup=aapPipeEnd | |
108 syn match aapPipeCmd '\s*:syseval\>' nextgroup=aapPipeEnd contained | |
109 syn match aapPipeCmd '\s*:assign\>' contained | |
110 syn match aapCommand '^\s*:eval\>' nextgroup=aapPipeEnd | |
111 syn match aapPipeCmd '\s*:eval\>' nextgroup=aapPipeEndPy contained | |
112 syn match aapPipeCmd '\s*:tee\>' nextgroup=aapPipeEnd contained | |
113 syn match aapPipeCmd '\s*:log\>' nextgroup=aapPipeEnd contained | |
114 syn match aapPipeEnd '[^|]*|' nextgroup=aapPipeCmd contained skipnl | |
115 syn match aapPipeEndPy '[^|]*|' nextgroup=aapPipeCmd contained skipnl contains=@aapPythonScript | |
116 syn match aapPipeStart '^\s*|' nextgroup=aapPipeCmd | |
117 | |
118 " | |
119 " A Python line starts with @. Can be continued with a trailing backslash. | |
120 syn region aapPythonRegion start="\s*@" skip='\\$' end=+$+ contains=@aapPythonScript keepend | |
121 " | |
122 " A Python block starts with ":python" and continues so long as the indent is | |
123 " bigger. | |
124 syn region aapPythonRegion matchgroup=aapCommand start="\z(\s*\):python" skip='\n\z1\s\|\n\s*\n' end=+$+ contains=@aapPythonScript | |
125 | |
126 " A Python expression is enclosed in backticks. | |
127 syn region aapPythonRegion start="`" skip="``" end="`" contains=@aapPythonScript | |
128 | |
129 " TODO: There is something wrong with line continuation. | |
130 syn match aapComment '#.*' contains=aapTodo | |
131 syn match aapComment '#.*\(\\\n.*\)' contains=aapTodo | |
132 | |
133 syn match aapSpecial '$#' | |
134 syn match aapSpecial '$\$' | |
135 syn match aapSpecial '$(.)' | |
136 | |
137 " A heredoc assignment. | |
138 syn region aapHeredoc start="^\s*\k\+\s*$\=+\=?\=<<\s*\z(\S*\)"hs=e+1 end="^\s*\z1\s*$"he=s-1 | |
139 | |
140 " Syncing is needed for ":python" and "VAR << EOF". Don't use Python syncing | |
141 syn sync clear | |
142 syn sync fromstart | |
143 | |
144 " The default highlighting. | |
145 hi def link aapTodo Todo | |
146 hi def link aapString String | |
147 hi def link aapComment Comment | |
148 hi def link aapSpecial Special | |
149 hi def link aapVariable Identifier | |
150 hi def link aapPipeCmd aapCommand | |
151 hi def link aapCommand Statement | |
152 hi def link aapHeredoc Constant | |
153 | |
154 let b:current_syntax = "aap" | |
155 | |
156 let &cpo = s:cpo_save | |
157 unlet s:cpo_save | |
158 | |
159 " vim: ts=8 |