On Tue, 4 May 2010, Ben Fritz wrote:

> On May 3, 4:13 am, Mathieu Zhang wrote:
> >
> > I am working in a project in which someone else wrote a makefile 
> > with a lot of fancy coloring.  When I type :!make, the output is 
> > scrolled through with a lot of escape sequence like "^]0;30;"  for 
> > color, making it completely unreadable.  Can I have vim either (1) 
> > interpret those escape sequence and make for colorful output, or (2) 
> > ignore and don't print them?
> >
> 
> 
> Chip gave you a potential solution that will give you option (1).
> 
> Assuming you're working on a *nix system, I believe you could add '| 
> col -b' to your 'makeprg' or 'shellpipe' options to accomplish option 
> (2).
> 
> I just recently learned about 'col -b' from a Vim tip about using Vim 
> as a man page viewer. Very useful! Especially if you don't have the 
> conceal patch that Chip mentions.

I don't get it...?

# prints a green 'foo'
$ echo ${GREEN}foo${NOCOLOR}
foo

# (myod is like od, but mine)
$ echo ${GREEN}foo${NOCOLOR} | myod -T
00000000 1b 5b 33 32 6d 66 6f 6f 1b 5b 30 6d 0a ».[32mfoo.[0m¬«

# '| col -b' doesn't seem to strip most things out:
$ echo ${GREEN}foo${NOCOLOR} | col -b
32mfoo0m

And that's not even using the longer sequence required for 256-color 
Xterm-style colors.  E.g.:
\e[38;5;216;7m 256-color Peach Inverted\e[0m plain text
comes out as:
38;5;216;7m 256-color Peach Inverted0m plain text

Personally, I long-ago wrote a Perl script that handles most of the 
stuff I use.

The gist: perl -lpwe 's/\e\[([\d;]*)m//g'

-- 
Best,
Ben H

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to