首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >多行搜索并在一行中替换应该如何完成?

多行搜索并在一行中替换应该如何完成?
EN

Stack Overflow用户
提问于 2018-05-11 10:13:02
回答 1查看 0关注 0票数 0

:%s/aaa/bbb/ | %s/111/222/

第一次搜索和替换不会找到任何匹配,第二次搜索和替换将不会执行。命令“失败”,有没有什么办法可以告诉vim继续?

EN

回答 1

Stack Overflow用户

发布于 2018-05-11 20:12:35

尝试

:%s/aaa/bbb/e | %s/111/222/e

并阅读

:help :s_flags

特别是[e]下的条目:

 When the search pattern fails, do not issue an error message and, in
 particular, continue in maps as if no error occurred.  This is most
 useful to prevent the "No match" error from breaking a mapping.  Vim
 does not suppress the following error messages, however:
 Regular expressions can't be delimited by letters
 \ should be followed by /, ? or &
 No previous substitute regular expression
 Trailing characters
 Interrupted
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100003339

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档