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


execute :%s/form/&&/g

will result in


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

will result in


Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP, ReactJS, Tableau, AWS RedShift and Matillion ETL

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly

Leave a comment

Name Notify me of replies by email.