Closed netmute closed 5 years ago
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 https://github.com/matsuhav/minpac/commit/de2dfbdb7440b562c2122c238890b76312a9b210
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
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?