本文介绍了在(Mac)中查看ri时摆脱ANSI转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在查看gvim和MacVim中的ri文档时遇到了麻烦(两者都尝试过) .例如,终端中$ri class的以下ri片段如下所示:

I'm having trouble viewing ri documentation within gvim and MacVim (tried it on both) Some of the ri documentation includes text decorations that look fine when viewed in a terminal window, but include ANSI escape characters when viewing in gvim/MacVim. For example, the following ri snippet from $ri class looks like this in the terminal:

这在gvim中:

能够在gvim中引用清晰的ri文档真是太好了.关于从哪里开始寻求解决此问题的任何想法?

It'd be great to be able to reference legible ri docs within gvim. Any ideas on where to begin looking to fix this?

推荐答案

尝试像这样运行ri:

ri --format=rdoc

AFAIK,rdoc格式为纯文本,因此您不必过滤掉ANSI转义序列.

AFAIK, the rdoc format is plain text so you won't have to filter out the ANSI escape sequences.

您可以通过制作如下的shell脚本来获得真实的"纯文本:

You can probably get "real" plain text by making a shell script like this:

ri --format=bs $@ | sed 's:.^H::g'

^H是原始的(或任何适合您的退格键)的地方,然后调用该Shell脚本而不是ri.

Where ^H is a raw (or whatever backspace is for you), then call that shell script instead of ri.

这篇关于在(Mac)中查看ri时摆脱ANSI转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 15:38