*AnsiEsc.txt*	Ansi Escape Sequence Visualization		Jul 21, 2020

Author:  Charles E. Campbell  <NcampObell@SdrPchip.AorgM-NOSPAM>
	  (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*

		The best option: for this, your vim must have +conceal. Try either >
			: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   -- toggles Ansi escape sequence highlighting
		:AnsiEsc!  -- rebuilds highlighting for new/removed three
		              or more element Ansi escape sequences.

		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

		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.

		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


		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


		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),

	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.
	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
	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
	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.
	Jul 21, 2020	* (Sergey Vlasov) reported that bold text atop
			  variously colored backgrounds wasn't being
  v12	Jul 23, 2010	* changed conc to |'cole'| to correspond to vim 7.3's
			* 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
	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