]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/autoload/Pl/Match.vim
Adds the backup folder for vim
[rbdr/dotfiles] / vim / autoload / Pl / Match.vim
CommitLineData
321ecaca
BB
1function! Pl#Match#Add(pat, expr) " {{{
2 return [a:pat, a:expr]
3endfunction " }}}
4function! Pl#Match#Any(...) " {{{
5 let matches = []
6
7 for match_name in a:000
8 if empty(match_name)
9 " Skip empty match parameters
10 continue
11 endif
12
13 if has_key(g:Powerline#Matches#matches, match_name)
14 call add(matches, g:Powerline#Matches#matches[match_name])
15 endif
16
17 unlet! match_name
18 endfor
19
20 return ['match', 'any', matches]
21endfunction " }}}
22function! Pl#Match#Validate(theme) " {{{
23 let match = a:theme.matches[1]
24
25 if match == 'none'
26 return 0
27 elseif match == 'any'
28 let matches = a:theme.matches[2]
29
30 if ! len(matches)
31 " Empty match array matches everything
32 return 1
33 endif
34
35 for [eval, re] in matches
36 if match(eval(eval), '\v'. re) != -1
37 return 1
38 endif
39 endfor
40
41 return 0
42 endif
43endfunction " }}}