Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM Unix commands printed in color

Tags:

vim

macvim

ansi

I'm using MacVim and I would like to have ! commands printed in color. For example:

In bash, the following echo statement prints Hello World in green (as expected):

$ echo -e "\033[32m Hello World" 
 Hello World

However, in VIM the output is not color, and the escape codes are printed:

:!echo -e "\033[32m Hello World" 
 [32m Hello World

How can one have VIM (and MacVim build 57 in particular) print the output of ! commands and honour ANSI color escapes.

like image 209
Brian M. Hunt Avatar asked May 25 '11 15:05

Brian M. Hunt


People also ask

How do I enable colors in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

Does VI have syntax highlighting?

Syntax highlighting is nothing but a feature of vi/vim text editors that displays text, especially source code, in different colors and fonts according to the category of terms. The following instructions show you how to enable or disable syntax colors for VI/VIM text editor running on a Linux or Unix-like system.

How do you highlight text in Vim?

If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.


1 Answers

You can't. But you can suspend the editor and drop to a shell relatively quickly;

Or you can use Ansi Filter to remove the escape sequences so you will at least not see a mess.

like image 127
sehe Avatar answered Sep 24 '22 19:09

sehe