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

c/c++ alternative delims #425

Open
cridemichel opened this issue May 4, 2020 · 12 comments
Open

c/c++ alternative delims #425

cridemichel opened this issue May 4, 2020 · 12 comments
Labels

Comments

@cridemichel
Copy link
Contributor

cridemichel commented May 4, 2020

Dear developers,
first of all thank you very much for the very nice and useful plugin!
I have a minor issue to report.
To reproduce the issue, do the following steps:

- select in c/c++ the alternate delims '//' by using <leader>ca 
- select several lines in visual mode, e.g.
printf("one\n");
printf("two\n");
printf("three\n");
- comment these lines by using <leader>cc

what I get is the following:

  /* printf("one\n"); */
  // printf("two\n");
  /* printf("three\n"); */

while I expected the following output:

  // printf("one\n");
  // printf("two\n");
  // printf("three\n");

kind regards Cristiano

@alerque alerque added the bug label May 4, 2020
@alerque
Copy link
Member

alerque commented May 4, 2020

I agree something doesn't look right there!

We'd be happy to accept a PR that fixed this if anybody wants to tackle it!

@cridemichel cridemichel changed the title c/c++ alternatie delims c/c++ alternative delims May 10, 2020
@VishalNayek
Copy link

Hi! I am up for the challenge. You can assign this to me.

@VishalNayek
Copy link

Can you help me on how to actually run the source code, I am a bit stuck!

@alerque
Copy link
Member

alerque commented May 16, 2020

@VishalNayek Sure, but I'm not sure what you mean. If you have the plugin installed somewhere you should be able to just edit the plugin code wherever you already have it installed, then rerun vim to use your changes.

@cridemichel
Copy link
Contributor Author

Hi, any chance to have it fixed?

@cridemichel
Copy link
Contributor Author

cridemichel commented Oct 21, 2020

it seems that a possible fix is rather easy, in file plugin/NERD_commenter.vim
inside the function s:CommentBlock, the following if...endif statement

 if !s:Multipart() && g:NERDAllowAnyVisualDelims && s:AltMultipart()
        let switchedDelims = 1
        call s:SwitchToAlternativeDelimiters(0)
    endif

should be replaced with

 if !s:Multipart() && !g:NERDAllowAnyVisualDelims && s:AltMultipart()
        let switchedDelims = 1
        call s:SwitchToAlternativeDelimiters(0)
    endif

since the switch to alternative delimiters there
should occur only if g:NERDAllowAnyVisualDelims = 0

Do you need a pull request or could you apply this minor change yourself?

best Cristiano

@alerque
Copy link
Member

alerque commented Oct 21, 2020

@cridemichel A PR would be easier for others to test!

@cridemichel
Copy link
Contributor Author

I have just created a PR
best C.

@cridemichel
Copy link
Contributor Author

Dear alerque,
is there any chance to have it merged into master?
best Cristiano

alerque pushed a commit that referenced this issue Dec 3, 2020
Co-authored-by: Cristiano De Michele <[email protected]>
@alerque
Copy link
Member

alerque commented Dec 3, 2020

Hey thanks for the poke, I must have missed notification(s) in late October because I don't recall seeing that PR #440 at all. It looks quite reasonable to me and I've gone ahead and merged it.

@cridemichel
Copy link
Contributor Author

cridemichel commented Dec 3, 2020 via email

@cridemichel
Copy link
Contributor Author

cridemichel commented Nov 10, 2021

Hi,
this issue is back and I have submitted a new pull request (#480) to fix it
please give a look at it when you have a chance,
best Cristiano

@alerque alerque reopened this Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants