From c7e7d5e565eca1c8a39a567a7a26cdc2512c1c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E8=82=B2=E9=9C=96?= Date: Wed, 13 Jan 2021 01:45:53 +0800 Subject: [PATCH] Escape special characters in pattern searching (#737) --- autoload/tagbar.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 08fd238..53764e5 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2288,7 +2288,7 @@ function! s:HighlightTag(openfolds, ...) abort " If printing the line number of the tag to the left, and the tag is " visible (I.E. parent isn't folded) - let identifier = '\zs\V' . tag.name . '\m\ze' + let identifier = '\zs\V' . escape(tag.name, '/\') . '\m\ze' if g:tagbar_show_tag_linenumbers == 2 && tagline == tag.tline let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\[[0-9]\+\] \?' . identifier . '/' else