Deshacerse de caracteres de escape ANSI cuando se ven en ri (Mac) Vim
-
12-10-2019 - |
Pregunta
Estoy teniendo problemas para ver la documentación ri dentro gvim y MacVim (probado en ambos) Parte de la documentación ri incluye decoraciones de texto que buen aspecto cuando se ve en una ventana de terminal, sino que incluyen caracteres de escape ANSI cuando se ve en gvim / MacVim . Por ejemplo, las siguientes ri fragmento de miradas $ri class
como este en el terminal:
Devuelve la clase de obj , ahora preferido sobre Objeto # type
Y esto en gvim:
Devuelve la clase de [4mobj [m, ahora preferido sobre [7mObject # tipo [m,
Sería genial poder hacer referencia a documentos legibles ri dentro gvim. ¿Alguna idea sobre dónde empezar a buscar a solucionar este problema?
Solución
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
.
Otros consejos
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: