0

I write a lot of Vim plugins. When I make an edit to a plugin's .vim file, I'll often just quit Vim and restart it to test it.

In some cases, I would like to avoid quitting and restarting Vim. I know I could :source ... the specific .vim file in my plugin that I've edited, but I'd be happy to know if there's a way to re-source all the startup files without quitting and restarting Vim.

I realize that some .vim files are written to exit early if they're sourced a second time, but that's okay for this purpose.

1

Well, if you insist… execute('scriptnames')->split("\n")->map({_, v -> split(v, ': ')[1]}) gives you all the scripts. You can then map(scripts, {_, v -> execute('source '.v)}). But this seems odd.

You could also :runtime plugin/*.vim plugin/**/*.vim if it's just plugins you're interested.

Then there's :Runtime from tpope's scriptease plugin, which is great for the case you described about :sourceing a file.

1
  • 1
    I'll start using the :Runtime command. It does correct tab-autocompletion at the command line too! I've been using :Scriptnames and :PP from that plugin for a while, but did appreciate :Runtime until now. Oct 22 '21 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.