Thursday, September 22, 2011

Re: Conditional bundle loading?

On Sep 22, 2011, at 2:12 PM, Taylor Hedberg wrote:

> Off-topic: Why is this posted in reply to "Gvim crashing in xmonad"?

Not sure.

>
>
> Matt Martini, Thu 2011-09-22 @ 13:47:30-0400:
>> I would like to know if there is a way to conditionally load a bundle,
>> or if there is an way to load a bundle manually.
>
> What do you mean by "bundle"? Are you referring to Vim plugins in
> general, or do you mean Pathogen bundles, which are a specific technique
> for managing plugins, not part of Vim itself? It looks like you're just
> referring to plugins, but it could make a difference.
>

Actually, I am using pathogen.

>
>> I was getting really long load times (on the order of 30 seconds) for
>> vim (7.3.230 OS X), through some effort I tracked this down to the
>> syntastic bundle. I like this bundle and it is really useful
>> sometimes, but most of the time it is not needed for the files I am
>> editing.
>>
>> Is there a way to create a map to load this module, or have it load
>> conditionally?
>
> Most plugins check a particular global variable and exit without loading
> if it is defined. Looking at the code for Syntastic in particular, you
> can see that it checks for `g:loaded_syntastic_plugin` to be defined. If
> you define that variable before it loads, say, in your .vimrc, then
> Syntastic will stop loading automatically.

This worked to stop the loading of Syntastic and sped up vim startup 100 fold.

>
> Since the script is just plugin/syntastic.vim in your .vim directory,
> you can then use `:source ~/.vim/plugin/syntastic.vim` to load it on the
> fly. Make sure to `:unlet g:loaded_syntastic_plugin` first though, or it
> will have no effect.

What would I do to get this to work since I am using Pathogen?

I guess I could pull syntastic out of pathogen, but this would make it more difficult to keep multiple machines in sync.

>
> And yes, you could define a command or mapping to make that process more
> automatic if you find it cumbersome to type that out each time.
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment