用准备好放入 vi/vim 的内容替换 word 吗? [英] Replace word with what's ready to put in vi/vim?

查看:27
本文介绍了用准备好放入 vi/vim 的内容替换 word 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有:

rm -f $(NAME).elf $(name).d

其中第二个 'name' 是拼写错误,也应该是 'NAME'.

where the second 'name' is a typo, and should also be 'NAME'.

所以在'N'上,我做了yw,然后移动到'n'.

So on 'N', I did yw, and then moved to 'n'.

我意识到如果我现在点击 cw 来更改它,我将处于插入模式 - 但我想啊,好吧,它只是 一个 额外的键 (ESC) 然后我就可以 p 修正后的版本.

I realised that if I now hit cw to change it, I'll be in insert mode - but I thought ah well, it's only one extra key (ESC) and then I can just p the corrected version in.

但在那种情况下,p 做了 u 会做的事情,它把名字"放了回去.我猜是因为旧文本"也在更改时加载到寄存器中,我没有意识到.

But in that case, p did exactly what u would have done, it put 'name' back. I guess because the 'old text' is loaded into the register on change too, which I didn't realise.

是否有可以应用于单词/字母/等的用寄存器替换"命令?

Is there a "replace with register" command that can be applied to a word/letter/etc.?

推荐答案

after you yw on NAME 并移动到 name 你可以做:

after you yw on NAME and moved to name you can do:

viwp

或高尔夫升技:vep

这篇关于用准备好放入 vi/vim 的内容替换 word 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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