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

Improve handling of delimiters with backslashes #403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions plugin/NERD_commenter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,14 @@ function s:FindDelimiterIndex(delimiter, line)
"get the index of the first occurrence of the delimiter
let delIndx = stridx(a:line, l:delimiter)

"if there is no match and the delimiter contains two backslashes
"then try indexing again but replace those backslashes with only a
"single backslash on the assumption that the two backslashes really
"are an escape for a single backslash
if delIndx == -1 && stridx(l:delimiter, '\\') > 0
let delIndx = stridx(a:line, substitute(l:delimiter, '\\\\', '\', ''))
endif

"keep looping thru the line till we either find a real comment delimiter
"or run off the EOL
while delIndx != -1
Expand Down