开发者

How can I replace parenthesis in vim

开发者 https://www.devze.com 2022-12-10 02:04 出处:网络
In Vim I have: simulación (fig.),pretexto (fig.),excusa (fig.). My goal is:开发者_如何学JAVA simulación ,pretexto ,excusa .

In Vim I have:

simulación (fig.),pretexto (fig.),excusa (fig.).

My goal is:开发者_如何学JAVA

simulación ,pretexto ,excusa .

I have tried with: :%s/\(fig\.\)//g, but it doesn't work.


Vim doesn't require escaping of brackets by default. Try:

:%s/(fig\.)//g

See:

:help magic

Edit

Added backslash escaping of dot.


Don't escape the parens - vim by default uses a "magic" escaping scheme. Try:

:%s/(fig\.)//g

More info: http://vimdoc.sourceforge.net/htmldoc/pattern.html#/\v


On Vim 7.2 (WinXP), the command you used only removes 'fig.', but not the parentheses. Using %s/(fig\.)//g gives the intended result.

Edit Escaped the dot too, as it matches any character, not just a dot.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号