This repository was archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAnsiEsc.txt
230 lines (191 loc) · 11.3 KB
/
AnsiEsc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
*AnsiEsc.txt* Ansi Escape Sequence Visualization May 01, 2019
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2017 by Charles E. Campbell *AnsiEsc-copyright*
The VIM LICENSE applies to AnsiEsc.vim and AnsiEsc.txt
(see |copyright|) except use "AnsiEsc" instead of "Vim".
No warranty, express or implied. Use At-Your-Own-Risk.
==============================================================================
1. Contents *AnsiEsc* *AnsiEsc-contents*
1. Contents ...................................|AnsiEsc-contents|
2. AnsiEsc Manual ...................................|AnsiEsc|
3. AnsiEsc Method ...................................|AnsiEsc-Method|
4. AnsiEsc History ...................................|AnsiEsc-history|
==============================================================================
2. Manual *AnsiEsc-manual*
CONCEAL~
The best option: for this, your vim must have +conceal. Try either >
:version
:echo has("conceal")
< if you have vim v7.3. Your vim needs to have been compiled
for "big" or "huge" and to support syntax highlighting.
Vim: (v7.2 or earlier) -- ansi escape sequences themselves are Ignore'd~
Ansi escape sequences have the expected effect on subsequent
text, but the ansi escape sequences themselves still take up
screen columns. The sequences are displayed using "Ignore"
highlighting; depending on your colorscheme, this should either
make the sequences blend into your background or be visually
suppressed. If the sequences aren't suppressed, you need to
improve your colorscheme!
*:AnsiEsc*
USAGE~
:AnsiEsc -- toggles Ansi escape sequence highlighting
:AnsiEsc! -- rebuilds highlighting for new/removed three
or more element Ansi escape sequences.
RESULT~
Ansi escape sequences become concealed or ignored (depending
on whether your vim supports Negri's conceal mode), and their
effect on subsequent text is emulated with Vim's syntax
highlighting.
Syntax highlighting for one and two element codes are
hard-coded into AnsiEsc.vim. There are too many possibilities
for three or more element codes; these are supported by
examining the file for such sequences and only building syntax
highlighting rules for such sequences as are actually present
in the document.
CUSTOMIZATION~
AnsiEsc does not know how to read what your terminal does with
several escape sequences. One may customize what AnsiEsc does
with these by specifying global variables which specify the
desired highlighting:
*g:ansiNone* use this variable to specify what should be done
with <esc>[0m and <esc>[m. Example: >
let g:ansiNone="hi gui=NONE cterm=NONE fg=white bg=black ctermfg=7"
<
*g:ansiBold* use this variable to specify what should be
done with <esc>[1m
*g:ansiItalic* use this variable to specify what should be
done with <esc>[3m
*g:ansiUnderline* use this variable to specify what should be
done with <esc>[4m
EXAMPLE~
You'll want to use :AnsiEsc to see the following properly!
[34;47mColor Escape Sequences[m
[37m - [m [37;1m 1 [m [37;2m 2 [m [37;3m 3 [m [37;4m 4 [m [37;5m 5 [m [37;7m 7 [m
[30mblack[m [30;1mblack[m [30;2mblack[m [30;3mblack[m [30;4mblack[m [30;5mblack[m [30;7mblack[m
[31mred[m [31;1mred[m [31;2mred[m [31;3mred[m [31;4mred[m [31;5mred[m [31;7mred[m
[32mgreen[m [32;1mgreen[m [32;2mgreen[m [32;3mgreen[m [32;4mgreen[m [32;5mgreen[m [32;7mgreen[m
[33myellow[m [33;1myellow[m [33;2myellow[m [33;3myellow[m [33;4myellow[m [33;5myellow[m [33;7myellow[m
[34mblue[m [34;1mblue[m [34;2mblue[m [34;3mblue[m [34;4mblue[m [34;5mblue[m [34;7mblue[m
[35mmagenta[m [35;1mmagenta[m [35;2mmagenta[m [35;3mmagenta[m [35;4mmagenta[m [35;5mmagenta[m [35;7mmagenta[m
[36mcyan[m [36;1mcyan[m [36;2mcyan[m [36;3mcyan[m [36;4mcyan[m [36;5mcyan[m [36;7mcyan[m
[37mwhite[m [37;1mwhite[m [37;2mwhite[m [37;3mwhite[m [37;4mwhite[m [37;5mwhite[m [37;7mwhite[m
Black [30;40mB[m [30;41mB[m [30;42mB[m [30;43mB[m [30;44mB[m [30;45mB[m [30;46mB[m [30;47mB[m
Red [31;40mR[m [31;41mR[m [31;42mR[m [31;43mR[m [31;44mR[m [31;45mR[m [31;46mR[m [31;47mR[m
Green [32;40mG[m [32;41mG[m [32;42mG[m [32;43mG[m [32;44mG[m [32;45mG[m [32;46mG[m [32;47mG[m
Yellow [33;40mY[m [33;41mY[m [33;42mY[m [33;43mY[m [33;44mY[m [33;45mY[m [33;46mY[m [33;47mY[m
Blue [34;40mB[m [34;41mB[m [34;42mB[m [34;43mB[m [34;44mB[m [34;45mB[m [34;46mB[m [34;47mB[m
Magenta [35;40mM[m [35;41mM[m [35;42mM[m [35;43mM[m [35;44mM[m [35;45mM[m [35;46mM[m [35;47mM[m
Cyan [36;40mC[m [36;41mC[m [36;42mC[m [36;43mC[m [36;44mC[m [36;45mC[m [36;46mC[m [36;47mC[m
White [37;40mW[m [37;41mW[m [37;42mW[m [37;43mW[m [37;44mW[m [37;45mW[m [37;46mW[m [37;47mW[m
Here's the vim logo:
[30;48;5;22m/ \[m
[30;48;5;22m/ \[m
[30;48;5;22m/ \[m
[30;48;5;22m/ \[m
[38;5;34;48;5;251m+----+[30;48;5;22m [38;5;34;48;5;251m+----+[30;48;5;22m \[m
[38;5;34;48;5;251m++ ++[30;48;5;22m [38;5;34;48;5;251m+- |[30;48;5;22m \[m
[30;48;5;22m/[38;5;34;48;5;251m| |[30;48;5;22m [m[38;5;34;48;5;251m/ /[30;48;5;22m \[m
[30;48;5;22mX [38;5;34;48;5;251m| |[30;48;5;22m [38;5;34;48;5;251m/ /O[30;48;5;22m \[m
[30;48;5;22m\[38;5;34;48;5;251m| |[30;48;5;22m [38;5;34;48;5;251m/ /+-+[30;48;5;22m [38;5;34;48;5;251m+-\[30;48;5;22m/[38;5;34;48;5;251m/-+[m
[38;5;34;48;5;251m| |/ /[30;48;5;22m [38;5;34;48;5;251m| |[30;48;5;22m [38;5;34;48;5;251m| v |[m
[38;5;34;48;5;251m| / /[30;48;5;22m [38;5;34;48;5;251m| |[30;48;5;22m [m[38;5;34;48;5;251m| + [38;5;34;48;5;251m+|[m
[38;5;34;48;5;251m| /[30;48;5;22m [38;5;34;48;5;251m| |[30;48;5;22m/[38;5;34;48;5;251m| |[38;5;34;48;5;251m\/[m[38;5;34;48;5;251m||[m
[38;5;34;48;5;251m+----[30;48;5;22m\ [38;5;34;48;5;251m+-+ [38;5;34;48;5;251m+-+[m [38;5;34;48;5;251m++[m
[30;48;5;22m\ /[m
[30;48;5;22m\ /[m
PROBLEM WITH EMBEDDING:
AnsiEsc plugin highlighting cannot be embedded in another
syntax language.
AnsiEsc uses the syntax highlighting engine, so it is
effectively another syntax highlighting language. But,
there are major differences:
* It supports being turned on and off
* AnsiEsc is not a syntax highlighting file, it
is a plugin
* AnsiEsc dynamically determines some syntax
highlighting by analyzing what's needed in the
current file.
To do a syntax highlighting file would involve an inordinate
quantity of permutations, resulting in a file that would take
much time to load (about a half hour with only a partially
complete set of permutations on my system).
Normally to embed a syntax highlighting language in another
would involve a pair of syntax highlighting commands such as:
syn include @AnsiEsc
syn region ... defines the region where AnsiEsc
\ highlighting is to occur ... contains=@AnsiEsc
placed in the other syntax file's definitions. That won't
work with AnsiEc because, again, AnsiEsc is not a syntax
highlighting file.
==============================================================================
3. AnsiEsc Method *AnsiEsc-Method* {{{1
Method 1: AnsiEsc implements syntax highlighting rules for highlighting the
basic eight colors (black-red-green-yellow-blue-magenta-cyan-white, plus gray)
atop the same basic eight colors, and rules for italic, bold, and underline.
These comprise a fixed set of syntax highlighting rules.
Method 2: Ansi escape codes may also represent a 6x6x6 color cube for an
additional 216 colors, plus 25 grayscale colors. To handle these, AnsiEsc
analyzes the file and builds custom syntax highlighting rules. These comprise
a variable set of syntax highlighting rules. I did it this way because things
a) broke (ie. vim was unable to handle 262000+ syntax highlighting rules),
and
b) took excessive amounts of time to load a fixed set of rules for
256 foreground atop 256 background syntax highlighting rules with
variants for italic, underline, and bold.
==============================================================================
4. AnsiEsc History *AnsiEsc-history* {{{1
v13 Apr 12, 2012 * (Peter Brant) a "conceal" was left on a syntax
definition in a no-conceal-support if block.
Fixed.
Apr 17, 2012 * (Ingo Karkat) support for the "reverse" attribute
May 13, 2014 * (Jason Schmidt) reported that <esc>[39m didn't work.
This means revert to default foreground. Similarly,
<esc>[49m didn't work (which means revert to default
background).
Dec 11, 2014 * Implemented implicit foreground/background
Jan 10, 2015 * (Evgeny Lukianchikov) provided XUbuntu support for
no-ansi-sequence (AnsiNone)
Sep 06, 2016 * Implemented bold/italic/underline without color
specification
Feb 18, 2017 * ansiConceal priority overruled foregroup specs
containing background specs.
(reported by Lucas Hoffman)
Apr 10, 2018 * (James McCoy) provided a patch so that the
|'highlight'| option is no longer used when
conceal is available (see |'conceallevel'|)
May 01, 2019 * (barrie) reported that <esc>[24m was showing up as
a "stray m". Reason: ansiSuppress wasn't handling
the code.
v12 Jul 23, 2010 * changed conc to |'cole'| to correspond to vim 7.3's
change
* for menus, &go =~# used to insure correct case
Aug 10, 2010 * (Rainer M Schmid) changed conceallevel setting to
depend on whether the version is before vim 7.3;
for 7.3, also sets concealcursor
* Restores conc/cole/cocu settings when AnsiEsc is
toggled off.
Dec 13, 2010 * Included some additional sequences involving 0
Feb 22, 2011 * for menus, &go =~# used to insure correct case
v11 Apr 20, 2010 * AnsiEsc now supports enabling/disabling via a menu
* <esc>[K and <esc>[00m now supported (as
grep --color=always issues them)
v10 May 06, 2009 * Three or more codes in an ANSI escape sequence are
supported by building custom syntax and highlighting
commands.
May 20, 2009 * cecutil bugfix
v9 May 12, 2008 * Now in plugin + autoload format. Provides :AnsiEsc
command to toggle Ansi-escape sequence processing.
Jan 01, 2009 * Applies Ignore highlighting to extended Ansi escape
sequences support 256-colors.
Mar 18, 2009 * Includes "rapid blink" ansi escape sequences. Vim
doesn't have a blinking attribute, so such text uses
"standout" for vim and "undercurl" for gvim.
v8 Aug 16, 2006 * Uses undercurl, and so is only available for vim 7.0
v7 Dec 14, 2004 * Works better with vim2ansi output and Vince Negri's
conceal patch for vim 6.x.
v2 Nov 24, 2004 * This version didn't use Vince Negri's conceal patch
(used Ignore highlighting)
==============================================================================
Modelines: {{{1
vim:tw=78:ts=8:ft=help:fdm=marker: