annotate vendor/vim-autoload/pathogen.vim @ 589:7fbadf8bd22e

Update vendor Change whatever available from official vim
author nanaya <me@myconan.net>
date Thu, 07 Jul 2016 15:59:06 +0900
parents a163d6875651
children 0e72765944d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
1 " pathogen.vim - path option manipulation
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
2 " Maintainer: Tim Pope <http://tpo.pe/>
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
3 " Version: 2.4
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
4
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
5 " Install in ~/.vim/autoload (or ~\vimfiles\autoload).
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
6 "
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
7 " For management of individually installed plugins in ~/.vim/bundle (or
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
8 " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
9 " .vimrc is the only other setup necessary.
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
10 "
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
11 " The API is documented inline below.
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
12
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
13 if exists("g:loaded_pathogen") || &cp
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
14 finish
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
15 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
16 let g:loaded_pathogen = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
17
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
18 " Point of entry for basic default usage. Give a relative path to invoke
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
19 " pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
20 " pathogen#surround(). Curly braces are expanded with pathogen#expand():
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
21 " "bundle/{}" finds all subdirectories inside "bundle" inside all directories
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
22 " in the runtime path.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
23 function! pathogen#infect(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
24 for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
25 if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
26 call pathogen#surround(path)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
27 elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
28 call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
29 call pathogen#surround(path . '/{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
30 elseif path =~# '[{}*]'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
31 call pathogen#interpose(path)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
32 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
33 call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
34 call pathogen#interpose(path . '/{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
35 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
36 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
37 call pathogen#cycle_filetype()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
38 if pathogen#is_disabled($MYVIMRC)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
39 return 'finish'
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
40 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
41 return ''
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
42 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
43
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
44 " Split a path into a list.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
45 function! pathogen#split(path) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
46 if type(a:path) == type([]) | return a:path | endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
47 if empty(a:path) | return [] | endif
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
48 let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
49 return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
50 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
51
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
52 " Convert a list to a path.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
53 function! pathogen#join(...) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
54 if type(a:1) == type(1) && a:1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
55 let i = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
56 let space = ' '
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
57 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
58 let i = 0
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
59 let space = ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
60 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
61 let path = ""
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
62 while i < a:0
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
63 if type(a:000[i]) == type([])
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
64 let list = a:000[i]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
65 let j = 0
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
66 while j < len(list)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
67 let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
68 let path .= ',' . escaped
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
69 let j += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
70 endwhile
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
71 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
72 let path .= "," . a:000[i]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
73 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
74 let i += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
75 endwhile
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
76 return substitute(path,'^,','','')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
77 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
78
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
79 " Convert a list to a path with escaped spaces for 'path', 'tag', etc.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
80 function! pathogen#legacyjoin(...) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
81 return call('pathogen#join',[1] + a:000)
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
82 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
83
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
84 " Turn filetype detection off and back on again if it was already enabled.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
85 function! pathogen#cycle_filetype() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
86 if exists('g:did_load_filetypes')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
87 filetype off
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
88 filetype on
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
89 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
90 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
91
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
92 " Check if a bundle is disabled. A bundle is considered disabled if its
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
93 " basename or full name is included in the list g:pathogen_blacklist or the
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
94 " comma delimited environment variable $VIMBLACKLIST.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
95 function! pathogen#is_disabled(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
96 if a:path =~# '\~$'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
97 return 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
98 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
99 let sep = pathogen#slash()
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
100 let blacklist =
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
101 \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
102 \ pathogen#split($VIMBLACKLIST)
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
103 if !empty(blacklist)
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
104 call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
105 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
106 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
107 endfunction
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
108
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
109 " Prepend the given directory to the runtime path and append its corresponding
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
110 " after directory. Curly braces are expanded with pathogen#expand().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
111 function! pathogen#surround(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
112 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
113 let rtp = pathogen#split(&rtp)
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
114 let path = fnamemodify(a:path, ':s?[\\/]\=$??')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
115 let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
116 let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
117 call filter(rtp, 'index(before + after, v:val) == -1')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
118 let &rtp = pathogen#join(before, rtp, after)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
119 return &rtp
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
120 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
121
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
122 " For each directory in the runtime path, add a second entry with the given
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
123 " argument appended. Curly braces are expanded with pathogen#expand().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
124 function! pathogen#interpose(name) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
125 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
126 let name = a:name
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
127 if has_key(s:done_bundles, name)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
128 return ""
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
129 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
130 let s:done_bundles[name] = 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
131 let list = []
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
132 for dir in pathogen#split(&rtp)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
133 if dir =~# '\<after$'
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
134 let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
135 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
136 let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
137 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
138 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
139 let &rtp = pathogen#join(pathogen#uniq(list))
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
140 return 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
141 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
142
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
143 let s:done_bundles = {}
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
144
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
145 " Invoke :helptags on all non-$VIM doc directories in runtimepath.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
146 function! pathogen#helptags() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
147 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
148 for glob in pathogen#split(&rtp)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
149 for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
150 if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
151 silent! execute 'helptags' pathogen#fnameescape(dir)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
152 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
153 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
154 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
155 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
156
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
157 command! -bar Helptags :call pathogen#helptags()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
158
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
159 " Execute the given command. This is basically a backdoor for --remote-expr.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
160 function! pathogen#execute(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
161 for command in a:000
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
162 execute command
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
163 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
164 return ''
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
165 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
166
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
167 " Section: Unofficial
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
168
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
169 function! pathogen#is_absolute(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
170 return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
171 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
172
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
173 " Given a string, returns all possible permutations of comma delimited braced
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
174 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
175 " ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
176 " and globbed. Actual globs are preserved.
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
177 function! pathogen#expand(pattern, ...) abort
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
178 let after = a:0 ? a:1 : ''
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
179 if a:pattern =~# '{[^{}]\+}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
180 let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
181 let found = map(split(pat, ',', 1), 'pre.v:val.post')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
182 let results = []
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
183 for pattern in found
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
184 call extend(results, pathogen#expand(pattern))
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
185 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
186 elseif a:pattern =~# '{}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
187 let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
188 let post = a:pattern[strlen(pat) : -1]
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
189 let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
190 else
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
191 let results = [a:pattern]
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
192 endif
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
193 let vf = pathogen#slash() . 'vimfiles'
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
194 call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
195 return filter(results, '!empty(v:val)')
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
196 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
197
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
198 " \ on Windows unless shellslash is set, / everywhere else.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
199 function! pathogen#slash() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
200 return !exists("+shellslash") || &shellslash ? '/' : '\'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
201 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
202
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
203 function! pathogen#separator() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
204 return pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
205 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
206
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
207 " Convenience wrapper around glob() which returns a list.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
208 function! pathogen#glob(pattern) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
209 let files = split(glob(a:pattern),"\n")
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
210 return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
211 endfunction
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
212
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
213 " Like pathogen#glob(), only limit the results to directories.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
214 function! pathogen#glob_directories(pattern) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
215 return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
216 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
217
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
218 " Remove duplicates from a list.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
219 function! pathogen#uniq(list) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
220 let i = 0
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
221 let seen = {}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
222 while i < len(a:list)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
223 if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
224 call remove(a:list,i)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
225 elseif a:list[i] ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
226 let i += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
227 let empty = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
228 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
229 let seen[a:list[i]] = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
230 let i += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
231 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
232 endwhile
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
233 return a:list
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
234 endfunction
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
235
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
236 " Backport of fnameescape().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
237 function! pathogen#fnameescape(string) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
238 if exists('*fnameescape')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
239 return fnameescape(a:string)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
240 elseif a:string ==# '-'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
241 return '\-'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
242 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
243 return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
244 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
245 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
246
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
247 " Like findfile(), but hardcoded to use the runtimepath.
589
7fbadf8bd22e Update vendor
nanaya <me@myconan.net>
parents: 572
diff changeset
248 function! pathogen#runtime_findfile(file,count) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
249 let rtp = pathogen#join(1,pathogen#split(&rtp))
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
250 let file = findfile(a:file,rtp,a:count)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
251 if file ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
252 return ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
253 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
254 return fnamemodify(file,':p')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
255 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
256 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
257
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
258 " Section: Deprecated
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
259
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
260 function! s:warn(msg) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
261 echohl WarningMsg
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
262 echomsg a:msg
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
263 echohl NONE
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
264 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
265
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
266 " Prepend all subdirectories of path to the rtp, and append all 'after'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
267 " directories in those subdirectories. Deprecated.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
268 function! pathogen#runtime_prepend_subdirectories(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
269 call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
270 return pathogen#surround(a:path . pathogen#slash() . '{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
271 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
272
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
273 function! pathogen#incubate(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
274 let name = a:0 ? a:1 : 'bundle/{}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
275 call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
276 return pathogen#interpose(name)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
277 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
278
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
279 " Deprecated alias for pathogen#interpose().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
280 function! pathogen#runtime_append_all_bundles(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
281 if a:0
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
282 call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
283 else
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
284 call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
285 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
286 return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
287 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
288
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
289 if exists(':Vedit')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
290 finish
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
291 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
292
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
293 let s:vopen_warning = 0
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
294
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
295 function! s:find(count,cmd,file,lcd)
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
296 let rtp = pathogen#join(1,pathogen#split(&runtimepath))
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
297 let file = pathogen#runtime_findfile(a:file,a:count)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
298 if file ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
299 return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
300 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
301 if !s:vopen_warning
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
302 let s:vopen_warning = 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
303 let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
304 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
305 let warning = ''
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
306 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
307 if a:lcd
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
308 let path = file[0:-strlen(a:file)-2]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
309 execute 'lcd `=path`'
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
310 return a:cmd.' '.pathogen#fnameescape(a:file) . warning
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
311 else
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
312 return a:cmd.' '.pathogen#fnameescape(file) . warning
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
313 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
314 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
315
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
316 function! s:Findcomplete(A,L,P)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
317 let sep = pathogen#slash()
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
318 let cheats = {
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
319 \'a': 'autoload',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
320 \'d': 'doc',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
321 \'f': 'ftplugin',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
322 \'i': 'indent',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
323 \'p': 'plugin',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
324 \'s': 'syntax'}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
325 if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
326 let request = cheats[a:A[0]].a:A[1:-1]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
327 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
328 let request = a:A
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
329 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
330 let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
331 let found = {}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
332 for path in pathogen#split(&runtimepath)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
333 let path = expand(path, ':p')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
334 let matches = split(glob(path.sep.pattern),"\n")
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
335 call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
336 call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
337 for match in matches
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
338 let found[match] = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
339 endfor
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
340 endfor
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
341 return sort(keys(found))
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
342 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
343
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
344 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
345 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
346 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
347 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
348 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
349 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
350 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
351 command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
352
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
353 " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':