1

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.

3
2

You need to escape the opening square bracket:

:%s/\[s/(s/g

For the whole replace, you can use:

:%s/]\[\(.)]/](\1)

1
  • Yes worked!! I did it two times for opening and closing brackets. :%s/\[s/(s/g and :%s/\g]/g)/g – losethos Nov 17 '20 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.