MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

can you add a function for return plugin‘s info? #41

Closed bailiangcn closed 13 years ago

bailiangcn commented 13 years ago

I like vim-addon-manager plugin very much,and I have use it for a long time.but I wish the vim-addon-manager can add a new command that return some infomation of plugin. for example: i wish install showmarks plugin and i input command :ActivateAddons showmarks now, two plugin showmarks and ShowMarks appears, I am very confuse about showmarks and ShowMrks,which one should I install? I must open the vim-addon-manager-known-repositories.vim file ,and search "let s:plugin_sources['showmarks']" and "let s:plugin_sources['ShowMarks']"; after read the repositories file, I know the showmarks's plugin is the No.2142 in vim.org and the ShowMarks's plugin is the No.152 in vim.org,so I can browse the vim.org and research the diffence between No.2142 and No.152 plugin. at last ,I found the ShowMarks is my goal. If the vim-addon-manager plugin have a new command or a new function that can return some info about plugin,I am very grateful for it.

MarcWeber commented 13 years ago

Well - you can just use "InstallAddon" and get both, browse the source and delete the wrong plugin again.

I agree that this can be done better.

The thing is: the whole plugin management sucks because you have to write three descriptions of the plugin:

a) a readme (for github) b) a doc/*.txt (for vim) c) a description and install guide for www.vim.org

However from development point of view one description should be enough.

This means I'm aware of the limitations. But doing complete cleanups would also require changing the website.

Thanks for your feedback!

bailiangcn commented 13 years ago

in fact,don’t need a full power command,just a mini function,for example,I can input command like this: :addon_info showmark*
and then addon_info will return some lines include showmarks ShowMarks showmark1 ... in repositories.vim,I just want a sample filter function.

Silex commented 13 years ago

I think something that would simply return the content of g:vim_addon_manager['plugin_sources']['showmarks'] would be enough in this case... maybe with some cute formatting.

gadamiak commented 13 years ago

Silex got it right. All info is already there. It just needs to be extracted.

I would expect results to go into new buffer formatted similarly to this (just a suggestion):

* Plugin name

  - Source:   vim.org, github...
  - Link:     UTL compatible `<url:...>` or at least `<...>`
  - Modified: last modification date

Such a function would help a lot in discovery.

MarcWeber commented 13 years ago

Excerpts from gadamiak's message of Fri Jun 10 08:45:26 +0200 2011:

Silex got it right. All info is already there. It just needs to be extracted.

I should have an idea about what I wrote. Look at this info:

let s:plugin_sources['redocommand'] = {'title': 'redocommand', 'version': '1.20', 'url': 'http://www.vim.org/scripts/download_script.php?src_id=10342', 'vim_version': '7.0', 'date': '2009-04-03', 'vim_script_nr': 1661, 'type': 'archive', 'script-type': 'utility', 'archive_name': 'redocommand.vba.gz', 'author': 'Ingo Karkat'}

In which way does this tell you what the script does?

Of course you can format that info nicer. But unless we add a short description this is not that much more useful..

With some luck you know whether you're looking at colorscheme or a syntax file - but that's it.

For now you should really use www.vim.org/search.php.

gadamiak commented 13 years ago

I should have an idea about what I wrote. Look at this info: ... In which way does this tell you what the script does?

It doesn't but I don't expect it to. What I want is an easier way to get to script status info and get to its page. Status info comes from date and scripts page can be reached with vim_script_nr. ATM to tell scripts apart I have to extract this info manually and append to 'base url', which gives http://www.vim.org/scripts/script.php?script_id=1661. This is tedious.

For now you should really use www.vim.org/search.php.

True, but doesn't apply to all scripts. What about GitHub's?

MarcWeber commented 13 years ago

What is important and why? a) url

www.vim.org scipt -> url of www.vim.org's script page

b) github -> link to github page so that you can read the README.

date is important because maintained scripts should have some updates within a year?

Pressing on an url could be using w3c or elinks or such and show the HTML in Vim via text dump?

Looks like I should assist you implementing it :)

gadamiak commented 13 years ago

What is important and why? a) url

www.vim.org scipt -> url of www.vim.org's script page

b) github -> link to github page so that you can read the README.

Correct.

date is important because maintained scripts should have some updates within a year?

No. To tell, which is newer. It helps in case of scripts overtaken by someone else than original author. In this case ID helps too.

Pressing on an url could be using w3c or elinks or such and show the HTML in Vim via text dump?

Simple URL to click/use UTL/whatever is enough.

bailiangcn commented 13 years ago

that's all what I want,thanks

MarcWeber commented 13 years ago

Excerpts from bailiangcn's message of Thu Jun 09 17:38:39 +0200 2011:

and then addon_info will return some lines include showmarks ShowMarks showmark1 ... in repositories.vim,I just want a sample filter function.

:-) filter function? map :g/pattern/d

or use ttoc plugin or the like.

If you need an example about how such am apping would look like have a look at https://github.com/MarcWeber/vim-addon-other/blob/master/plugin/vim-addon-other.vim

\kl and \dl (keep lines and drop lines) is implemented there for normal buffers and quickfix.

Press undo (u) to revert changes.

Its hacky but works incredibly well

bailiangcn commented 13 years ago

I have wrote a mini func,That‘s what i want

 1 function! Find_addon_info(addname)
 2     " search plugin's info from vim-addon-manager
 3     let s:addon_list=items(filter(copy(g:vim_addon_manager['plugin_sources']),'v:key =~ a:addname'))
 4     for [addon_key,addon_info] in s:addon_list
 5         echo 'Plugin'’s Name : '.addon_key
 6         echo addon_info
 7     endfor
 8 endfunction
 9
10 function! LastWord()
11    let cmdline = split(getcmdline())
12    let @b = cmdline[-1]
13    return 'call Find_addon_info("' . @b .'")'
14 endfunction 
15 cnoremap <F2> <C->e LastWord()<CR><cr>

will return info like Plugin's Name : ShowMarks {'version': '2.2', 'url': 'http://www.vim.org/scripts/download_script.php?src_id=3342', 'archive_name': 'showmarks.vim', 'vim_version': '6.0', 'date': '2004-08-16', 'vim_script_nr': 152, 'author': 'Anthony Kruize', 'type': 'archive', 'script-type': 'utility', 'title': 'ShowMarks'} Plugin's Name : showmarks {'version': 'v0.1', 'url': 'http://www.vim.org/scripts/download_script.php?src_id=8240', 'archive_name': 'showmarks.zip', 'vim_version': '7.0', 'date': '2008-02-06', 'vim_script_nr': 2142, 'author': 'Andreas Politz', 'type': 'archive', 'script-type': 'utility', 'title': 'showmarks'}

MarcWeber commented 13 years ago

Eventually this should be added to the main distribution. I'd use case insensitive comparison ( =~? instead of =~ ).

Which would be the best interface? Options: a) command line mapping as shown here (which lhs?) b) extra command. Eg :AddonInfo .. c) Use existing commands and users should add a ? at the end or such?

For now I'll add a pointer to this issue in docs

gadamiak commented 13 years ago

I vote for b) and c).

Silex commented 13 years ago

We'd do b) imho

evidens commented 13 years ago

Has there been any forward movement? I would also like a simple command like :AddonInfo since sometimes when you have a few packages sharing names, having a date and/or the source URL can help distinguish the one you want.

Silex commented 13 years ago

I added a simple one in 80c5efcde70c204f9bb17dae

Feel free to make it better :)

evidens commented 12 years ago

That's very useful, thanks!