Vim文字着色 [英] Vim text coloring

查看:89
本文介绍了Vim文字着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 echo -e 为脚本输出着色,使用标准输出时效果很好。

I use echo -e to color my scripts output, it works fine when using standard output.

但是,当我将输出重定向到文件时, vim 不显示颜色,而是显示类似 ^ [[

But when I redirect the output to a file, vim doesn't show the colors, instead of that it shows signs like this ^[[

示例:

echo -e "\e[32m Green message\e[0m";
echo -e "\e[31m Red message\e[0m";

with vim:

^[[32m Green message^[[0m
^[[31m Red message^[[0m

如何解决此问题。

NB cat 也显示颜色!

推荐答案

使用 AnsiEsc插件由Dr. Chip或我的 Colorizer 插件。两者都应该能够为那些终端转义序列着色。

Use either the AnsiEsc Plugin by Dr. Chip or my Colorizer plugin. Both should be able to color those Terminal Escape sequences.

这篇关于Vim文字着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆