How to search for a percent symbol (%) in Vim?
replace, vim
Solution
Nothing in this search needs escaping, `:%s/<%/<?php/g` works precisely as expected, replacing `<%` with `<?php` everywhere.
Problem
I'm trying to do a global find and replace for old-style PHP tags that look like this: ``` <%= $username %> ``` However when I try to do a search and replace in Vim, I get an "E71: Invalid character after \%" warning, and a "E476: Invalid command" warning: ``` :%s/\<\%/other val/c ``` I've also tried: ``` :%s/\<\\%/other val/c " two escapes, returns no matches ```