3

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.

1 Answer 1

4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .