是否有任何简单/快捷的方法可以“猛拉”到 vim 的“最后一次搜寻”登记册(”/) ?
从 vim 文档来看,答案似乎是否定的,但是可以通过“ let”命令分配:
It is writable with ":let", you can change it to have 'hlsearch' highlight
other matches without actually searching. You can't yank or delete into this
register.
理想情况下,我想做的是:
"/5yw
它会将接下来的5个单词拖到光标下,并将它们放在最后一个搜索缓冲区中
或者,如果有一种方法可以搜索指定寄存器的内容,那也是可行的。换句话说,如果我能做到:
"A5yw
然后搜索注册表 A 中的内容,这也可以。
最接近的方法是猛拉一个指定的登记册,然后将该登记册复制到最后一个搜寻登记册,例如。
"A5yw
:let @/=@A
At the risk of making a long question longer, I want to state that it's not always 5 words I'd like to "yank & search" -- sometimes it's 17 characters, sometimes it's to the end of the line, etc... so a hard-coded macro doesn't give me the flexibility I'd want.