spacify

Turn this:

<div id="signin_login_content" class="signin_show">
    <cfinput type="text" required="yes" tabIndex="1" value="Username / Email" validate="email" name="login_username" message="Missing or invalid username." /> <br />
    <cfinput name="login_password_default" type="text" tabIndex="2" value="optional password" maxLength="20" class="login_password_w_default subdued" />
    <cfinput class="login_password_w_default signin_hide" type="Password" required="Yes" tabIndex="3" name="login_password" maxLength="20" validateAt="onServer" onBlur="if(this.value != '' ) this.value = calcMD5(this.value)" />
    <cfinput type="Submit" name="submit" tabIndex="4" value="Lemmie In!" />
</div>
<div id="signin_register_content" class="signin_show signin_hide">
    I would like to access the features of your totally awesome site!! I would like to provide my
    <cfinput name="join_username" type="text" required="yes" tabIndex="5" value="email address" validate="email" message="Missing or invalid username." onclick="if(this.value == this.defaultValue) this.value = '';" />
    as my username. I would like to provide my
    <cfinput type="text" required="yes" tabIndex="6" name="join_zip" value="zip code" validate="zipcode" message="Missing or invalid zip." />
    for location based service. I can provide an
    <cfinput type="text" tabIndex="7" value="optional password" name="join_password_default" class="join_password_w_default subdued" maxLength="20" />
    <cfinput name="join_password" type="Password" required="Yes" tabIndex="8" class="join_password_w_default signin_hide" maxLength="20" validateAt="onServer" onBlur="if(this.value != '' ) this.value = calcMD5(this.value)" />
    or one will be sent to me. Please
    <cfinput name="submit" type="Submit" tabIndex="9" value="sign me up" /> for your service.
</div>

into this:

<div id="signin_login_content" class="signin_show">
    <cfinput name="login_username"         tabIndex="1" type="text"     value="Username / Email"  required="yes"                                                             message="Missing or invalid username." validate="email"                                                                                                                                                        /> <br />
    <cfinput name="login_password_default" tabIndex="2" type="text"     value="optional password"                class="login_password_w_default subdued"     maxLength="20"                                                                                                                                                                                                                />
    <cfinput name="login_password"         tabIndex="3" type="Password"                           required="Yes" class="login_password_w_default signin_hide" maxLength="20"                                                           onBlur="if(this.value != '' ) this.value = calcMD5(this.value)" validateAt="onServer"                                                                />
    <cfinput name="submit"                 tabIndex="4" type="Submit"   value="Lemmie In!"                                                                                                                                                                                                                                                                                                  />
</div>
<div id="signin_register_content" class="signin_show signin_hide">
    I would like to access the features of your totally awesome site!! I would like to provide my
    <cfinput name="join_username"          tabIndex="5" type="text"     value="email address"     required="yes"                                                             message="Missing or invalid username." validate="email"                                                                                         onclick="if(this.value == this.defaultValue) this.value = '';" />
    as my username. I would like to provide my
    <cfinput name="join_zip"               tabIndex="6" type="text"     value="zip code"          required="yes"                                                             message="Missing or invalid zip."      validate="zipcode"                                                                                                                                                      />
    for location based service. I can provide an
    <cfinput name="join_password_default"  tabIndex="7" type="text"     value="optional password"                class="join_password_w_default subdued"      maxLength="20"                                                                                                                                                                                                                />
    <cfinput name="join_password"          tabIndex="8" type="Password"                           required="Yes" class="join_password_w_default signin_hide"  maxLength="20"                                                           onBlur="if(this.value != '' ) this.value = calcMD5(this.value)" validateAt="onServer"                                                                />
    or one will be sent to me. Please
    <cfinput name="submit"                 tabIndex="9" type="Submit"   value="sign me up"                                                                                                                                                                                                                                                                                                  /> for your service.
</div>

Give unformatted code<br /> Order by most common attributes,<br /> and format the code with spaces.

** Yes I know there are those who would say that this kind of columned output is bad (Uncle Bob), however, I like it I think it helps me find things faster. I figure to each their own.

Installation

gem install spacify

# only works if gems are in your PATH ...(and on linux (maybe mac))
cp $(dirname $(which spacify))/../gems/$(gem list spacify | tail -1 | sed 's/[)(]//g' | tr ' ' '-')/spacify.vim ~/.vim/plugin/

to your .vimrc file add

source ~/.vim/plugin/spacify.vim

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Scott Noel-Hemming. See LICENSE for details.