If you are transforming a lot of JS object syntax into Clojure map syntax in vim, these three s
commands can help you:
s/,//g
s/'/"/g
s/\(\w*\):/:\1/g
The first one is simple, it removes all commas from the line
The second one is also simple, it swaps any single quotes for double quotes
The third one is a little tricky, it swaps the colon from the end of the keyword to the beginning of the keyword
I saved each of these into a register and pasted them into my command mode with Control-R
then typing the register letter.
This is how you paste from a register in insert mode, and it works in command mode too.
It transforms lines of text like:
{ name: 'sam', age: 35, hobby: [ 'sports', 'sewing' ] }
To:
{ :name "sam" :age 35 :hobby [ "sports" "sewing" ]}
Maybe there's a way to make executing all three s
commands in one macro, I haven't looked into that!