Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify minpac#add defaults in minpac#init #113

Closed
averms opened this issue Sep 15, 2020 · 1 comment
Closed

Specify minpac#add defaults in minpac#init #113

averms opened this issue Sep 15, 2020 · 1 comment

Comments

@averms
Copy link
Contributor

averms commented Sep 15, 2020

I install all my plugins in opt so this would make it my init.vim cleaner 😄.

I'm willing to submit a patch and I don't think it would be too complex: add a
config key in minpac#init called 'defaults' and just extend it with the
config specified in each minpac#add call.

It would turn this:

fun! MinpacInit() abort
    packadd minpac
    call minpac#init({'dir': $HOME . '/.local/share/nvim/site'})
    call minpac#add('k-takata/minpac',               {'type': 'opt'})
    call minpac#add('Shougo/neosnippet.vim',         {'type': 'opt'})
    call minpac#add('a-vrma/black-nvim',             {'type': 'opt'})
    ...
endfun

into this:

fun! MinpacInit() abort
    packadd minpac
    call minpac#init({'dir': $HOME . '/.local/share/nvim/site',
        \ 'defaults': {'type': 'opt'}})
    call minpac#add('k-takata/minpac')
    call minpac#add('Shougo/neosnippet.vim')
    call minpac#add('a-vrma/black-nvim')
    ...
endfun
@averms
Copy link
Contributor Author

averms commented Sep 28, 2020

Just realized this is related to #68, in any case my solution was the following:

fun! s:pac_add(url, ...) abort
    " Wraps minpac#add with type: 'opt' as default.
    let l:options = get(a:000, 0, {})
    call minpac#add(a:url, extend({'type': 'opt'}, options, 'force'))
endfun

@averms averms closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant