comparison vim/autoload/ludo.vim @ 424:d8086f81b9c8

Pathogen config files.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 27 Mar 2018 21:34:25 -0700
parents
children 67f14a8c2304
comparison
equal deleted inserted replaced
423:f2b1eae0432b 424:d8086f81b9c8
1
2 " Loads `pathogenrc` files in each bundle directory and, if found,
3 " builds an exclude list based on the glob patterns found in them.
4 "
5 function! ludo#setup_pathogen(bundle_dirs) abort
6 for bundle_dir in a:bundle_dirs
7 let l:rcfile = bundle_dir.'/pathogenrc'
8 if !filereadable(l:rcfile)
9 continue
10 endif
11
12 let l:included = []
13 let l:excluded = []
14 let l:rclines = readfile(l:rcfile)
15 for line in l:rclines
16 if line[0] == '#'
17 continue
18 endif
19
20 if line[0] == '-'
21 let l:excls = glob(bundle_dir.'/'.line[1:], 1, 1)
22 for excl in l:excls
23 let l:idx = index(l:included, excl)
24 if l:idx >= 0
25 call remove(l:included, l:idx)
26 endif
27 call add(l:excluded, excl)
28 endfor
29 else
30 let l:incls = glob(bundle_dir.'/'.line, 1, 1)
31 for incl in l:incls
32 let l:idx = index(l:excluded, incl)
33 if l:idx >= 0
34 call remove(l:excluded, l:idx)
35 endif
36 call add(l:included, incl)
37 endfor
38 endif
39 endfor
40
41 for excl in l:excluded
42 if isdirectory(excl)
43 let l:excl_name = fnamemodify(excl, ':t')
44 call add(g:pathogen_disabled, l:excl_name)
45 endif
46 endfor
47 endfor
48 endfunction
49