加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Vim中的搜索命令“//”如何工作?

发布时间:2020-12-15 18:45:04 所属栏目:安全 来源:网络整理
导读:搜索一些东西后,如果你打了//,你似乎得到了下一个结果.这与n有什么不同?你应该怎么用? // e匹配什么,还有哪些其他选项? 搜索命令的格式如下: /pattern/offsetcr 如果图案部分被删除,则搜索将查找搜索到的最后一个模式.如果偏移量被忽略,则不应用偏移量.
搜索一些东西后,如果你打了//,你似乎得到了下一个结果.这与n有什么不同?你应该怎么用? // e匹配什么,还有哪些其他选项?
搜索命令的格式如下:
/pattern/offset<cr>

如果图案部分被删除,则搜索将查找搜索到的最后一个模式.如果偏移量被忽略,则不应用偏移量.一旦找到你的图案项目,偏移量基本上是对光标做的.

大多数vi用户熟悉不带偏移量的变体,/ pax< cr>和重复最后一次搜索,< cr>等价于n.

在您的具体示例中,//< cr>与/< cr>相同这意味着重复上一次搜索,不应用偏移量.

另一方面,// e

[num]         [num] lines downwards,in column 1
+[num]        [num] lines downwards,in column 1
-[num]        [num] lines upwards,in column 1
e[+num]       [num] characters to the right of the end of the match
e[-num]       [num] characters to the left of the end of the match
s[+num]       [num] characters to the right of the start of the match
s[-num]       [num] characters to the left of the start of the match
b[+num]       [num] identical to s[+num] above (mnemonic: begin)
b[-num]       [num] identical to s[-num] above (mnemonic: begin)
;{pattern}    perform another search,see |//;|

没有num的加号或减号使用1.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读