GVIM on Windows not loading vimrc sometimes

889 views
Skip to first unread message

divad24

unread,
May 24, 2010, 6:09:17 PM5/24/10
to vim...@googlegroups.com

I'm using GVIM 7.2 on Windows 7 and am having a problem with the vimrc file.
When I open GVIM and then open a file, it loads all my preferences just
fine. When I right click on a file and select "Edit with Vim" it doesn't
load my preferences. My _vimrc file is in C:\ vim72\. Is there something I
can do to fix this?

Thanks in advance.
--
View this message in context: http://old.nabble.com/GVIM-on-Windows-not-loading-vimrc-sometimes-tp28662374p28662374.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

John Beckett

unread,
May 24, 2010, 7:30:04 PM5/24/10
to vim...@googlegroups.com
divad24 wrote:
> I'm using GVIM 7.2 on Windows 7 and am having a problem with
> the vimrc file.
> When I open GVIM and then open a file, it loads all my
> preferences just fine. When I right click on a file and
> select "Edit with Vim" it doesn't load my preferences. My
> _vimrc file is in C:\vim72\. Is there something I can do to fix this?

Setting this environment variable may help:
VIM=C:\vim72

Test current value (if any) in a new command prompt window:
set V

You would set VIM in System Properties, Advanced tab,
Environment Variables. You can put it only in 'User' or only in
'System' (applies to all users).

John

Gary Johnson

unread,
May 24, 2010, 8:03:19 PM5/24/10
to vim...@googlegroups.com
On 2010-05-24, divad24 wrote:
> I'm using GVIM 7.2 on Windows 7 and am having a problem with the vimrc file.
> When I open GVIM and then open a file, it loads all my preferences just
> fine. When I right click on a file and select "Edit with Vim" it doesn't
> load my preferences. My _vimrc file is in C:\ vim72\. Is there something I
> can do to fix this?

C:\vim72 is not a standard place that Vim looks to find a _vimrc
file. See

:help vimrc

My guess is that when you open gvim, it starts in the directory in
which the executable is installed. It then looks in that directory,
the current working directory, for a _vimrc file and loads it.

When you right click on a file, however, gvim starts in the
directory in which that file is located, which may not contain any
_vimrc file. In that case, no _vimrc file is loaded.

On a Windows XP system, Vim is normally installed in C:\Program
Files\Vim. That directory normally contains three files:

_vimrc A default _vimrc with settings thought to be useful
for Windows users.

vim72 The executable files and default runtime files. You
should never touch anything in this directory.

vimfile User-supplied runtime files. This is where you
should put any runtime files that you've modified or
that you've downloaded from vim.sf.net, for example.

The name of the directory that contains those files is contained in
the variable $VIM. Therefore, the usual place that Vim will look
for your _vimrc file is in $VIM/_vimrc. You can see the value of
$VIM by executing

:echo $VIM

That is the directory where you should put your _vimrc so that it
will be loaded no matter where or how you start gvim.

Note:

1. A _vimrc in $VIM will be shared by all users of your computer,
but since Windows PCs are typically single-user, that is not
normally a problem. If you want a _vimrc that is customized for
only you, you can put it under $HOME instead. I didn't think
you cared about that at this point, though.

2. There are ways to force Vim to load the _vimrc from somewhere
else or to not load it at all, but that's beyond the scope of
this discussion.

HTH,
Gary

divad24

unread,
May 24, 2010, 8:46:54 PM5/24/10
to vim...@googlegroups.com

Okay, so I created a VIM environment variable, set to C:\vim72\ and now when
I run GVim with the "Edit with Vim" button, I get this error message:

Error detected while processing C:\vim72\_vimrc:
line 1:
E185: Cannot find color scheme desert
Error detected while processing C:\vim72\menu.vim:
line 155:
E121: Undefined variable: paste#paste_cmd
E15: Invalid expression: 'vnoremenu <script> &Edit.&Paste<Tab>"+gP^I' .
paste#paste_cmd['v']

The first line of my _vimrc file sets the color scheme. It works fine when I
open GVim and then open a file. Also, there is no menu bar in the window I
open wit the "Edit with Vim" option.

Thanks.
--
View this message in context: http://old.nabble.com/GVIM-on-Windows-not-loading-vimrc-sometimes-tp28662374p28663242.html
Sent from the Vim - General mailing list archive at Nabble.com.

John Little

unread,
May 25, 2010, 12:13:56 AM5/25/10
to vim_use


On May 25, 12:46 pm, divad24 <danielschmid...@gmail.com> wrote:
> Okay, so I created a VIM environment variable, set to C:\vim72\ and now when
> I run GVim  with the "Edit with Vim" button, I get this error message:

IMO changing $VIM can cause trouble. The usual place on windows for
_vimrc is $HOME, usually set to something like C:\Documents and
Settings\username (that's XP, Vista has C:\Users\username I think).

Regards, John
Reply all
Reply to author
Forward
0 new messages