k-takata / minpac

A minimal package manager for Vim 8+ (and Neovim)
839 stars 30 forks source link

Headless install of plugins with Neovim #66

Closed aphecetche closed 5 years ago

aphecetche commented 6 years ago

Hi,

Trying to install plugins in neovim (for a fresh install) using nvim —headless +PackUpdate +q I guess I hit the issue that nvim is exiting before the PackUpdate function is completed.

Is there a way to wait for PackUpdate completion before quitting ?

~ > nvim --headless +PackUpdate +q             
Installed: vim-vinegar
Installed: vim-yaml
Installed: vim-surround
Installed: vim-flatbuffers
Installed: ack.vim
Installed: vim-tmux-navigator
Error while updating "vim-unimpaired".  Error code: 0
Error while updating "tcomment_vim".  Error code: 0
Error while updating "tabular".  Error code: 0
Error while updating "vim-cmake-syntax".  Error code: 0
Error while updating "vim-markdown".  Error code: 0
Error while updating "fzf".  Error code: 0
remote/host: generated rplugin manifest: /home/laurent/.local/share/nvim/rplugin.vim
Error plugins: 6%      

My init.vim :

function! PackInit() abort
        packadd minpac

        call minpac#init()
        call minpac#add('k-takata/minpac', {'type': 'opt'})

        " Additional plugins here.
        call minpac#add('tpope/vim-unimpaired')

        " 'netrw done right' (netrw is the builtin vim directory browser)
        call minpac#add( 'tpope/vim-vinegar')

        " tmux navigator
        call minpac#add( 'christoomey/vim-tmux-navigator')

        " syntax for flatbuffers
        call minpac#add( 'zchee/vim-flatbuffers', {'type':'opt'})

        " syntax for YAML files
        call minpac#add( 'stephpy/vim-yaml',  {'type':'opt'})

        " comment out things
        call minpac#add( 'tomtom/tcomment_vim')

        " for grepping fast
        call minpac#add( 'mileszs/ack.vim')

        " for cmake syntax"
        call minpac#add( 'pboettch/vim-cmake-syntax', {'type':'opt'})

        " surround
        call minpac#add( 'tpope/vim-surround')

        " fuzzy finder
        call minpac#add( 'junegunn/

        " markdown
        call minpac#add( 'godlygeek/tabular',{'type':'opt'})
        call minpac#add( 'plasticboy/vim-markdown',{'type':'opt'})

endfunction

" Define user commands for updating/cleaning the plugins.
" Each of them calls PackInit() to load minpac and register
" the information of plugins, then performs the task.
command! PackUpdate call PackInit() | call minpac#update('', {'do': 'call minpac#status()'})
command! PackClean  call PackInit() | call minpac#clean()
command! PackStatus call PackInit() | call minpac#status()
gpanders commented 5 years ago

Add a new command:

command! PackUpdateAndQuit call PackInit() | call minpack#update('', {'do': 'quit'})

Then

nvim --headless +PackUpdateAndQuit
aphecetche commented 5 years ago

Thanks.

For the record I'm running this installation from an Ansible recipe. I actually had to do add "+q" after the nvim call otherwise Ansible would hang somehow.

nvim --headless +PackUpdateAndQuit +q