sponsor Vim development Vim logo Vim Book Ad

AnsiEsc.vim : ansi escape sequences concealed, but highlighted as specified (conceal)

 script karma  Rating 564/241, Downloaded by 20482  Comments, bugs, improvements  Vim wiki

created by
Charles Campbell
 
script type
syntax
 
description
Files with ANSI escape sequences look good when dumped onto a terminal that accepts them, but heretofore have been a distracting clutter when edited via vim.  The AnsiEsc.vim file, when sourced with vim 7.3 or later, will conceal Ansi escape sequences but will cause subsequent text to be colored as the escape sequence specifies.

You need to have a vim with conceal mode enabled; use has("conceal") to find out if the vim you're using has that feature.

Without that conceal feature or with vim versions earlier than 7.3, the best that can be done is to suppress Ansi escape sequences with "Ignore" highlighting.  AnsiEsc.vim v2 does that.

Cutting edge versions are available at http://www.drchip.org/astronaut/vim/index.html#ANSIESC .

Usage:  edit a file containing escape sequences, then type :AnsiEsc
 
install details
vim AnsiEsc.vba.gz
:so %
:q
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
AnsiEsc.vba.gz 12 2010-12-13 7.0 Charles Campbell * changed conc -> cole for vim 7.3's built-in conceal mode
* included some additional escape sequences
AnsiEsc.vba.gz 11 2010-06-22 7.0 Charles Campbell supports several escape sequences such as <esc>[m , <esc>[2J, and <esc>[H.
AnsiEsc.vba.gz 10 2010-04-07 7.0 Charles Campbell AnsiEsc has 1 and 2 Ansi escape code sequences supported by fixed syntax highlighting rules; it now also builds custom syntax highlighting to support 3 and 4 Ansi Escape code sequences based on your current document.  So  \e[48;5;16m will now cause correct highlighting to follow, for example.
AnsiEsc.vba.gz 9 2009-03-18 7.0 Charles Campbell * AnsiEsc comes in plugin + autoload format: faster vim startup, and AnsiEsc only when you want it.
* Now provides a :AnsiEsc command totoggle ANSI escape sequence processing.

Works with Vince Negri's conceal patch (if your vim supports VN's conceal, then the ansi-escape sequences are suppressed except on the line you're editing).
AnsiEsc.vba.gz 8 2006-08-16 7.0 Charles Campbell Uses vim7.0's undercurl as a substitute for blinking (which Vim doesn't support), contains a small helpfile, and contains directions for getting Vince Negri's conceal patch for vim 7.0.
AnsiEsc_v2.vim 2 2004-11-24 6.0 Charles Campbell I mistakenly removed AnsiEsc v2 (which is the version which doesn't use Vince Negri's conceal).  This update restores it!
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github