MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

Activating addons not in default folder #94

Closed skeept closed 11 years ago

skeept commented 11 years ago

Hi,

After the recent posts in vim mailing list I decided to give this a try instead of pathogen.

The functionally that I am most interested in this pluging is the ability of loading some plugins after I start vim, because for a lot of plugins I just used them rarely.

My setup is the following: I have a bundle folder where I install the plugins I use the most, and some that I use only ocasiaonally.

I have another folder not_used_plugins where I put plugins that I don't use at all. But once in a while I would like to also activate one of the plugins there. Is there a way of activating these? Even if I enter that folder and type :ActivateAddons ./yankring

the plugin is not activated...

Of course I could just move this the the bundle folder but I would like to keep it to a minimal number of plugins there.

ZyX-I commented 11 years ago

You can write your own plugin_dir_by_name implementation, something like this:

runtime autoload/vam.vim
let s:old_pdn=remove(g:vim_addon_manager, 'plugin_dir_by_name')
let s:nup_dir=expand('~/.vim/not_used_plugins')
function g:vim_addon_manager.plugin_dir_by_name(name)
    if isdirectory(s:nup_dir.'/'.a:name)
        return s:nup_dir.'/'.a:name
    else
        return s:.old_pdn(a:name)
    endif
endfunction
ZyX-I commented 11 years ago

It should be

return call(s:old_pdn, [a:name], {})

in place of

return s:.old_pdn(a:name)
MarcWeber commented 11 years ago

You missunderstood VAM by reusing the knowledge about pathogen. Pathogens infect activates all plugins found in a directory whereas VAM only activates a white list on startup. So its fine to have many "dead" or seldomly used plugins in ~/.vim/vim-addons. VAM will only activate the ones you select and ignore everything else. That's why bisecting etc can be implemented that easily. That's also by design cause disk is that cheap nowadays - but cleaning up is so much work :)

ZyX-I commented 11 years ago

I have seen at least two other people (in freenode’s #vim) requiring multiple plugin root directories: now to have users’ and system configuration both managed by pathogen and not having one managed by pathogen and other by system package manager (one, jtmitch) and having separate own, third-party, colors and unused lists (second, bairui). You maybe seen that discussion, it was on 26 Oct 2012. I have a log if you are interested. Maybe this feature should be added to VAM also, it is easy to do this by changing plugin_dir_by_name.

ZyX-I commented 11 years ago

See new additional_addon_dirs option. VAM won’t checkout to folder from this list though.

skeept commented 11 years ago

I tried the new option. My setting for VAM is now:

fun SetupVAM() let g:vim_addon_manager = {} let vam_install_path = g:p0 . '/bundle' exec 'set rtp+='.vam_install_path.'/vam' " let g:vim_addon_manager = { your config here see "commented version" example and help

let s:active_addons = ['ctrlp', 'indent-guides', 'neocomplcache', 'smartusline', 'tasklist'] let s:active_addons += ['unite-mark', 'd.0', 'LanguageTool', 'textobj-word-column'] let s:active_addons += ['unite-outline', 'buffergator', 'delimitMate', 'LaTeX-Box'] let s:active_addons += ['SpellCheck', 'ultisnips_rep', 'unite-tag', 'clang_complete'] let s:active_addons += ['fugitive', 'supertab', 'undotree', 'CountJump', 'gitv'] let s:active_addons += ['manpageview', 'tabular', 'unite', 'vimproc', 'csv', 'tagbar'] let s:active_addons += ['unite-colorscheme', 'vlatex'] if has("python") let s:active_addons += ['ultisnips_rep'] endif

let g:vim_addon_manager.additional_addon_dirs = [g:p0 . '/notused_plugins']

call vam#ActivateAddons(s:active_addons, {'auto_install' : 0}) endfun call SetupVAM()

In the above g:p0 is just ~/.vim if in linux or ~/vimfiles if in windows. In my understanding if have say yankring in notused_plugins folder then :ActivateAddons yankring should load it, but I get the error:

No repository location info known for plugin yankring. yankring might be a typo, did you mean: YankRing ? Error detected while processing function vam#ActivateAddons: line 101: E605: Exception not caught: These plugins could not be activated for some reason: ['yankring'] Press ENTER or type command to continue

Am I understanding the option incorrectly? Thank you

MarcWeber commented 11 years ago

Read the error message, and the message above it. Do RTFM about how to find the plugin names. The answer will hit you in a flash :)

skeept commented 11 years ago

I am sorry but I am still confused. The manual says:

additional_addon_dirs VAM-additional-addon-dirs List of directories. If present, plugins will be looked up in those directories additionally to VAM-plugin_root_dir. Note: Utilized by VAM-plugin_dir_by_name. If you override that function option may have no effect.

so I have let g:vim_addon_manager.additional_addon_dirs = [g:p0 . '/notused_plugins'] which when running :echo g:vim_addon_manager.additional_addon_dirs it gives ['~/.vim/notused_plugins'] this folder exists and I have a folder called yankring there.

If I move the folder yankring to bundle then loading this plugin works correctly but it seems that having it in g:vim_addon_manager.additional_addon_dirs does not work. I didn't change VAM-plugin_dir_by_name.

I might be confused what g:vim_addon_manager.additional_addon_dirs really means. I thought it would work like VAM-plugin_root_dir.

MarcWeber commented 11 years ago

RTFM. use dirs= [expand(g:p0....)] because VAM won't do for speed reasons because that function is called quite a lot of times. VAM won't understand ~ without expand.

ZyX-I commented 11 years ago

Wondering how did it came that calling expand once is expensive, just like we do for plugin_root_dir?

skeept commented 11 years ago

thank you for the clarification. I am sorry that I had missed that part in the documentation.