Assuming I have the following options Hash as an argument to a method in Ruby 1.9.x:
my_method :arg1,
some_option: "value 1"
some_other_option:true
option_three: 123
Using the Tabular VIM plugin, what would the regular expression be to get the options Hash align like so:
my_method :arg1,
some_option: "value 1"
some_other_option: true
option_three: 123
The :
has to stay attached to the key, unlike with, for example, JSON.
Perhaps a more visually appealing style would be this instead, which looks more aligned:
my_method :arg1,
some_option: "value 1"
some_other_option: true
option_three: 123
Does anyone by any chance know how to accomplish either of these alignments using Tabular?
Thanks!
In order to get the first alignment, one can use the command
For aligning hash keys to the right, it seems inevitable to select only the lines containing them before applying a
:Tabular
command,