I have this markdown line,
![Home][screenshots/home.png]
I want to replace it with,
![Home](screenshots/home.png)
So, I tried this,
:%s/[s/(s/g
Vim(version 81) says pattern not found.
You need to escape the opening square bracket:
:%s/\[s/(s/g
For the whole replace, you can use:
:%s/]\[\(.)]/](\1)
:%s/\[s/(s/g
and :%s/\g]/g)/g
[
starting a character class in a regex (see:help /[]
. You need to escape it with a backslash. This should work::%s/\[s/(s/g
. But much better is to use something like vim-surround, which gives you commands to switch the[]
pair with a()
pair in a single command (cs])
anywhere inside that block.)