When I reload .vimrc from vim, it doesn't give any sign of error.

:so %

But when I use terminal to reload, it gives an error.

$ source ~/.vimrc

Does it suppose to give an error? Or I'm not supposed to source it from a terminal?

I use Mavericks + iTerm + oh-my-zsh.

Thanks in advance.


The ~/.vimrc file contains settings and customizations for Vim, written in Vimscript (also known as Ex commands, based on the vi-mode they're entered). A shell (like Bash running in your terminal) cannot understand those commands, and therefore gives you errors. (Likewise, :source ~/.bashrc would give you errors in Vim. You also don't source other RC files like ~/.gitconfig or ~/.mailrc and expect that to work.)

So, though :source and $ source are commands with the same name, they only apply to their corresponding contexts.

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.