kristijanhusak / vim-packager

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

Cannot install a plugin as an optional #24

Closed vaklinzi closed 4 years ago

vaklinzi commented 4 years ago

Thank you for the great package manager. It's fast and simple and I just love it. I just have one problem when trying to install some plugins as an optional type. One such example is https://github.com/iamcco/markdown-preview.nvim which I added like this:

call packager#add('iamcco/markdown-preview.nvim', {'do': 'sh -c "cd app & yarn install"', 'type': 'opt'})

and then:

augroup packager_filetype
  autocmd!
  autocmd FileType markdown packadd markdown-preview
augroup END

but when I open a markdown file, all the commands for this plugin are missing. I had the same problem with few other plugins with optional type (but not will all) so maybe I am missing something.

kristijanhusak commented 4 years ago

try packadd markdown-preview.nvim

Shatur commented 4 years ago

I use the following:

call packager#add('iamcco/markdown-preview.nvim', {'type': 'opt', 'do': 'packadd markdown-preview.nvim | call mkdp#util#install()'})
kristijanhusak commented 4 years ago

No need to do packadd in the do. This should work fine:

call packager#add('iamcco/markdown-preview.nvim', {'type': 'opt', 'do': ':call mkdp#util#install()'})

Note the : at the beginning of the do value. This tells packager it's a vim command. you don't need to do packadd because packager adds it to runtime after install/update.

Shatur commented 4 years ago

Did not know, thank you!

kristijanhusak commented 4 years ago

Everything ok? Can we close this?

Shatur commented 4 years ago

I have the same plugin as the author of the issue and your approach is works for me.

vaklinzi commented 4 years ago

No, it's still doesn't work. If I set packadd markdown-preview.nvim it will be added for every filetype (and it works) but I don't need that. Why will I use opt if I cannot specify for which type it should be active? For most of the plugins filetype specification works but this is one example where it doesn't work.

I need something like: autocmd FileType markdown packadd vim-markdown | packadd markdown-preview

Shatur commented 4 years ago

@vaklinzi, to enable it for specific type I to calling :packadd ... in ftplugin.

kristijanhusak commented 4 years ago

@vaklinzi i meant to do that in the autocmd like you did, just append .nvim

vaklinzi commented 4 years ago

@kristijanhusak I didn't notice the .nvim. Sorry for that. Works properly now.