Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment lines lile "/* x */" results in /*[> x <] */, thus uncomment it result in [> x <]. #170

Closed
pengubco opened this issue Nov 18, 2014 · 8 comments

Comments

@pengubco
Copy link

pengubco commented Nov 18, 2014

I have a habit of commenting a single line using /* */. For example, using [leader]cm.
When I need to comment these comment-lines out (for debugging) and then getting these comment-lines back after. I got a bunch of [> my comment lines <].

For example,

 int n = 3;                                         
  /*call function asynchronously:*/
 std::future<bool> fut = std::async (is_prime,n);
 std::cout<< n << std::endl;

Run [leader]cm in visual select mode results in ,

 /*int n = 3;                                           
  [>call function asynchronously:<]
 std::future<bool> fut = std::async (is_prime,n);*/
@chrisboyce
Copy link

I'm having the same issue.

@jorijn
Copy link

jorijn commented Nov 25, 2014

Same here

@martinwk
Copy link

Same here. It did work in an older version I used (don't know which)

@knight42
Copy link

My PR has fixed this issue.

@alerque
Copy link
Member

alerque commented May 24, 2016

Thanks for reviewing your PR @knight42, but I'm not sure this is actually fixed. I tested the example @pengubco let off with and I get a different result, but still broken. The nested comment placeholders aren't getting placed, but this causes the comment nesting to break. The real fix would be to set the placeholders, but also unset them appropriately. Would your patch actually do this correctly? Or does in actually work now and I'm missing something?

@knight42
Copy link

@alerque The problem we encountered before is that if the following lines are uncommented,

 /*int n = 3;                                           
  [>call function asynchronously:<]
 std::future<bool> fut = std::async (is_prime,n);*/

we' ll get

 int n = 3;                                           
  [>call function asynchronously:<]
 std::future<bool> fut = std::async (is_prime,n);

But using the latest nerdcommenter, we' ll get

 int n = 3;                                           
  /*call function asynchronously:*/
 std::future<bool> fut = std::async (is_prime,n);

Could I know the different result in your test?

@alerque
Copy link
Member

alerque commented May 24, 2016

@knight42 I get the same result for that particular case of uncommenting. The issue I see is with commenting it in the first place. For reference given this file with filetype=c:

int n = 3;                                         
/*call function asynchronously:*/
std::future<bool> fut = std::async (is_prime,n);
std::cout<< n << std::endl;

Selecting everything and commenting it using the simple block method (ggVG\cm) leaves me with this:

/* int n = 3;                                         
/*call function asynchronously:*/
std::future<bool> fut = std::async (is_prime,n);
std::cout<< n << std::endl; */

@alerque
Copy link
Member

alerque commented May 24, 2016

Oh, I see what's different. I have let g:NERDSpaceDelims = 1 set in my RC file. If I remove that (or add spaces to the linewise comment) it recognizes the nested comment and makes it a placeholder. It wasn't before because it didn't have the requisite spaces. I guess that means we can close this for now (with a better solution to come for languages that actually support nesting via #151). Thanks for the review.

If anybody has anything to add or a case that isn't working, please comment and we'll reevaluate.

@alerque alerque closed this as completed May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants