Does reload vimrc from a terminal give an error?

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.

shinokada

Posted 2013-12-22T12:52:09.723

Reputation: 1 635

Answers

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.

Ingo Karkat

Posted 2013-12-22T12:52:09.723

Reputation: 19 513