Vim search register

less than 1 minute read

You can substitute the last search pattern in vim either by omitting the search pattern in the :%s command, or by inserting the contents of the search register onto the command line using <C-r>/. <C-r><reg> can be used anywhere to insert the contents of any register <reg>. In this case, the / register contains the last search pattern.