Vim has a simple shortcut (or plugin) that can help with code formatting as follows:
var obj = { one: 1, two: 2, three: 3, four: 4 };
in it?
var obj = { one : 1, two : 2, three : 3, four : 4 };
There are several alignment plugins that can handle such problems very easily:
https://github.com/junegunn/vim-easy-align
https://github.com/godlygeek/tabular
https://github.com/vim-scripts/Align
I personally use the latter (maybe the oldest?). for your need, I just V select these lines and <leader>t:done!
<leader>t:
vim. , ctrl-V ( V), :
ctrl-V
V
:s;\v^(\s*)(\w+)\s*:\s*(\d+,*);\=printf("%s%-7s: %s", submatch(1), submatch(2), submatch(3));g
:s :'<,'>s - .
:s
:'<,'>s