VundleVim / Vundle.vim

Vundle, the plug-in manager for Vim
http://github.com/VundleVim/Vundle.Vim
MIT License
23.89k stars 2.57k forks source link

Show description in search #47

Open dag opened 13 years ago

dag commented 13 years ago

For :Bundles and :BundleSearch, show the short description for listed bundles. That is, the second column in the table on vim-scripts.org. I often find I need to go to that site just to see what a bundle really does.

As I see it there are three possible formats for this.

Comment First

This is most similar to common formatting of source code. A down side is the need for extra whitespace.

" Vim Ex-command wrapper for Ruby Bundler
Bundle 'bundler'

" ku source: bundle
Bundle 'ku-bundle'

" Load a series of files easily
Bundle 'bundle'

Comment After

Feels more like a description as one might design it on a website; puts focus on the Bundle line. Also whitespace-heavy.

Bundle 'bundler'
" Vim Ex-command wrapper for Ruby Bundler

Bundle 'ku-bundle'
" ku source: bundle

Bundle 'bundle'
" Load a series of files easily

Comments Lined Up

This makes yanking include the description, for better or worse. Easier to scan. Doesn't require more whitespace than without descriptions. Unlikely to work well with long bundle names.

Bundle 'bundler'    " Vim Ex-command wrapper for Ruby Bundler
Bundle 'ku-bundle'  " ku source: bundle
Bundle 'bundle'     " Load a series of files easily
0 commented 13 years ago

The last ("Comments Lined Up") variant doesn't work in .vimrc files, because Vim treats the comment as a string argument to Bundle. It would be misleading to display the results that way, since they can't be used directly like one might assume.

gmarik commented 13 years ago

yup, @0, that's correct. Do you know if inline comment can be stripped out so it won't break Bundle command? That'd be pretty cool

0 commented 13 years ago

I couldn't find anything when the issue originally came up, but I think I've fixed it now.

gmarik commented 13 years ago

@0, that's awesome!

gmarik commented 13 years ago

Ok, looks like after @0's fix we can go with Comments Lined Up style, Nice!

weynhamz commented 11 years ago

Related to #13.

MarcWeber commented 10 years ago

related to #173 ?

berryp commented 10 years ago

403 will allow for comments on the same line.

starcraftman commented 10 years ago

This is actually something we could do very easy, at least Vundle doesn't need major change. Since we allow comments on the line, we can extract the short summary (usually rest of Title tag) and pack it in with the json file the scrapper outputs. We just need to make a slight modification, use single quotes on strings and add comment after ".

Old json :

["test.vim","pytest.vim",...]

New JSON:

['test.vim " A short description', 'pytest.vim " Another desc',...]

Patch for Vundle to accept format:

diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim
index 5c43547..6d99231 100644
--- a/autoload/vundle/scripts.vim
+++ b/autoload/vundle/scripts.vim
@@ -111,10 +111,10 @@ func! vundle#scripts#view(title, headers, results)
   com! -buffer -bang -nargs=1 DeletePlugin
     \ call vundle#installer#run('vundle#installer#delete', split(<q-args>,',')[0], ['!' == '<bang>', <args>])

-  com! -buffer -bang -nargs=? InstallAndRequirePlugin
+  com! -buffer -bar -bang -nargs=? InstallAndRequirePlugin
     \ call vundle#installer#run('vundle#installer#install_and_require', split(<q-args>,',')[0], ['!' == '<bang>', <q-args>])

-  com! -buffer -bang -nargs=? InstallPlugin
+  com! -buffer -bar -bang -nargs=? InstallPlugin
     \ call vundle#installer#run('vundle#installer#install', split(<q-args>,',')[0], ['!' == '<bang>', <q-args>])

   com! -buffer -bang -nargs=0 InstallHelptags

@gmarik Any thoughts on this? I'm still not familiar with the scraper, I'll go have a look.

starcraftman commented 10 years ago

Adding @jdevera.

While we are on the subject, we may want to just skip modifying the scraper and add support for parsing using this file > http://www.vim.org/script-info.php. Comes complete with summary of each plugin, releases and ids of files to download/extract. Files way too huge though we'd have to trim it down substantially. That would be part of a much larger refactor, could mean we could stop using the scraper which both costs money and takes time, more importantly has lots of overhead. We could easily refresh this file quickly and trim lines we don't need from the json.

To make it readable with vim do:

wget http://www.vim.org/script-info.php | cat script-info.php | python -mjson.tool > scripts.json

Edit: Thought about it some and probably easiest to do the first. Though, we could use this php file and cross reference it with the script json generator to add in the summary.

jdevera commented 10 years ago

About the new JSON above, I'd rather those two things were in different strings, so we don't have to do more processing in vim.

[["name", "description"],["name2","description2"]]

Still ugly JSON, but with the work already done.

jdevera commented 10 years ago

That script-info.php is a gem! If the scrapper is not based on this, it probably should!

BTW, anyone knows anything about the status of the scrapper? @gmarik?

MarcWeber commented 10 years ago

If you start using "script-info" you can join vim-pi, too (just my two cents) - we'd appreciate that. Yes - we are also willing to accept changes to vim-pi if that's necessary.

jdevera commented 10 years ago

Why is vim-pi in bitbucket? while everything else is happening on github? I wonder.

MarcWeber commented 10 years ago

https://bitbucket.org/vimcommunity/vim-pi/issue/94/document-officially-why-bitbucket-and-not talks about some ideas. Now neovim might change a lot anyway soon which is why I would like to delay most plugin related work for 3-6 month.

gmarik commented 10 years ago

@jdevera scraper is running daily but it not updating API data which Vundle is using. Basically API data is outdated. script-info.php is not extremely useful for simple reason: git repos on github likely to have different names because names aren't id-based.

MarcWeber commented 10 years ago

vim-pi does the following: It parses the install instructions for git urls. That's why VAM knows about many (not all) github repositories. The true fix is to update vim.sf.net - but then it would be helpful to integrate with github etc - which cannot be done easily because you cannot use github API from sourceforge's PHP hosting. You could workaround it by creating third party services calling into vim.sf.net .. You may do whatever you think is best.

starcraftman commented 10 years ago

@gmarik Is there a reason the scraper doesn't update the API data that Vundle downloads?

BatmanAoD commented 10 years ago

Just wanted to mention that I hope to see this feature soon. Is there currently any way to even distinguish between two identically-named vim.org scripts after doing a "search"? (For instance, ":BundleSearch Rename" gives a list that includes both http://www.vim.org/scripts/script.php?script_id=3525 and http://www.vim.org/scripts/script.php?script_id=1928 with nothing to distinguish them, and they have completely different behavior.)

Edit: It appears that installing Bundle 'Rename' installs 1928, not 3525. Can it be assumed that Vundle will always pick the script with the lower ID? Is there a way to force it to pick the script with the larger ID?

starcraftman commented 10 years ago

@BatmanAoD I believe that is an issue more related to the scraper that indexes vim.org. Vundle just parses a json file to get that list, you can see it in your bundle dir under .vundle. I don't really know the internals of the scraper so more an issue for gmarik.

BatmanAoD commented 10 years ago

Hm. Looks like this is just #183, which is due to vim-scraper/vim-scraper#65, which hasn't had an update in a year. Looks like the scraper has the ability to resolve name collisions, but gmarik says that it's failing to recognize them due to local repos being out-of-date.