Vim 中的高级搜索 [英] Advanced searching in Vim

查看:48
本文介绍了Vim 中的高级搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Vim 中同时搜索多个字符串?我记得在某处读到有可能但不知何故忘记了技术.

Is there a way to search for multiple strings simultaneously in Vim? I recall reading somewhere that it was possible but somehow forgot the technique.

例如,我有一个文本文件,我想同时搜索foo"和bar"(不一定是单个字符串,可以完全在不同的行中).

So for example, I have a text file and I want to search for "foo" and "bar" simultaneously (not necessarily as a single string, can be in different lines altogether).

我如何做到这一点?

推荐答案

/^joe.*fred.*bill/          : find joe AND fred AND Bill (Joe at start of line)
/fred\|joe                  : Search for FRED OR JOE

这篇关于Vim 中的高级搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆