Skip to content

Commit 3559e2b

Browse files
committed
More complicated, but even better highlighting
Prefers grouping words together, examples: app/assets/javascripts/common --- ------ > app/common app/models/group_user.rb --- ------ ---- > appmodelsuser
1 parent b5f8261 commit 3559e2b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

autoload/ctrlp.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,11 @@ fu! s:highlight(pat, grp)
16321632
let lettercount = len(split(pat, '\\{-}'))
16331633
for i in range(lettercount)
16341634
" surround the letter we care about with \zs and \ze so only it is
1635-
" highlighted in this go.
1636-
let letterpat = substitute(pat, '^\%(.\{-}\\{-}\)\{'.i.'}\zs.\{-}\ze\%(\[^.*\)\?$', '\\zs\0\\ze', '')
1635+
" highlighted in this go. Prefer the letter right next to the previous
1636+
" one, otherwise scan out to the last one
1637+
let letterpat = substitute(pat,
1638+
\ '^\%(\\\?.\zs\[\^\\\?.\]\\{-}\)\{'.i.'}\(\\\?.\)\%(\[\^\\\?.\]\\{-}\)\?\ze.*$',
1639+
\ '\\(\\zs\1\\|.*\\zs\1\\)\\ze.\\{-}', '')
16371640

16381641
if s:byfname
16391642
" replace [^x] with [^/x] to make sure no slashes between letters

0 commit comments

Comments
 (0)