Shougo / dpp.vim

Dark powered plugin manager for Vim/NeoVim
MIT License
134 stars 5 forks source link

Updating package automatically #23

Closed KazMorita closed 6 months ago

KazMorita commented 6 months ago

I need help with implementation of automatic package update. Many people will use this, so I decided to raise an issue.

In dein I wrote:

" install uninstalled
if dein#check_install()
  call dein#install()
endif

" remove unecessary
call map(dein#check_clean(), "delete(v:val, 'rf')")

I want to implement a simliar behaviour in dpp.vim. The steps I thought are:

  1. wait for Dpp:makeStatePost
  2. update dpp cache files with dpp#check_files()
  3. install uninstalled with dpp#async_ext_action('installer', 'install')
  4. uninstall unnecessary

The code for 1-3 is:

function Installifnot()
  if dpp#ext_action('installer', 'getNotInstalled')
    call dpp#async_ext_action('installer', 'install')
  endif
endfunction

autocmd User Dpp:makeStatePost
  \  : call dpp#check_files()
  \ | call Installifnot()

dpp#ext_action('installer', 'getNotInstalled') returns 0 even when the package is missing. So the above code does not work. I also do not know a smart way to do step 4.

Thank you for your help.

Shougo commented 6 months ago

Please use dpp#sync_ext_action('installer', 'getNotInstalled') instead. And it returns not installed plugins name. You must check the returned result.

Shougo commented 6 months ago

uninstall unnecessary

It is not implemented. Because it is dangerous.

Shougo commented 6 months ago

I have added dpp#check_clean().