替换期间的 Vim 增量搜索 [英] Vim incremental search during substitution

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

问题描述

我不擅长编写 vim 正则表达式.每当我写一个替代品时,它第一次都不会奏效,因为我不可避免地最终会写一些 Perl 而不是 vim 的东西.在进行简单搜索时,我的表现要好得多,因为我打开了 incsearch,我可以实时查看我的模式是否匹配.

I am terrible at writing vim regular expressions. Whenever I write one to do a substition, it never works the first time because I inevitably end up writing something Perl instead of vim. I fare a lot better when doing a simple search because I have incsearch turned on and I can see in real-time whether my pattern matches.

当我尝试编写正确的模式时,有没有办法让 s 命令像/(执行增量搜索)一样?

Is there a way I can have the s command act like / (performing an incremental search) while I am attempting to write a proper pattern?

推荐答案

我不确定,但我认为没有办法做到这一点.顺便说一句,我使用了一个小技巧来加快我的换人速度.如果您执行以下操作:

I'm not sure but I think there is not a way to do it. By the way, I use a little trick to speed up my substitutions. If you do something like:

:%s//bar

在命令行 Vim 将使用您的最新搜索.所以,这不是你真正需要的,但仍然是一种提高替换速度的方法.

on the command line Vim will use your latest search. So, it's not exactly what you need but still a way to increase a bit your speed doing substitutions.

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

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