kristijanhusak / vim-packager

Vim plugin manager that utilizes "jobs" and "pack" features.
MIT License
245 stars 9 forks source link

The ability to get plugin list #23

Closed Shatur closed 4 years ago

Shatur commented 4 years ago

Minpack have minpac#getpluglist and minpac#getpluginfo. In very convenient for scripting. Could you add a the same API?

kristijanhusak commented 4 years ago

Sure, why not.

kristijanhusak commented 4 years ago

@Shatur95 I introduced packager#plugins() and packager#plugin(plugin_name) functions. Just make sure to call PackagerInit function before trying them, to populate the plugins list and add packager to runtime. I didn't document it yet, will wait for your feedback.

Shatur commented 4 years ago

Thanks! Could you add also something like packager#plugin_names()? I think this can me more common case.

kristijanhusak commented 4 years ago

You have the name for each plugin here. Just map it out for yourself however you need it.

Shatur commented 4 years ago

Of course, but getting all information is a bit slow. It would be nice to have the ability to get only names and then get information about specific plugin.

kristijanhusak commented 4 years ago

Yeah, it's a bit slower because it needs to do some git calls to fetch all the data. I added packager#plugin_names() that returns only list of names.

Shatur commented 4 years ago

Thank you, now much faster!

I wrote the following helper for myself, maybe someone will find it useful:

function! OpenPackageFolder(plugin_name)
  if has('win32')
    let program = 'start '
  else
    let program = 'xdg-open '
  endif
  call system(program . packager#plugin(a:plugin_name).dir)
endfunction

function! FzfPackages()
  call PackagerInit()
  call fzf#run(fzf#wrap({'source': packager#plugin_names(), 'sink': function('OpenPackageFolder')}))
endfunction