Handle that the comment marker can contain regex
In the case of e.g. C Double-tap will correctly detect * as a potential character a comment can start with. But * has special meaning in regular expressions and in the case of Vim will trigger an error if not used correctly. Protect what Double-tap find by surrounding it in \V...\m. Thanks to @utrack for the idea. Fixes #5.
This commit is contained in:
parent
0ceb8558c3
commit
5b150bda13
@ -53,7 +53,7 @@ function! s:Detect_empty_comment()
|
||||
let s:commStart[&ft] = matchstr(&comments, s:pattern)
|
||||
endif
|
||||
let line = getline('.')
|
||||
if s:commStart[&ft] != '' && line =~ '^\s*'. s:commStart[&ft] . '\s*$'
|
||||
if s:commStart[&ft] != '' && line =~ '^\s*\V'. s:commStart[&ft] . '\m\s*$'
|
||||
return "\<C-U>"
|
||||
else
|
||||
return "\<CR>"
|
||||
|
Loading…
Reference in New Issue
Block a user