Tip #319: text formatting (lining up ='s,('s etc))
tip karma |
Rating -3/13, Viewed by 1419
|
created: |
|
August 23, 2002 7:01 |
|
complexity: |
|
basic |
author: |
|
Jahagirdar Vijayvithal S |
|
as of Vim: |
|
5.7 |
some time onw would like to reformat text like
a=1;
foo=2;
longstring=1;
c=2
to
a =1;
foo =2;
longstring =1;
c =2;
Note I am not sure wether the code above is displayed properly in your browsers what is basically shows is all the ='s are lined up in a single column
and this is how we achive it
0f=20i<space><esc>020lvf=hx
and this is what it does
0 goes to first column
f= finds next occurance of = on current line
20i<space><esc> inserts 20 spaces before =
0 goesback to first column
20l forward 20 column
vf=hx deletes everything up to the = sign
<<Extended Bracket and Parenthesis + extras for perl |
Borland pageup/down behavier >>
Additional Notes
|