Skip to content

Commit

Permalink
unescape braces if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Konfekt committed Aug 27, 2021
1 parent 1c3c4c6 commit 8882b9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugin/grepper.vim
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ function! s:query2vimregexp(flags) abort
endif
let vim_query = '\V'. vim_query
else
" if tool escapes { and }, then unescape them
let tool = s:get_current_tool(a:flags)
if match(tool.escape, '{') != -1
let vim_query = substitute(vim_query, '\\{', '{', 'g')
endif
if match(tool.escape, '}') != -1
let vim_query = substitute(vim_query, '\\}', '}', 'g')
endif
" \bfoo\b -> \<foo\> Assume only one pair.
let vim_query = substitute(vim_query, '\v\\b(.{-})\\b', '\\<\1\\>', '')
" *? -> \{-}
Expand Down

0 comments on commit 8882b9b

Please sign in to comment.