Vim search and replace - add new line

Was using Vim and needed to replace text where the line started with ` - text with a newline and then ### text` in a large markdown based document I was formatting

After a few goes here’s the Vim search and replace command to add new line and replace text

vim new_ling_and_replace.vim :%s/$- /\r### /g

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 or _justin_kelly