Vim NERD-Commenter:如何仅取消第一级注释的注释,而不取消嵌套注释的注释?
我对 NERD 评论者有意见。
如果我
以下代码:
/*function func(arg) {
codeish; // Nested comment.
}*/
这就是结果:
function func(arg) {
codeish; Nested comment.
}
请注意第二行:嵌套注释也未注释。这不好。
也许我只是没有正确使用它。我怎样才能避免这种情况?
I got a problem with NERD-commenter.
If I <leader>cu
the following code:
/*function func(arg) {
codeish; // Nested comment.
}*/
This is the result:
function func(arg) {
codeish; Nested comment.
}
Note the 2nd line: The nested comment was also uncommented. This is not good.
Perhaps I'm just not using it right. How can I avoid this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,如果您是注释掉该函数的人,则可以通过首先使用
cc
将其注释掉来避免它。这样,该函数将以不同的方式被注释掉,并且后续的cu
将按预期工作。但是,如果您想使用 NERD Commenter 来取消手动注释掉的代码块(或使用不同的工具),我不知道您会如何做。毕竟,
cc
和cu
命令是互惠的。Well, if you're the one who has commented out the function, you can avoid it by using
<leader>cc
to comment it out in the first place. In this way, the function will get commented out in a different way, and subsequent<leader>cu
will work as expected.If, however, you want to use NERD Commenter to uncomment blocks of code which have been commented out manually (or using a different tool), I don't know how would you go about it. After all, the
cc
andcu
commands are meant to be reciprocal.该错误已在最新版本的 NERD-Commenter 中修复。
This bug was fixed in the latest version of NERD-Commenter.