by pavel_lishin · 13y ago · 0 comments
// This doesn't look very nice
thing = { some_key_1: some_var_1,
[->][->][->]some_key_2: some_var_2,
[->][->][->]some_key_3: some_var_3 }
// Neither does this.
thing = { some_key_1: some_var_1,
[->][->]some_key_2: some_var_2,
[->][->]some_key_3: some_var_3 }
// Feels good, man.
thing = { some_key_1: some_var_1,
some_key_2: some_var_2,
some_key_3: some_var_3 }
// I want to beat you with an oar.
thing = { some_key_1: some_var_1,
[->][->] some_key_2: some_var_2,
[->][->] some_key_3: some_var_3 }Added advantage that you can move all of the lines around, :sort them or comment out individual ones without breaking anything.
Use spaces to align anything after the key, I usually align them with a tab stop so that several blocks line up.
thing = {
[->]some_key_1: some_var_1,
[->]some_key_2: some_var_2,
[->]some_key_3: some_var_3,
} thing = {
[→][→]some_key_1: some_var_1,
[→][→]some_key_2: some_var_2,
[→][→]some_key_3: some_var_3,
[→]}
Several benefits: easier to insert lines at the head or tail without making the SCM diff ugly, also avoids merge conflicts in those cases, and I use indentation of two levels to separate it from code.Why suffer a problem when it's easily avoided? :)
// I want to beat you with an oar.
thing = {[->]some_key_1: some_var_1,
[->][->][- >]some_key_2: some_var_2,
[->][->][- >]some_key_3: some_var_3 }