You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which, as you can see, causes a syntax error at the end of the comment block. The problem occurs if there is any character other than a space after the left delimiter or before the right delimiter.
I was able to make it work without a syntax error (Vim highlights it as a syntax error but it compiles) by removing the spaces from the delimiters that are added in in s:surroundings() and changing the strlen check from 2 to 1. The result is functional but ugly due to lack of whitespace and Vim's syntax error:
My suggestion is that the pre-existing '/*' and '*/' should be replaced with ' /1* ' and ' *1/ ' i.e. add spaces around the modified delimiter, but I haven't figured out a way to implement it yet.
The text was updated successfully, but these errors were encountered:
I got it working, but I won't do a pull request for now because I added too many lines (20). First, I had to do multiple substitutes because I don't think I can use submatches other than submatch(0) for searches with multiple branches. Second, I could probably do something clever with the uncomment flag to handle including spaces in the substitutes or not instead of adding another if statement.
I corrected a lot of little problems that showed up in my testing and only added two more lines. It's still pretty inelegant compared to what I started with, but it handles everything I throw at it, like commenting a paragraph three levels in by including it in gggcG or gc3} and other motions, then being able to uncomment correctly back to the original including leaving trailing whitespace that was in the original text. I also regression tested it against other non-C comment styles and didn't find any problems.
Hi,
I noticed that the plugin doesn't play well with a style of comments I have to work with. This C code:
is commented as:
which, as you can see, causes a syntax error at the end of the comment block. The problem occurs if there is any character other than a space after the left delimiter or before the right delimiter.
I was able to make it work without a syntax error (Vim highlights it as a syntax error but it compiles) by removing the spaces from the delimiters that are added in in
s:surroundings()
and changing thestrlen
check from 2 to 1. The result is functional but ugly due to lack of whitespace and Vim's syntax error:My suggestion is that the pre-existing
'/*'
and'*/'
should be replaced with' /1* '
and' *1/ '
i.e. add spaces around the modified delimiter, but I haven't figured out a way to implement it yet.The text was updated successfully, but these errors were encountered: