Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Gvim) How to delete a certain pattern which is embraced by certain characters

Tags:

vim

I like to delete all characters embraced by "[" and "]" including these embracing characters. How can I do that?

like image 289
Bicycle-riding Dog Avatar asked Dec 05 '25 19:12

Bicycle-riding Dog


2 Answers

Believe it or not, da[. Read :help text-objects to find out why, and what other kinds of regions you can use in this way (some other useful ones are aw for a word, and ap for a paragraph).

like image 169
hobbs Avatar answered Dec 08 '25 10:12

hobbs


Perhaps use a find and replace like this:

:%s/\[.*\]//g
like image 28
bilo Avatar answered Dec 08 '25 10:12

bilo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!