¿Usando vim para crear texto de ancho fijo?

¿Usando vim para crear texto de ancho fijo?

tengo texto en el formulario

xxxx  yyyyy
xx yyyy
xxxxxxxx  yyyyy
x y

Me gustaría que el segundo conjunto de cada línea comenzara en el mismo punto, es decir

xxxx      yyyyy
xx        yyyy
xxxxxxxx  yyyyy
x         y

No puedo pensar en una solución elegante usando vim y siempre me molesta cuando invierto más tiempo en una solución del que tomaría simplemente hacer algo manualmente. ¡Siempre puedo guardarlo para la próxima vez si alguien tiene una solución inteligente!

Respuesta1

He visto algunos trucos inteligentes de búsqueda/reemplazo que harían el trabajo, pero no puedo memorizarlos, así que esto es algo que uso.(y recomendar)un complemento.

UsandoAlinear, esto se convierte en una mera

- VG                (select all)
- <leader>tsp       (align whitespace)

de la ayuda

    ---------------------------         *alignmap-Tsp*
    Alignment Map Examples: \tsp            *alignmap-tsp* {{{3
    ---------------------------

    Normally Align can't use white spaces for field separators as such
    characters are ignored surrounding field separators.  The \tsp and
    \Tsp maps get around this limitation.

    Original: >
     one two three four five
     six seven eight nine ten
     eleven twelve thirteen fourteen fifteen
<
    Becomes: Select the lines, \tsp >
     one    two    three    four     five
     six    seven  eight    nine     ten
     eleven twelve thirteen fourteen fifteen
<
    Becomes: Select the lines, \Tsp >
        one    two    three     four    five
        six  seven    eight     nine     ten
     eleven twelve thirteen fourteen fifteen
<

información relacionada