vim如何搜索网址 [英] vim how to search for URL
问题描述
你将如何在 vim 中搜索以下字符串?
How would you search for the following string in vim?
http://my.url.com/a/b/c
我已经尝试过(非常没有魔法)
I've tried (a la Very No Magic)
:/\Vhttp://my.url.com/a/b/c
但它给了我:
E492 不是编辑器命令:/\Vhttp://my.url.com/a/b/c
您可能会认为有一种简单的方法可以逐字搜索字符串...我对斜线转义每个斜线或编写复杂的搜索不太感兴趣,因为我必须快速搜索文本中的不同 URL文件.
You would think there'd be a simple way to search a string literally... I'm not too interested in slash escaping every slash, or writing a complicated search, because I have to rapidly search different URLs in a text file.
推荐答案
我不知道为什么你得到 not an editor command
因为我没有.无需转义斜杠的最简单搜索方法是使用 ?
代替,例如
I'm not sure why you get not an editor command
since I don't. The simplest way to search without having to escape slashes is to use ?
instead, e.g.
:?http://my.url.com/a/b/c
" or since the : is not necessary
?http://my.url.com/a/b/c
这确实会向另一个方向搜索,所以请记住这一点
This does search in the other direction, so just keep that in mind
这篇关于vim如何搜索网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!