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

fix 'g:NERDAllowAnyVisualDelims' behavior #479

Merged
merged 1 commit into from
Sep 2, 2021
Merged

fix 'g:NERDAllowAnyVisualDelims' behavior #479

merged 1 commit into from
Sep 2, 2021

Conversation

jiaobuzuji
Copy link
Contributor

Hi Maintainer

I found that the behavior of the 'g:NERDAllowAnyVisualDelims' option is inconsistent with that described in the document.

*'NERDAllowAnyVisualDelims'*
Values: 0 or 1.
Default: 1.
If set to 1 then, when doing a visual or visual-block comment (but not a
visual-line comment), the script will choose the right delimiters to use for
the comment. This means either using the current delimiters if they are
multipart or using the alternative delimiters if THEY are multipart. For
example if we are editing the following java code: >
float foo = 1221;
float bar = 324;
System.out.println(foo * bar);
<
If we are using // comments and select the "foo" and "bar" in visual-block
mode, as shown left below (where '|'s are used to represent the visual-block
boundary), and comment it then the script will use the alternative delimiters
as shown on the right: >
float |foo| = 1221; float /*foo*/ = 1221;
float |bar| = 324; float /*bar*/ = 324;
System.out.println(foo * bar); System.out.println(foo * bar);
<

PR #440 .

Best Respect.

fix 'g:NERDAllowAnyVisualDelims' action.

                                                    *'NERDAllowAnyVisualDelims'*
Values: 0 or 1.
Default: 1.

If set to 1 then, when doing a visual or visual-block comment (but not a
visual-line comment), the script will choose the right delimiters to use for
the comment. This means either using the current delimiters if they are
multipart or using the alternative delimiters if THEY are multipart.  For
example if we are editing the following java code: >
    float foo = 1221;
    float bar = 324;
    System.out.println(foo * bar);
<
If we are using // comments and select the "foo" and "bar" in visual-block
mode, as shown left below (where '|'s are used to represent the visual-block
boundary), and comment it then the script will use the alternative delimiters
as shown on the right: >

    float |foo| = 1221;                   float /*foo*/ = 1221;
    float |bar| = 324;                    float /*bar*/ = 324;
    System.out.println(foo * bar);        System.out.println(foo * bar);
<
@jiaobuzuji jiaobuzuji changed the title fix 'g:NERDAllowAnyVisualDelims' action fix 'g:NERDAllowAnyVisualDelims' behavior Sep 2, 2021
Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to contribute. I had to read tho code about 5 times before the logic made sense but I think this change is correct. Since I don't actually use the feature much I have to wonder if we'll take anybody by surprised based on what the code did instead of how it was documented. I guess we'll see.

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

Successfully merging this pull request may close these issues.

None yet

2 participants