vim如何搜索URL

ktm*_*124 6 vim

你会如何在vim中搜索以下字符串?

http://my.url.com/a/b/c
Run Code Online (Sandbox Code Playgroud)

我试过了(非常没有魔法)

:/\Vhttp://my.url.com/a/b/c
Run Code Online (Sandbox Code Playgroud)

但它给了我:

E492 not an editor command: /\Vhttp://my.url.com/a/b/c

您会认为有一种简单的方法可以直接搜索字符串...我对斜线转义每个斜杠或编写复杂的搜索都不太感兴趣,因为我必须快速搜索文本文件中的不同URL.

Exp*_*lls 8

因为我没有,所以我不确定你为什么not an editor command会这样做.最简单的搜索方式是使用?而不是逃避斜杠,例如

:?http://my.url.com/a/b/c
" or since the : is not necessary
?http://my.url.com/a/b/c
Run Code Online (Sandbox Code Playgroud)

这确实在另一个方向搜索,所以请记住这一点

  • 他得到"不是编辑命令"的原因是他在命令模式下进入搜索 - 由":"表示. (2认同)