I recently switched from using Vim in terminal to MacVim. The move had a lot to do with the fact that I use GUIs with git and other stuff too. MacVim loaded my .vimrc automatically, which was great, but I wanted a slightly different config for the GUI version of Vim. So here’s a simple trick that allows you to apply a specific configuration for MacVim and another for Vim in shell. Make a copy of .vimrc and name it .vimrc_shell. Then create a file named .vimrc_macvim.

$ cp .vimrc .vimrc_shell && touch .vimrc_macvim

Erase the contents of .vimrc

$ > .vimrc

And add the following lines to it

if has("gui_macvim")
    source ~/.vimrc_macvim
    source ~/.vimrc_shell

That’s it. If .vimrc is loaded from MacVim, it uses .vimrc_macvim as a config. If Vim is opened in a shell, it uses .vimrc_shell as a config.