Skip to content

Commit f140fa6

Browse files
committed
Fix: pattern match not working for filenames containing '-'
1 parent d4c3d64 commit f140fa6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

after/syntax/nerdtree.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ for [key, val] in items(g:NERDTreePatternMatchHighlightColor)
485485
let suffix = substitute(key, '\W', '', 'g')
486486
let label_identifier = 'nerdtreePatternMatchLabel_'.suffix
487487
let icon_identifier = 'nerdtreePatternMatchIcon_'.suffix
488-
let sub_regexp = substitute(key, '\v\\@<!\.', s:characters, 'g')
488+
" substitute will 'eat' single backlashes on the string
489+
let chars_double_lashes = substitute(s:characters, '\\', '\\\\', 'g')
490+
let sub_regexp = substitute(key, '\v\\@<!\.', chars_double_lashes, 'g')
489491
let exec_sub_regexp = substitute(sub_regexp, '\$$', '\\*$', '')
490492

491493
exec 'syn match '.label_identifier.' "\v\c'.sub_regexp.'" containedin=NERDTreeFile'

0 commit comments

Comments
 (0)