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

1 Answer 1

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
    – atheros
    Nov 17, 2020 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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