Scenario
I would like to perform the following,
- Visually select some text that spans multiple lines and occurs multiple times in the file:
V
- Yank to buffer:
y
- Perform substitute with text from buffer: (
:%s,<Ctrl-r> 0,new text,g
)
Example
Given the following example:
metadata:
name: redis
spec:
version: 5.0
...
metadata:
name: redis
I want to change all occurrences of metadata.
Output: :%s,metadata:^M name: redis,some other text,g
Error: E486: Pattern not found: metadata:^M name: redis