On 8/02/11 2:23 AM, rameo wrote:
Let say I have these dates:

Variable 1 - 21.185         Variable a - 22.345
Variable 2 - 1.401.218    Variable b -   1.821
Variable 3 - apples         Variable c - 17.643
Variable 4 - water           Variable d - 56.030
Variable 5 - 656.647       Variable e - 65.123
Variable 6 - 92.200         Variable f -   2.000

I would like to select the 2nd column (21.185 to 92.200) and right
align all the info in the block

I use this to left align the data in a block:
:<C-U>'<,'>s/\%V\(\s*\)\(.\{-}\)\%(\%V\@!\\|$\)/\2\1/

Looks like there's an extra \ that shouldn't be there before the |.

How do I right align the data in a block?

Try

:<C-U>'<,'>s/\%V\(.\{-}\)\(\s\{-}\)\%(\%V\@!\|$\)/\2\1/

The non-greedy matches are important so Vim doesn't get 'carried away'
and match too much, going outside the visual region and/or including
spaces in the part designed to catch primarily 'non-spaces'

Ben.



I tried to switch the space block with the text block in the code but
something doesn't work.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to