:s/>\r< with a newline between. g flag means all occurances =gg Auto-format (=) everything from the current line to the top (gg) dd Delete (d) the current line (d) qb Record macro (q) with name 'b' dd C-v Visual block mode (C-v) l l j j d Move right twice, down twice, then delete all in selection w Move one word right (w) C , Change until end of line (C) insert ',' j . Go down (j), repeat last command (.) j . V k k Visual line mode (V), move up twice (k) J Join all selected lines j ^ Jump to the beginning of the line, excluding whitespace cf> Change (c) until (f), inclusively, the character '>' spriteIndex = f< D Jump on top of the '<' character then delete to EOL (D) k J I Join (J) and insert at beginning of line, exlcuding whitespace (I) new Tile( A ), Append (A) the text '),' j dd q Finish recording the macro 9@b Run the macro (@) named 'b' 9 times dd V gg Visual line move (V) select up to the top of the file (gg) 2< Decrease the indent count (<) twice on selected lines