Skip to content

Commit

Permalink
Add an option to support optional regex input
Browse files Browse the repository at this point in the history
Fix justinmk#104. This should support more flexibility in customisation. With
this option enabled, input text not matching '^\\[vVmM].' are still
treated literal.
  • Loading branch information
bohrshaw committed May 14, 2014
1 parent d45cebd commit f00dfc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autoload/sneak/search.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ func! sneak#search#new()
" search pattern modifiers (case-sensitivity, magic)
let self.prefix = sneak#search#get_cs(a:input, g:sneak#opt.use_ic_scs).'\V'
" the escaped user input to search for
let self.search = escape(a:input, '"\')
let input = escape(a:input, '"')
let self.search = g:sneak#opt.regex_input && input =~? '^\\[vm].' ?
\ input.'\V' : escape(input, '\')
" example: highlight string 'ab' after line 42, column 5
" matchadd('foo', 'ab\%>42l\%5c', 1)
let self.match_pattern = ''
Expand Down
1 change: 1 addition & 0 deletions plugin/sneak.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func! sneak#init()
\ ,'use_ic_scs' : get(g:, 'sneak#use_ic_scs', 0)
\ ,'map_netrw' : get(g:, 'sneak#map_netrw', 1)
\ ,'streak' : get(g:, 'sneak#streak', 0) && (v:version >= 703) && has("conceal")
\ ,'regex_input' : get(g:, 'sneak#regex_input', 0)
\ }

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

0 comments on commit f00dfc4

Please sign in to comment.