Vim search and repeat

Accidentally found out what & does in Vim search and replace ~:%s commands. It can be used to repeat the searched form string in the replacement string, examples below:

some sample data

form.get_data

execute :%s/form/&&/g

will result in

formform.get_data

execute :%s/get/testData:&/g

will result in

form.testData:get_data

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me justin@kelly.org.au or _justin_kelly