On 27/12/13 21:36, Rob Owens wrote:
On Fri, Dec 27, 2013 at 2:34 PM, Gary Johnson <[email protected]
<mailto:[email protected]>> wrote:
On 2013-12-27, Rob Owens wrote:
> My apologies if this has been reported already. I follow this
list, but not as
> closely as I'd like to.
>
> Using gvim 7.4 on Windows, syntax highlighting is on by default.
But if I
> create $HOME/_vimrc (even if it is empty), syntax highlighting
gets turned
> off. I'm not sure what other default settings might get turned
off, if any.
>
> I'm not sure what behavior the developers expect in this
situation, but as a
> user I expected that my user settings would be used *in addition*
to the
> default settings. I did not expect to eliminate any/all default
settings just
> by making an unrelated user-default setting.
>
> I found this bug when changing my user's default color scheme,
but as I said
> above, this bug shows up even if I create an empty $HOME/_vimrc file.
This is not a bug. You just need to learn about Vim's various
configuration files and how they work.
(Caveat: I use Vim on Windows all the time, but I don't have access
to a Windows system at the moment, so I may get some detail of my
explanation wrong.)
When Vim is installed on Windows, a default configuration file is
created: $VIM/_vimrc, where on Windows XP, for example, $VIM is
"C:\Program Files\Vim". That default configuration file makes a few
settings and sources $VIMRUNTIME/vimrc_example.vim which makes more
settings and enables syntax highlighting.
As explained in ":help vimrc", Vim considers this configuration
file, $VIM/_vimrc, to be a personal configuration file. So, when
you create your own $HOME/_vimrc, Vim sources that _instead_of_
$VIM/_vimrc. Thus you lose any settings that were set by that file.
The simplest solution would be for you to put this line in your
$HOME/_vimrc:
source $VIM/_vimrc
A better solution would be for you to read $VIM/_vimrc and
$VIMRUNTIME/vimrc_example.vim and copy to your $HOME/_vimrc those
commands and settings you find useful. That will give you better
control over your own Vim configuration.
HTH,
Gary
Thanks Gary, that's the info I was looking for.
I have added 'source $VIM/_vimrc' to my $HOME/_vimrc, because I think
that if somebody put time and effort into choosing the defaults, I'd
like to run with them unless I find good reason not to. But I will look
over $VIM/_vimrc to see what's in there.
-Rob
This is a wise thing to do.
What I recommend is to create $HOME/_vimrc or $HOME/.vimrc containing
the line
runtime vimrc_example.vim
then whenever you find that you want to add (or override) some
customizations, add it in your vimrc, usually below that line. One thing
I did early on was to add
filetype indent off
because I wanted filetype-plugins and syntax highlighting but not
automatic filetype-dependent indenting (which ran against my tastes most
of the time: in particular, I want to be able to set different indent
amounts in different parts of a single file) (the vimrc_example.vim
includes the line "filetype plugin indent on").
Here too, it is a good idea to look at what the vimrc_example.vim does,
and it does quite a lot.
The advantage of sourcing it rather than copying it is that by sourcing
you will never have obsolete settings from a vimrc_example.vim that is
no more "in step" with an updated Vim.
Best regards,
Tony.
--
I hate babies. They're so human.
-- H. H. Munro
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.