Sunday, March 28, 2010

Re: .exrc in gVimPortable

On 28/03/10 23:48, Albert wrote:
> In the first edition of Teach Yourself Unix in 24 Hours, Taylor and
> Armstrong write that "key mappings are saved in a file called .exrc in
> your home directory...You can also save other things...including
> the :set number option." How do I implement this using gVimPortable on
> Windows 7?
>
> TIA,
> Albert
>

The differences between [_.]exrc and [_.]vimrc are as follows:

1) exrc vs.vimrc

- exrc (but not vimrc) will be sourced at startup by "legacy vi".
- vimrc (but not exrc) sets Vim automagically in 'nocompatible' mode
(recommended) when found.
- If both are present, Vim will use the vimrc, not the exrc.

2) First character in the name.

If only one vimrc is present, its name can be either .vimrc or _vimrc.
If both are present, Vim will use .vimrc when running on Unix/Linux,
_vimrc when running on Windows (a different executable is required, of
course). Similarly for .exrc vs. _exrc

In most other respects these files all play the same role.

I'm not sure what the differences are between Portable gvim and "normal"
gvim. In particular how does it make sure that it uses your vimrc on the
USB chip (or wherever your "portable" install is located)? If you have a
vim.bat (or something) script which sets HOME before starting gvim.exe,
that %HOME% directory is where you should place your _vimrc (and if you
already have one, that's what that book is referring to; it can contain
much more than just mappings). OTOH, if "the place where it looks for
the vimrc" is preset at compile-time, then you should see it listed near
the middle of the output of the ":version" command. Or else, on Windows
you can also put the _vimrc in what Vim sees as $VIM; ":echo $VIM"
(without the quotes, and in a running gvim) will tell you what that means.

In any case, ":echo $MYVIMRC" (without the quotes again) will normally
tell you what (if anything) Vim has loaded as its vimrc (but only in Vim
7.x).


Best regards,
Tony.
--
"I wish there was a knob on the TV to turn up the intelligence.
There's a knob called `brightness', but it doesn't work."
-- Gallagher

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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments:

Post a Comment