Ahu Lee
Ahu Lee

Reputation: 399

Created in vimrc variable is not seen in terminal, but only in gui version?

I use the nightly build of VIM 8.1.565. It comes as both a terminal vim.exe and gui gvim.exe version.

If I create a variable in my _vimrc I can echo it only from the gui version gvim.exe. When I run vim.exe in a terminal there's no that variable, it doesn't see it.

Why is that? What am I missing here?

PS I have several vims on my system (in the path). One that I mentioned above and another as a cygwin package. They have different version number, so when I run it in a terminal I can see that it's the vim I need. So, there's no mistake here.

Upvotes: 0

Views: 72

Answers (1)

Patrick Bacon
Patrick Bacon

Reputation: 4640

Leverage Vim's Initialization Process by Checking the Value of $MYVIMRC

When I look at the help files associated with initialization, e.g. :help initialization, it states:

The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or gvimrc file.

This will help in clarifying which vimrc is being called for both the gui and the command line.

I have had a similar problem (I also do most of my work on a windows computer and I also leverage cygwin for some of its applications).

Section 3 of the initialization section discusses vim's process associated with looking for and executing the vimrc file.

Places for your personal initializations: ... MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc or $VIM/_vimrc

There is great value in understanding this process. I place my vimrc file at $HOME/_vimrc and my cygwin and non-cygwin version of vim use the same _vimrc.

Upvotes: 1

Related Questions