vim:显示子匹配内容和替换中的未命名寄存器
我在命令行中有多个命令,用于在未命名的寄存器 @" 中构建文本字符串。然后我有一个捕获几个原子的替代品。最后,我需要用两个子匹配(\1 和\2) 和@"。
在首次显示子匹配之后,我无法让 @" reg 显示其内容。我可以在显示子匹配之前显示 @" 。例如:
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2 "displays perfectly
或者,
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\=@" "displays 'textString' perfectly
但是,
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2@"
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2\@"
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2\=@"
全部无法显示“textString”的寄存器内容,而是显示“@”'
有人知道这是为什么吗?
I've got multiple commands in a command line that builds a text string in the unnamed register @". Then I have a substitute that captures a couple of atoms. Finally, I need to replace a pattern with the two submatches (\1 and \2) AND the @".
I cannot get the @" reg to display its contents AFTER first displaying the submatches. I can display the @" prior to displaying the submatches. For ex:
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2 "displays perfectly
Or,
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\=@" "displays 'textString' perfectly
But,
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2@"
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2\@"
multi-commands | @"=textString | 'a,'bs/(atom1)(atom2)/\1\2\=@"
All fail to display the register contents of 'textString' and instead show '@"'
Does anyone know why that is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为
\=
需要成为替换中的第一项。您应该使用以下内容:
That's because of
\=
needs to be first item in a replacement.You should use the following: