From 97533b37ac829c69428e3a97661a71f62127746f Mon Sep 17 00:00:00 2001 From: Rory Bradford Date: Sat, 26 Oct 2019 13:35:58 +0100 Subject: [PATCH] Improve handling of delimiters with backslashes --- plugin/NERD_commenter.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 07585424..b5b09477 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -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