I like to use external configuration for most of my dot files in my home directory. Simple example, here is my .bash_aliases file:

. /path/to/external/alias-config.conf

where the external file contains my aliases. Same idea with my .vimrc:

. /path/to/external/vim-config.conf

But when I open vim I get this error:

Error detected while processing /home/demo/.vimrc:
line    1:
E492: Not an editor command: . '/path/to/external/vim-config.conf'

But when I change my .vimrc to be:

source /path/to/external/vim-config.conf

it is able to successfully source my external configuration.

It was my understanding that 'source' is an alias of '.', so what is going on here? I try to write the dot files in my home directory to be POSIX compliant, so this sort of thing undermines my intention. Any insight into this peculiarity would be appreciated.

My default shell is Bash and my OS is Ubuntu Server 16.04, if that makes any difference.

2 Answers 2


It's quite simple: bash has a different configuration file syntax than vim and what works for one program doesn't necessarily work for another.

So, bash can use . file and source file but vim doesn't understand the . file syntax.

Also, being Posix compliant matters for the shell, not for the config file of an application (like vim).


Sven said it all, except most commands can be shortened; in this case you could write so:

                                    *:so* *:source* *load-vim-script*
:so[urce] {file}    Read Ex commands from {file}.  These are commands that
                    start with a ":".

As a side-note, it's often a good practice to use the long version in scripts for clarity. Vim also handles partial commands, e.g. :sourc, :sour or :sou have the same effect.

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.