The situation: I want to use vader.vim to write some unit tests for a script of mine.

However to really test it, it would be best to only have my plugin and vader.vim loaded. I know how that you can use vim -c 'your-commands-here' via the cmdline. However when I try to use vim -c 'set rtp+=my-plugin' it simply does nothing. I feel like the whole bootup process is finished and then it gets added to the rtp, which is unfortunate.

So the question: How do I effectively whole plugins from the cmdline, or how do I resource my plugins in my rtp?

  • 3
    use custom vimrc to source those plugins and use vim -u /path/to/custom_vimrc ? if it still automatically loads plugins from .vim/plugin, try changing runtimepath as suggested in superuser.com/a/561470
    – Sundeep
    Jul 17, 2016 at 11:01
  • 1
    Add that as an answer and I'll accept it. Also found out you could do vim -u <( cat <<< 'commands to be sourced' ) which works very nice
    – hgiesel
    Jul 17, 2016 at 14:02
  • Recent versions of Vim (7.4.1384 and later) support packages and explicit loading of individual plugins. See :h packages if you have Vim 7.4.1384 or later. Beware that package handling has stabilized after version ~7.4.1500 though. Jul 17, 2016 at 16:21

1 Answer 1


Use custom vimrc to source those plugins and use

vim -u /path/to/custom_vimrc

or, as suggested by @hgiesel, use process substitution

vim -u <( cat <<< 'commands to be sourced' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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