Skip to content

Commit 0404e56

Browse files
committed
revert to original match behavior
add match_natural_name to not match with kl with knee/leg needless. Close #265
1 parent 8c0618c commit 0404e56

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

autoload/ctrlp.vim

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
9393
\ 'open_single_match': ['s:opensingle', []],
9494
\ 'brief_prompt': ['s:brfprt', 0],
9595
\ 'match_current_file': ['s:matchcrfile', 0],
96+
\ 'match_natural_name': ['s:matchnatural', 0],
9697
\ 'compare_lim': ['s:compare_lim', 3000],
9798
\ 'bufname_mod': ['s:bufname_mod', ':t'],
9899
\ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'],
@@ -1823,7 +1824,7 @@ fu! s:highlight(pat, grp)
18231824
" occurrence of our letters. We also ensure that our matcher is case
18241825
" insensitive or sensitive depending.
18251826
cal matchadd(a:grp, beginning.middle.ending)
1826-
endfor
1827+
endfo
18271828
en
18281829

18291830
cal matchadd('CtrlPLinePre', '^>')
@@ -2347,10 +2348,16 @@ endf
23472348

23482349
fu! s:buildpat(lst)
23492350
let pat = a:lst[0]
2350-
for item in range(1, len(a:lst) - 1)
2351-
let c = a:lst[item - 1]
2352-
let pat .= (c == '/' ? '[^/]\{-}' : '[^'.c.'/]\{-}').a:lst[item]
2353-
endfo
2351+
if s:matchnatural == 1
2352+
for item in range(1, len(a:lst) - 1)
2353+
let c = a:lst[item - 1]
2354+
let pat .= (c == '/' ? '[^/]\{-}' : '[^'.c.'/]\{-}').a:lst[item]
2355+
endfo
2356+
else
2357+
for item in range(1, len(a:lst) - 1)
2358+
let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item]
2359+
endfo
2360+
en
23542361
retu pat
23552362
endf
23562363

0 commit comments

Comments
 (0)