Closed skeept closed 11 years ago
There is currently no built-in way to do so. But with regards to powerline, problem is different: powerline setup is done on VimEnter
event. No VimEnter
— no fancy statusline. Try doing
doautocmd PowerlineStartup VimEnter
after you did ActivateAddons powerline
.
Time to add a new feature? add {'runtime-activate': 'doautocmd PowerlineStartup VimEnter'} to addon-info.json or such? In this case it would be what you suggested? Great that people start using this feature so that we hit those (known) issues.
Using :redir
and :silent au VimEnter
it is possible to cope completely automatically without a hook (record a state before activating, state after and then run whatever groups* were added). I don’t know whether anything else but VimEnter
event may cause misbehavior of activated plugins. (Except for has('vim_starting')
check, but it is rare and we can do nothing for this.)
* Don’t run existing groups even if they were extended because doau
is not very selective and execute
is not an option. Neither run events without group just for the same reason. Always assume running VimEnter
command for the second time is destructive.
:execute
is not an option because
:au
renders unprintable characters and thus modifies the command; maybe it also does more modifications.:execute
can’t run anything in the scope of the plugin that is not a caller.I don't want to rerun stuff :(
The real fix is contact the author, ask him to provide a Startup() function which can be called from outside and just call that the way I proposed. This is a case illustrating why I usually say: VAM can load most plugins lazily, but not all.
Check out new branch. It should do the work I described in the previous message. I don’t think anybody uses non-augroup events in conjunction with augroup ones thus it should work properly.
Currently it is completely untested though (neither automatic nor manual testing was done).
After a small fix new branch is now known to work for the requested case (activation of powerline at runtime).
No need to hide it. genious :). Thanks. Merged. Closing this issue now
Thank you, I can now activate powerline after I start vim!
Still regarding activating plugins on demand after I start vim, I have powerline in my bundle folder. I don't activate it when vim starts but I occasionally I would like to activate manually. But when I type :ActivateAddon powerline
the status line doesn't change at all. It works if I include it in the list of addons to activate when starting, but not after.
Is there a way around this, or something like, ActivateForNextSession that activate the addon for next time I start vim and then return to the default?
Thank you.