k-takata/minpac

Echo status to stdout

netmute opened this issue · 3 comments

I update my vim plugins from a shell script (vim +PackUpdate).
Is there a way I can print the results of the update to stdout?

I have also similar ex-command to update.
I think you can use :redir and :print in -s-ex mode.
Add function and command like this in your vimrc,

function! s:PrintPackUpdateFunc()
        redir @a
        PackUpdate
        redir END
        new
        put a
        %print
        qa!
endfunction
command! PPU call <SID>PrintPackUpdateFunc()

and call it.
vim -ENs -u $HOME/.vimrc "+set nonumber nolist" +PPU
I set number and list in my vimrc and I add nonumber and nolist to disable it.


FYI, minpac has a synchronization bug.
If you automate like above, vim quits before all update jobs done. When you run 8 jobs to update, vim quits just after it starts last 8 jobs, and 8 plugins are not downloaded.
I'll make PR from hayatogh@de2dfbd

I tried redir. This is what I got so far:

function! PackUpdate() abort
  redir >> /dev/stdout
  call PackInit()
  call minpac#update('', {'do': 'q'})
  redir END
endfunction

I doesn't print anything tho.

I found something that works:

function! PackUpdate() abort
  call PackInit()
  call minpac#update('', {'do': 'redir! > $HOME/.vim.update | call minpac#status() | print | redir END | qa'})
endfunction

You can call it like this:
vim "+call PackUpdate()" && cat .vim.update | xargs