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

Question about dein#tap() #18

Closed
pablox-cl opened this issue Feb 27, 2016 · 9 comments
Closed

Question about dein#tap() #18

pablox-cl opened this issue Feb 27, 2016 · 9 comments
Labels

Comments

@pablox-cl
Copy link

I've seen some vimrc's and a lot of them that use neobundle, or yours even that uses dein... "wrapping" plugins configuration like:

if dein#tap('unite.vim') "{{{
  " The prefix key.
  nnoremap    [unite]   <Nop>
  xnoremap    [unite]   <Nop>
  nmap    ;u [unite]
  xmap    ;u [unite]

  nnoremap <silent> ;b
        \ :<C-u>Unite -buffer-name=build`tabpagenr()` -no-quit build<CR>
endif

It's strange, because if the plugin is added to dein, why I would want to check again if it exists? Or is it that dein loads the value between that if … endif only when the plugin is actually being loaded?

@wsdjeg
Copy link
Contributor

wsdjeg commented Feb 28, 2016

because maybe you do not download,and rtp do not change before dein#end()

@Shougo
Copy link
Owner

Shougo commented Feb 28, 2016

Yes.

@Shougo Shougo closed this as completed Feb 28, 2016
@wsdjeg
Copy link
Contributor

wsdjeg commented Feb 28, 2016

I need write something about why hooks.
in vundle or vim-plugin you can not put you config and plugin together,and if you disable you plugin or do not install you plugin ,you config still be loaded.
example

set nocompatible
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Shougo/unite.vim'
" you can not put you confg here ,and you can not call 
"unite's func here because rtp is changed after
" end(),but with the help of hooks ,we can put config 
"and plugin together,it looks better,and if we do 
"not want to use some plugin,just need to disable plugin , 
"and the config will not be loaded,that is 
"why I using dein or neobundle
call vundle#end()
filetype plugin indent on

for dein

call dein#add('Shougo/deoplete.nvim')
if dein#tap('deoplete.nvim') && has('nvim')
      let g:deoplete#enable_at_startup = 1
      execute 'autocmd MyAutoCmd User' 'dein#source#'.g:dein#name
            \ 'source ~/.vim/rc/plugins/deoplete.rc.vim'
endif

@pablox-cl
Copy link
Author

But most times, plugins are saved in another file, like in a toml one. So, you are still going to put the configuration after dein#end(). (bling/dotvim or shougo's dotfiles for example).

afaik, the tap thing make sense when using lazy plugins right? I mean, those configurations (inside tap blocks) are being loaded only when the plugin is actually loaded. For the rest, I don't understand what could be the benefit.

@Shougo
Copy link
Owner

Shougo commented Feb 29, 2016

afaik, the tap thing make sense when using lazy plugins right? I mean, those configurations (inside tap blocks) are being loaded only when the plugin is actually loaded. For the rest, I don't understand what could be the benefit.

It works if the plugin is lazy loaded.

@pablox-cl
Copy link
Author

Thanks, I understand now. So using tap won't give any advantage when using plugins are not being lazily loaded?

@Shougo
Copy link
Owner

Shougo commented Mar 3, 2016

Thanks, I understand now. So using tap won't give any advantage when using plugins are not being lazily loaded?

Yes, it has the advantage.
It works like installed.

@pablox-cl
Copy link
Author

So it's always useful even when plugins that aren't being lazy loaded?

@Shougo
Copy link
Owner

Shougo commented Mar 10, 2016

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants