I often run into situations like this:
title : Jekyll Bootstrap
tagline: Site Tagline
author :
name : Name Lastname
email : [email protected]
github : username
twitter : username
feedburner : feedname
Where the arguments are not lined up well, is there a standard way in vim for to have it formatted with each of the according arguments aligned to the nearest indent where an indent is defined as 2 spaces without having to go through line by line to the, such as in the following:
title : Jekyll Bootstrap
tagline : Site Tagline
author :
name : Name Lastname
email : [email protected]
github : username
twitter : username
feedburner: feedname
UPDATE:
I believe tabular.vim is the plugin I am looking for but I am having a difficult time forming a regular expression which would take into account the number of spaces at the beginning of the line when deciding something should be part of a block, i.e. Tabularize/: produces:
title : Jekyll Bootstrap
tagline : Site Tagline
author :
name : Name Lastname
email : [email protected]
github : username
twitter : username
feedburner: feedname
The is an example in the documentation where the following is achieved via a regular expression:
abc,def,ghi
a,b
a,b,c
:Tabularize /^[^,]*\zs,/r0c0l0
abc,def,ghi
a,b
a,b,c
But I am unsure how to formulate this when consider each line with the same number of spaces in front part of the same block while still evaluating subblock such as in the following more complex than my original example:
comments :
provider : disqus
disqus :
short_name : jekyllbootstrap
livefyre :
site_id : 123
intensedebate :
account : 123abc
facebook :
appid : 123
num_posts : 5
width : 580
colorscheme : light
would be transformed tabularize\some_regular_expression_I_cant_figure_out to:
comments :
provider : disqus
disqus :
short_name : jekyllbootstrap
livefyre :
site_id : 123
intensedebate :
account : 123abc
facebook :
appid : 123
num_posts : 5
width : 580
colorscheme : light