Tag Archives: vim

Vim: Find number of matches in a file

:%s/pete//gn In the above example we are looking for the number of matches for the word “pete”.

Vim: Search and Replace, Insert new line

Vim has some really useful commands, especially search and replace ones. Unfortunately I'm always forgetting the finer details of how to use them so here's an example: PLAIN TEXT CODE: :%s/$/\rthis is a new line To break down whats happening above: : switches Vim into command mode % means we're going to apply this command [...]