annotate vendor/vim-autoload/pathogen.vim @ 572:a163d6875651

Vendor autoloads.
author nanaya <me@myconan.net>
date Wed, 24 Jun 2015 13:41:51 +0900
parents rc/vim-autoload-pathogen@ea4bc5799d71
children 7fbadf8bd22e
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/>
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
3 " Version: 2.3
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
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
93 " basename or full name is included in the list g:pathogen_disabled.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
94 function! pathogen#is_disabled(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
95 if a:path =~# '\~$'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
96 return 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
97 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
98 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
99 let blacklist = map(
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
100 \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
101 \ pathogen#split($VIMBLACKLIST),
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
102 \ 'substitute(v:val, "[\\/]$", "", "")')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
103 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
104 endfunction "}}}1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
105
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
106 " Prepend the given directory to the runtime path and append its corresponding
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
107 " after directory. Curly braces are expanded with pathogen#expand().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
108 function! pathogen#surround(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
109 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
110 let rtp = pathogen#split(&rtp)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
111 let path = fnamemodify(a:path, ':p:?[\\/]\=$??')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
112 let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
113 let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
114 call filter(rtp, 'index(before + after, v:val) == -1')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
115 let &rtp = pathogen#join(before, rtp, after)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
116 return &rtp
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
117 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
118
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
119 " 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
120 " argument appended. Curly braces are expanded with pathogen#expand().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
121 function! pathogen#interpose(name) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
122 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
123 let name = a:name
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
124 if has_key(s:done_bundles, name)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
125 return ""
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
126 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
127 let s:done_bundles[name] = 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
128 let list = []
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
129 for dir in pathogen#split(&rtp)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
130 if dir =~# '\<after$'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
131 let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
132 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
133 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
134 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
135 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
136 let &rtp = pathogen#join(pathogen#uniq(list))
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
137 return 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
138 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
139
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
140 let s:done_bundles = {}
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
141
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
142 " Invoke :helptags on all non-$VIM doc directories in runtimepath.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
143 function! pathogen#helptags() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
144 let sep = pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
145 for glob in pathogen#split(&rtp)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
146 for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
147 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
148 silent! execute 'helptags' pathogen#fnameescape(dir)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
149 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
150 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
151 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
152 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
153
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
154 command! -bar Helptags :call pathogen#helptags()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
155
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
156 " Execute the given command. This is basically a backdoor for --remote-expr.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
157 function! pathogen#execute(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
158 for command in a:000
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
159 execute command
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
160 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
161 return ''
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
162 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
163
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
164 " Section: Unofficial
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
165
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
166 function! pathogen#is_absolute(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
167 return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
168 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
169
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
170 " Given a string, returns all possible permutations of comma delimited braced
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
171 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
172 " ['/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
173 " and globbed. Actual globs are preserved.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
174 function! pathogen#expand(pattern) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
175 if a:pattern =~# '{[^{}]\+}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
176 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
177 let found = map(split(pat, ',', 1), 'pre.v:val.post')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
178 let results = []
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
179 for pattern in found
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
180 call extend(results, pathogen#expand(pattern))
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
181 endfor
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
182 return results
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
183 elseif a:pattern =~# '{}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
184 let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
185 let post = a:pattern[strlen(pat) : -1]
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
186 return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
187 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
188 return [a:pattern]
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
189 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
190 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
191
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
192 " \ on Windows unless shellslash is set, / everywhere else.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
193 function! pathogen#slash() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
194 return !exists("+shellslash") || &shellslash ? '/' : '\'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
195 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
196
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
197 function! pathogen#separator() abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
198 return pathogen#slash()
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
199 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
200
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
201 " Convenience wrapper around glob() which returns a list.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
202 function! pathogen#glob(pattern) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
203 let files = split(glob(a:pattern),"\n")
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
204 return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
205 endfunction "}}}1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
206
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
207 " Like pathogen#glob(), only limit the results to directories.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
208 function! pathogen#glob_directories(pattern) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
209 return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
210 endfunction "}}}1
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
211
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
212 " Remove duplicates from a list.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
213 function! pathogen#uniq(list) abort
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
214 let i = 0
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
215 let seen = {}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
216 while i < len(a:list)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
217 if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
218 call remove(a:list,i)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
219 elseif a:list[i] ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
220 let i += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
221 let empty = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
222 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
223 let seen[a:list[i]] = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
224 let i += 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
225 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
226 endwhile
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
227 return a:list
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
228 endfunction
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
229
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
230 " Backport of fnameescape().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
231 function! pathogen#fnameescape(string) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
232 if exists('*fnameescape')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
233 return fnameescape(a:string)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
234 elseif a:string ==# '-'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
235 return '\-'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
236 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
237 return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
238 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
239 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
240
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
241 " Like findfile(), but hardcoded to use the runtimepath.
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
242 function! pathogen#runtime_findfile(file,count) abort "{{{1
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
243 let rtp = pathogen#join(1,pathogen#split(&rtp))
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
244 let file = findfile(a:file,rtp,a:count)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
245 if file ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
246 return ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
247 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
248 return fnamemodify(file,':p')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
249 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
250 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
251
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
252 " Section: Deprecated
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
253
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
254 function! s:warn(msg) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
255 echohl WarningMsg
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
256 echomsg a:msg
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
257 echohl NONE
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
258 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
259
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
260 " Prepend all subdirectories of path to the rtp, and append all 'after'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
261 " directories in those subdirectories. Deprecated.
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
262 function! pathogen#runtime_prepend_subdirectories(path) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
263 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
264 return pathogen#surround(a:path . pathogen#slash() . '{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
265 endfunction
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
266
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
267 function! pathogen#incubate(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
268 let name = a:0 ? a:1 : 'bundle/{}'
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
269 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
270 return pathogen#interpose(name)
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 " Deprecated alias for pathogen#interpose().
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
274 function! pathogen#runtime_append_all_bundles(...) abort
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
275 if a:0
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
276 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
277 else
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
278 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
279 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
280 return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
281 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
282
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
283 if exists(':Vedit')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
284 finish
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
285 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
286
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
287 let s:vopen_warning = 0
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
288
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
289 function! s:find(count,cmd,file,lcd)
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
290 let rtp = pathogen#join(1,pathogen#split(&runtimepath))
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
291 let file = pathogen#runtime_findfile(a:file,a:count)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
292 if file ==# ''
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
293 return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
294 endif
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
295 if !s:vopen_warning
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
296 let s:vopen_warning = 1
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
297 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
298 else
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
299 let warning = ''
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 a:lcd
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
302 let path = file[0:-strlen(a:file)-2]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
303 execute 'lcd `=path`'
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
304 return a:cmd.' '.pathogen#fnameescape(a:file) . warning
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
305 else
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
306 return a:cmd.' '.pathogen#fnameescape(file) . warning
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
307 endif
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
308 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
309
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
310 function! s:Findcomplete(A,L,P)
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
311 let sep = pathogen#slash()
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
312 let cheats = {
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
313 \'a': 'autoload',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
314 \'d': 'doc',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
315 \'f': 'ftplugin',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
316 \'i': 'indent',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
317 \'p': 'plugin',
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
318 \'s': 'syntax'}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
319 if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
320 let request = cheats[a:A[0]].a:A[1:-1]
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
321 else
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
322 let request = a:A
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
323 endif
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
324 let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
325 let found = {}
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
326 for path in pathogen#split(&runtimepath)
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
327 let path = expand(path, ':p')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
328 let matches = split(glob(path.sep.pattern),"\n")
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
329 call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
330 call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
331 for match in matches
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
332 let found[match] = 1
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
333 endfor
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
334 endfor
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
335 return sort(keys(found))
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
336 endfunction
425
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
337
7394b88bf1c6 Pathogen in vim.
Edho Arief <edho@myconan.net>
parents:
diff changeset
338 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
339 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
340 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
341 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
342 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
343 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
344 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
345 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
346
569
ea4bc5799d71 Update pathogen.
nanaya <me@myconan.net>
parents: 425
diff changeset
347 " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':