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 nested comments #2

Merged
merged 2 commits into from Jul 16, 2014
Merged

Fix nested comments #2

merged 2 commits into from Jul 16, 2014

Conversation

chocolateboy
Copy link
Contributor

The whole of the following program is highlighted as a comment for me in vim 7.4 (Ubuntu 14.04):

/* Hello, world! */

fun main(args: Array<String>) {
    println("Hello, world!")
}

The problem appears to be that /* is matched as the start of the inner/contained region rather than the start of the outer/containing region i.e. this works:

/* */ */

fun main(args: Array<String>) {
    println("Hello, world!")
}

The documentation doesn't help much, but using a matchgroup (and not giving it the same name as the region) seems to solve the problem, and even handles /*/**/*/ and /* */* (via) correctly.

I also updated the README to include Vundle and Pathogen installation instructions.

@udalov
Copy link
Owner

udalov commented Jul 15, 2014

Interesting... I don't have such a problem neither on Ubuntu nor on OS X. Do you have any specific configuration options that may cause this, e.g. a non-default 'magic' value? Does it reproduce on a clean (no .vimrc) setup?

@@ -28,9 +28,9 @@ syn keyword ktConstant null

syn keyword ktModifier data inline volatile

syn keyword ktTodo contained TODO FIXME XXX
syn keyword ktTodo TODO FIXME XXX contained
Copy link
Owner

Choose a reason for hiding this comment

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

Does this also fix something? :)

@chocolateboy
Copy link
Contributor Author

Do you have any specific configuration options that may cause this, e.g. a non-default 'magic' value?

Not that I'm aware of. vim -u NONE was the first thing I tried. The problem doesn't exist for me prior to this commit, and it goes away if I replace contains=ktComment,ktTodo,@Spell with contains=ktTodo,@Spell.

Does this also fix something? :)

No, it's just for consistency :-)

@chocolateboy
Copy link
Contributor Author

I can't reproduce the main issue with vim 7.3.409 (though it still barfs on /*/**/*/ and /* */* without this patch). My 7.4 patchlevel is 52.

udalov added a commit that referenced this pull request Jul 16, 2014
Fix nested comments, add Vundle/Pathogen installation instructions
@udalov udalov merged commit 4dffb1c into udalov:master Jul 16, 2014
@udalov
Copy link
Owner

udalov commented Jul 16, 2014

Thank you!

@chocolateboy chocolateboy deleted the fix_comments branch July 16, 2014 17:21
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