tags:

views:

213

answers:

1

Suppose I have this code:

width: 215px;
height: 22px;
margin-top: 3px;
background-color: white;
border: 1px solid #999999;

I want to align it this way:

width:            215px;
height:           22px;
margin-top:       3px;
background-color: white;
border:           1px solid #999999;

using Align.vim I can do :Align \s to use whitespace as separator, but that has 2 problems

  1. the initial indent is doubled
  2. all whitespaces are considered separators, so the last line is messed up

I've read through the many options Align.vim offers, but I haven't found a way to do this.

+5  A: 

If you use Tabular, then you can just do :Tabularize /:\zs/.

Looking at Align's description on vim.org, a similar invocation should work for it. You could try :Align :\zs. I don't use Align, so I'm not positive.

jamessan
Yeah, that works with Align. You may want to use `:AlignCtrl l:` (or similar) to have any further colons disregarded.
Michał Marczyk
Wow thanks didn't know about `\zs` pattern
kemp