@@ -11,12 +11,21 @@ func! vundle#scripts#all(bang, ...)
11
11
let info = [' "Keymap: i - Install plugin; c - Cleanup; s - Search; R - Reload list' ]
12
12
let matches = s: load_scripts (a: bang )
13
13
if ! empty (a: 1 )
14
- let matches = filter (matches, ' v:val =~? "' .escape (a: 1 ,' "' ).' "' )
14
+ let escapedSearch = escape (a: 1 ,' "' )
15
+ " Search both name and description of a plugin
16
+ " for matches
17
+ let matches = filter (matches,
18
+ \ ' v:val.n =~? "' .escapedSearch.'" ||
19
+ \ v: val .s = ~? " '.escapedSearch.'" ')
15
20
let info += [' "Search results for: ' .a: 1 ]
16
- " TODO: highlight matches
17
21
let b: match = a: 1
18
22
endif
19
- call vundle#scripts#view (' search' ,info, vundle#scripts#bundle_names (reverse (matches)))
23
+ call vundle#scripts#view (' search' ,info, vundle#scripts#bundle_search_data (matches))
24
+
25
+ if exists (' escapedSearch' )
26
+ exec ' match Search /\v\c' . escapedSearch . ' /'
27
+ endif
28
+
20
29
redraw
21
30
echo len (matches).' plugins found'
22
31
endf
@@ -115,9 +124,18 @@ endf
115
124
" return -- a list of 'Plugin ...' lines suitable to be written to a buffer
116
125
" ---------------------------------------------------------------------------
117
126
func ! vundle#scripts#bundle_names (names)
118
- return map (copy (a: names ), ' printf("Plugin ' . " '%s'" . ' ", v:val) ' )
127
+ return map (copy (a: names ), ' printf("Plugin '' %s'' ", v:val ' )
119
128
endf
120
129
130
+ " ---------------------------------------------------------------------------
131
+ " Create a list of 'Plugin ...' lines from a list of bundle search data.
132
+ "
133
+ " names -- a list of data (dictionaries) of plugins
134
+ " return -- a list of 'Plugin ...' lines suitable to be written to a buffer
135
+ " ---------------------------------------------------------------------------
136
+ func ! vundle#scripts#bundle_search_data (data)
137
+ return map (copy (a: data ), ' printf("Plugin '' %s'' \" %s", v:val.n, v:val.s) ' )
138
+ endf
121
139
122
140
" ---------------------------------------------------------------------------
123
141
" Open a buffer to display information to the user. Several special commands
@@ -158,6 +176,9 @@ func! vundle#scripts#view(title, headers, results)
158
176
syn keyword vimCommand Bundle
159
177
syn keyword vimCommand Helptags
160
178
179
+ " Without this, highlighting breaks when description contains double quotes
180
+ syn match vimComment ' \v ".*$'
181
+
161
182
com ! - buffer - bang -nargs =1 DeletePlugin
162
183
\ call vundle#installer#run (' vundle#installer#delete' , split (<q-args> ,' ,' )[0 ], [' !' == ' <bang>' , <args> ])
163
184
@@ -175,13 +196,13 @@ func! vundle#scripts#view(title, headers, results)
175
196
com ! - buffer -nargs =0 VundleChangelog call s: view_changelog ()
176
197
177
198
nnoremap <buffer> q :silent bd!<CR>
178
- nnoremap <buffer> D :exec 'Delete'.getline('.' )<CR>
199
+ nnoremap <buffer> D :exec 'Delete'.<SID> get_plugin_line( )<CR>
179
200
180
- nnoremap <buffer> add :exec 'Install'.getline('.' )<CR>
181
- nnoremap <buffer> add! :exec 'Install'.substitute(getline('.' ), '^Plugin ', 'Plugin! ', '')<CR>
201
+ nnoremap <buffer> add :exec 'Install'.<SID> get_plugin_line( )<CR>
202
+ nnoremap <buffer> add! :exec 'Install'.substitute(<SID> get_plugin_line( ), '^Plugin ', 'Plugin! ', '')<CR>
182
203
183
- nnoremap <buffer> i :exec 'InstallAndRequire'.getline('.' )<CR>
184
- nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.' ), '^Plugin ', 'Plugin! ', '')<CR>
204
+ nnoremap <buffer> i :exec 'InstallAndRequire'.<SID> get_plugin_line( )<CR>
205
+ nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(<SID> get_plugin_line( ), '^Plugin ', 'Plugin! ', '')<CR>
185
206
186
207
nnoremap <buffer> l :VundleLog<CR>
187
208
nnoremap <buffer> u :VundleChangelog<CR>
@@ -199,6 +220,14 @@ func! vundle#scripts#view(title, headers, results)
199
220
endf
200
221
201
222
223
+ " ---------------------------------------------------------------------------
224
+ " Remove description from plugin line to prevent current
225
+ " implementation from breaking.
226
+ " ---------------------------------------------------------------------------
227
+ func ! s: get_plugin_line ()
228
+ return matchstr (getline (' .' ), ' \vPlugin\s'' .{-}'' ' )
229
+ endf
230
+
202
231
" ---------------------------------------------------------------------------
203
232
" Load the plugin database from vim-scripts.org .
204
233
"
@@ -211,7 +240,7 @@ func! s:fetch_scripts(to)
211
240
call mkdir (scripts_dir, " p" )
212
241
endif
213
242
214
- let l: vim_scripts_json = ' http://vim-scripts.org/api/scripts .json'
243
+ let l: vim_scripts_json = ' http://vim-scripts.org/api/scripts_recent .json'
215
244
if executable (" curl" )
216
245
let cmd = ' curl --fail -s -o ' .vundle#installer#shellesc (a: to ).' ' .l: vim_scripts_json
217
246
elseif executable (" wget" )
0 commit comments