开发者

Vim NERD-Commenter: How to uncomment only first level of comments, without uncomment nested comments?

开发者 https://www.devze.com 2023-02-19 10:30 出处:网络
I got a problem with NERD-commenter. If I <leader>cu the following code: /*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?


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 and cu commands are meant to be reciprocal.


This bug was fixed in the latest version of NERD-Commenter.

0

精彩评论

暂无评论...
验证码 换一张
取 消