Friday, March 29, 2013

Re: MYVIMRC variable not set when invoked with -u option.

On 2013-03-28, PARK, Kyung-Kook wrote:
> What I am trying to do is to set the path variable to something
> derived from the path of user vimrc file given by -u option so
> that I can customize vimrc files for different projects. But the
> thing is that $MYVIMRC or $MYGVIMRC is empty when vimrc is given
> via -u or -U option. They are correctly set when vim is invoked
> normally. If I am doing it in wrong way, is there any other
> correct way?

The documentation (":help $MYVIMRC") states:

c. Four places are searched for initializations. The first that
exists is used, the others are ignored. The $MYVIMRC
environment variable is set to the file that was first found,
unless $MYVIMRC was already set and when using VIMINIT.

So, $MYVIMRC is set to the name of the file that Vim finds by
searching four particular places, not to the name specified by the
-u option.

However, you can obtain the path of your specified vimrc file by
using expand("<sfile>") within that file.

:help <sfile>
:help expand()

Regards,
Gary

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: