Vim Tips Wiki
(adjust Template:ScriptComments to remove id as no longer needed; minor tweaks)
(Change <tt> to <code>, perhaps also minor tweak.)
Line 2: Line 2:
   
 
==Not hiding an escape sequence==
 
==Not hiding an escape sequence==
I have a log file which contains Ansi Escape sequence <tt><1b>[H<1b>[2J</tt>
+
I have a log file which contains Ansi Escape sequence <code><1b>[H<1b>[2J</code>
   
 
AnsiEsc plugin does not hide these escape sequences. Shouldn't it hide them?
 
AnsiEsc plugin does not hide these escape sequences. Shouldn't it hide them?
Line 11: Line 11:
 
</pre>
 
</pre>
   
and foo.txt contains <tt><1b>[H<1b>[2J</tt>
+
and foo.txt contains <code><1b>[H<1b>[2J</code>
   
 
-- Dominique 2010/06/17
 
-- Dominique 2010/06/17
Line 18: Line 18:
 
Running the following command, I would expect to see the word "foo" with color.
 
Running the following command, I would expect to see the word "foo" with color.
 
But AnsiEsc does not show any color:
 
But AnsiEsc does not show any color:
 
$ echo "foo bar" | grep --color=always foo | vim -c AnsiEsc
 
$ echo "foo bar" | grep --color=always foo | vim -c AnsiEsc
 
 
   
 
The terminal codes (output of grep) are:
 
The terminal codes (output of grep) are:
 
<1b>[01;31m<1b>[Kfoo<1b>[m<1b>[K bar
 
<1b>[01;31m<1b>[Kfoo<1b>[m<1b>[K bar
 

Revision as of 09:49, 14 July 2012

Use this page to discuss script 302 AnsiEsc: ansi escape sequences concealed, but highlighted as specified

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Not hiding an escape sequence

I have a log file which contains Ansi Escape sequence <1b>[H<1b>[2J

AnsiEsc plugin does not hide these escape sequences. Shouldn't it hide them?

The escape sequence are created by the "clear" command:

$ clear > foo.txt

and foo.txt contains <1b>[H<1b>[2J

-- Dominique 2010/06/17

Comments

Running the following command, I would expect to see the word "foo" with color. But AnsiEsc does not show any color:

$ echo "foo bar" | grep --color=always foo | vim -c AnsiEsc

The terminal codes (output of grep) are:

<1b>[01;31m<1b>[Kfoo<1b>[m<1b>[K bar