Skip to content

Commit 228a621

Browse files
committed
Add an option to support optional regex input
Fix justinmk#104. This should support more flexibility in customisation. With this option enabled, only input text not containing "\v, \V, \m, \M" are treated literal.
1 parent d45cebd commit 228a621

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

autoload/sneak/search.vim

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ func! sneak#search#new()
88
" search pattern modifiers (case-sensitivity, magic)
99
let self.prefix = sneak#search#get_cs(a:input, g:sneak#opt.use_ic_scs).'\V'
1010
" the escaped user input to search for
11-
let self.search = escape(a:input, '"\')
11+
let input = escape(a:input, '"')
12+
let self.search = g:sneak#opt.regex_input ? input.'\V' : escape(input, '\')
1213
" example: highlight string 'ab' after line 42, column 5
1314
" matchadd('foo', 'ab\%>42l\%5c', 1)
1415
let self.match_pattern = ''

plugin/sneak.vim

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func! sneak#init()
2424
\ ,'use_ic_scs' : get(g:, 'sneak#use_ic_scs', 0)
2525
\ ,'map_netrw' : get(g:, 'sneak#map_netrw', 1)
2626
\ ,'streak' : get(g:, 'sneak#streak', 0) && (v:version >= 703) && has("conceal")
27+
\ ,'regex_input' : get(g:, 'sneak#regex_input', 0)
2728
\ }
2829

2930
for k in ['f', 't'] "if user mapped f/t to Sneak, then disable f/t reset.

0 commit comments

Comments
 (0)