Question

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:

Returns the class of obj, now preferred over Object#type

And this in gvim:

Returns the class of [4mobj[m, now preferred over [7mObject#type[m,

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

Was it helpful?

Solution

Try running ri like this:

ri --format=rdoc

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

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

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

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

OTHER TIPS

These two scripts seem to have been written to address that problem. They don't appear to be perfect solutions. One of them apparently requires a patch to vi, or did at one point. I can't quite tell what the other one does but I think it renders your window, interpreting the codes, when you use a specific command.

There is also some advice on existing vi commands.

See:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top