Mercurial > vim
annotate runtime/syntax/obj.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 | 46763b01cd9a |
children |
rev | line source |
---|---|
2152 | 1 " Vim syntax file |
2 " Language: 3D wavefront's obj file | |
3 " Maintainer: Vincent Berthoux <twinside@gmail.com> | |
4 " File Types: .obj (used in 3D) | |
2206
a8afba7027ae
Add extra floating point functions.
Bram Moolenaar <bram@vim.org>
parents:
2152
diff
changeset
|
5 " Last Change: 2010 May 18 |
2152 | 6 " |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2206
diff
changeset
|
7 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2206
diff
changeset
|
8 if exists("b:current_syntax") |
2152 | 9 finish |
10 endif | |
11 | |
12 syn match objError "^\a\+" | |
13 | |
14 syn match objKeywords "^cstype\s" | |
15 syn match objKeywords "^ctech\s" | |
16 syn match objKeywords "^stech\s" | |
17 syn match objKeywords "^deg\s" | |
18 syn match objKeywords "^curv\(2\?\)\s" | |
19 syn match objKeywords "^parm\s" | |
20 syn match objKeywords "^surf\s" | |
21 syn match objKeywords "^end\s" | |
22 syn match objKeywords "^bzp\s" | |
23 syn match objKeywords "^bsp\s" | |
24 syn match objKeywords "^res\s" | |
25 syn match objKeywords "^cdc\s" | |
26 syn match objKeywords "^con\s" | |
27 | |
28 syn match objKeywords "^shadow_obj\s" | |
29 syn match objKeywords "^trace_obj\s" | |
30 syn match objKeywords "^usemap\s" | |
31 syn match objKeywords "^lod\s" | |
32 syn match objKeywords "^maplib\s" | |
33 syn match objKeywords "^d_interp\s" | |
34 syn match objKeywords "^c_interp\s" | |
35 syn match objKeywords "^bevel\s" | |
36 syn match objKeywords "^mg\s" | |
37 syn match objKeywords "^s\s" | |
38 syn match objKeywords "^con\s" | |
39 syn match objKeywords "^trim\s" | |
40 syn match objKeywords "^hole\s" | |
41 syn match objKeywords "^scrv\s" | |
42 syn match objKeywords "^sp\s" | |
43 syn match objKeywords "^step\s" | |
44 syn match objKeywords "^bmat\s" | |
45 syn match objKeywords "^csh\s" | |
46 syn match objKeywords "^call\s" | |
47 | |
48 syn match objComment "^#.*" | |
49 syn match objVertex "^v\s" | |
50 syn match objFace "^f\s" | |
51 syn match objVertice "^vt\s" | |
52 syn match objNormale "^vn\s" | |
53 syn match objGroup "^g\s.*" | |
54 syn match objMaterial "^usemtl\s.*" | |
55 syn match objInclude "^mtllib\s.*" | |
56 | |
57 syn match objFloat "-\?\d\+\.\d\+\(e\(+\|-\)\d\+\)\?" | |
58 syn match objInt "\d\+" | |
59 syn match objIndex "\d\+\/\d*\/\d*" | |
60 | |
61 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2206
diff
changeset
|
62 " Only when an item doesn't have highlighting yet |
2152 | 63 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
64 hi def link objError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
65 hi def link objComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
66 hi def link objInclude PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
67 hi def link objFloat Float |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
68 hi def link objInt Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
69 hi def link objGroup Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
70 hi def link objIndex Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
71 hi def link objMaterial Label |
2152 | 72 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
73 hi def link objVertex Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
74 hi def link objNormale Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
75 hi def link objVertice Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
76 hi def link objFace Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
77 hi def link objKeywords Keyword |
2152 | 78 |
79 | |
80 | |
81 let b:current_syntax = "obj" | |
82 | |
83 " vim: ts=8 |