Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have gvim installed as well as vim. I want gvim and vim to share the same config file. How can I do that?
Vim reads ~/.vimrc; gvim reads ~/.gvimrc as well as ~/.vimrc.
So simply put your commands into ~/.vimrc (and put the GUI-specific commands into ~/.gvimrc).
Newer Vims also look at ~/.vim/vimrc and ~/.vim/gvimrc.
You can also use something along the following lines in your vimrc:
has('gui') return True if Vim has a GUI compiled in (regardless of whether you're running the terminal vim or not). A better option is has('gui_running'), which only returns True if the GUI is actually running.
Required, but never shown