Reputation: 77288
With vim how do I to turn this:
t.string :crypted_password :null => false
t.string :password_salt, :null => false
into this:
t.string :crypted_password, :null => false
t.string :password_salt, :null => false
without manually adding the spaces to each line?
Upvotes: 1
Views: 291
Reputation: 496892
This would be possible with the Align plugin. Conveniently enough, you actually only need to align on whitespace to accomplish this, and Align has a built-in shortcut for that: \tsp
(it operates on the visual mode selection).
If actual use cases could get more complex and whitespace alignment doesn't give the result you want, you can also define your own alignment - Align lets you specify it pretty precisely, with multiple separators, skipping separators...
Another alignment plugin: Tabular (documentation here). I personally haven't used it but Greg recommends it in the comments - it delimits by regular expression instead of fixed string.
Upvotes: 4