vim – 在一行中多次搜索和替换

前端之家收集整理的这篇文章主要介绍了vim – 在一行中多次搜索和替换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我做类似的事情:

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

并且第一次搜索和替换没有找到任何匹配项,则不会执行第二次搜索和替换。有没有办法告诉vim继续执行,即使命令“失败”?

尝试
:%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

猜你在找的Bash相关文章