Question

I am modifying an installed VIM plugin and in another Terminal tab I am testing the results. Each time I want to test the changes I have to restart VIM.

Is there any faster way to do this process? How can I reload a VIM plugin after VIM was started?

The plugin is installed via Vundle

I have tried to run :so % that is supposed to reload the .vimrc file but I still cannot see my changes.

Was it helpful?

Solution

If there weren't an inclusion guard (if ! exists('g:loaded_pluginname') ...), you could simply :runtime! plugin/pluginname.vim (or :source % if it's currently opened) and all plugin definitions would be re-read.

But as most plugins (correctly) use such a guard, you need to :unlet that variable first:

:unlet g:loaded_pluginname | runtime! plugin/pluginname.vim

My ReloadScript plugin can do this with one command if the guard name adheres to the canonical naming, and the scriptease plugin has such a command, too.

Edit: Some plugins use differently named guard variables, or other ways that prevent reloading. The plugins from mattn (like emmet.vim) are quite elaborate; maybe there's some special mechanism; I don't use that plugin. You could ask the author for advice, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top