I am using the minimalistic Vimplug as the plugin manager for Vim.

Installing plugins through Vimplug involves putting the following code inside the vimrc file.

call plug#begin('~/.vim/plugged')

Plug 'user/repository'

call plug#end()

I install a lot of plugins, hence I don't want to put all the code inside the main configuration file but source it from a separate file dedicated to plugins.

I name that file as Plugins.vim and source it inside the main vimrc file putting the following in the first line.

source $HOME/.vim/Plugins.vim

Unfortunately the plugins don't get loaded, and even though Vim reads the file it outputs error messages relating to that line where it is being asked to source.

I tried to fix it by changing the path and file permissions but with no results.

Note: The vimrc file may be located inside the home directory as .vimrc or in .vim directory as vimrc.

The error is:

E471: Argument required

It is either related to source or the file itself (I set file's permission to 777, but I remember sometimes it did not open the file and issued file is unreadable error as well.)

Currently I am using one file the .vimrc as sourcing doesn't work for me.

  • 2
    What are the error messages? – Herb Wolfe Jan 21 '17 at 20:26
  • Maybe not a duplicate but strongly related: How to load plugins from my vimrc and from another file?. I think adding the test with filereadable() could help you. – statox Jan 23 '17 at 7:50
  • I've updated my post and added the error. – user10767 Jan 23 '17 at 12:45
  • Why the file should be unreadable? Or is it the quotes for source '' "", should I pass a variable and not a quoted path string to source? – user10767 Jan 23 '17 at 12:46
  • @Chinggiss6 Where do you have quotes? Note, " in your vimrc usually denotes the start of a comment, so this would explain why your :source command does not see an argument! – Christian Brabandt Apr 19 '17 at 16:21

I think, you have to call call plug#begin('~/.vim/plugged'), only then you can source the plugin file. It is good practice to have the plugins in a separate file btw!

  • No, it should work with a simple :source – Christian Brabandt Apr 19 '17 at 16:22
  • 1
    @ChristianBrabandt: I agree with you, but he clearly states, that he sources the plugin file in the first line of vimrc, only later does he call plug. That is the problem, the examples for plug clearly state: first call plugged, then source any plugins. – mike Apr 19 '17 at 19:03
  • he said he put the complete plug section into a new file. That should work. However, as I have commented, I believe the problem is actually that he quoted the file (as he stated in a comment later, but not in the example he showed) – Christian Brabandt Apr 19 '17 at 19:12

Your Answer

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