Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am a new to Vim and know little about programming.
The situation is this: I have both Vim and Gvim installed. From within Vim I think I have been able to use the
:e $MYVIMRC
command to do some edits I saw online. I was able to save it I think. I think so because the instructions I added show up when I open up Vim.
However, now I want to also change the Vimrc for things related to my GVim (in particular I want to use GVim to to take advantage of python support). Here's where the weirdness happens for me. I try and use
:e $MYVIMRC
but when I open it up
The vimrc file does not reflect any changes that I made from within Vim.
The GVim program does not allow me to write to it.
In fact, when I search for my vimrc file in my computer, I see only one file and it looks like the one that opens up in GVim only.
I'd like to understand:
Why it appears I have to vimrc files though both programs echo back the same location
How I can make changes to the vimrc file from the vantage point of GVim.
I have searched the site but couldn't resolve it myself. Thank you for any help/tips.
–
–
–
The
.vimrc
is sourced from both Vim & Gvim. This file will allow you to set up a common set of CLI & GUI plugins in a single location (shared by both the CLI Vim & Gvim)
The
.gvimrc
is used by Gvim only and will be sourced by Gvim only
after
the
.vimrc
. Regular command line Vim won't read from it.
Within Gvim, you can edit the
.vimrc
file if you want changes to appear to all instances of Vim, or if it's Gvim specific you should be able to edit the
.gvimrc
file separately (to change menus or whatever else the GUI allows you to change)
:help gvimrc
should provide some more insight.
Related:
https://stackoverflow.com/a/38353317/2892779
:version
You may also have secondary rc files, which are being sourced. They will be displayed here. You will also see, which version of vim you have.
In addition
:scriptnames
will list all scripts in the order they are loaded, this is probably not what you want and will also include plugin scripts, etc.
What strikes me as odd, is that on windows, you usually have a
_vimrc
or
_gvimrc
(_ instead of .) and the default directory for these is
%USERPROFILE%\vimfiles
Thanks for contributing an answer to Vi and Vim Stack Exchange!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.