From 417ab865637acdc8f41c7ffa009c828bac028f54 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Fri, 8 Aug 2014 08:01:41 -0700 Subject: [PATCH] update matcher to match that of ctrlp-cmatcher --- autoload/ctrlp.vim | 60 +++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 454ff2e0..fb6f7485 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -1628,25 +1628,47 @@ fu! s:highlight(pat, grp) el let pat = a:pat - " calculate how many letters are here - let lettercount = len(split(pat, '\\{-}')) - for i in range(lettercount) - " surround the letter we care about with \zs and \ze so only it is - " highlighted in this go. Prefer the letter right next to the previous - " one, otherwise scan out to the last one - let letterpat = substitute(pat, - \ '^\%(\\\?.\zs\[\^\\\?.\]\\{-}\)\{'.i.'}\(\\\?.\)\%(\[\^\\\?.\]\\{-}\)\?\ze.*$', - \ '\\(\\zs\1\\|.*\\zs\1\\)\\ze.\\{-}', '') - - if s:byfname - " replace [^x] with [^/x] to make sure no slashes between letters - let letterpat = substitute(letterpat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') - " replace the end to make sure no slashes follow the pattern - let letterpat = substitute(letterpat, '\$\@')