diff options
| author | Ben Beltran <ben@freshout.us> | 2012-10-19 15:09:38 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@freshout.us> | 2012-10-19 15:09:38 -0500 |
| commit | 321ecaca67426410316db7db05e6e33809fe1e63 (patch) | |
| tree | 3811f15c160c6593e84ebfab3994c810a0eeeda5 /vim/autoload/Pl/Match.vim | |
| parent | 9041bd938fcce0cf91032c67d529bc21fedeeed3 (diff) | |
Add powerline
Diffstat (limited to 'vim/autoload/Pl/Match.vim')
| -rw-r--r-- | vim/autoload/Pl/Match.vim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vim/autoload/Pl/Match.vim b/vim/autoload/Pl/Match.vim new file mode 100644 index 0000000..b05f585 --- /dev/null +++ b/vim/autoload/Pl/Match.vim @@ -0,0 +1,43 @@ +function! Pl#Match#Add(pat, expr) " {{{ + return [a:pat, a:expr] +endfunction " }}} +function! Pl#Match#Any(...) " {{{ + let matches = [] + + for match_name in a:000 + if empty(match_name) + " Skip empty match parameters + continue + endif + + if has_key(g:Powerline#Matches#matches, match_name) + call add(matches, g:Powerline#Matches#matches[match_name]) + endif + + unlet! match_name + endfor + + return ['match', 'any', matches] +endfunction " }}} +function! Pl#Match#Validate(theme) " {{{ + let match = a:theme.matches[1] + + if match == 'none' + return 0 + elseif match == 'any' + let matches = a:theme.matches[2] + + if ! len(matches) + " Empty match array matches everything + return 1 + endif + + for [eval, re] in matches + if match(eval(eval), '\v'. re) != -1 + return 1 + endif + endfor + + return 0 + endif +endfunction " }}} |