Bug#856273: vim: explain how the various vimrc files are processed

James McCoy jamessan at debian.org
Mon Feb 27 12:33:42 UTC 2017


On Mon, Feb 27, 2017 at 12:19:40PM +0100, Paul Slootman wrote:
> On a new installation of stretch, I was being frustrated by vim
> hijacking the mouse from xterm (so pasting text ended up quite
> differently than I was expecting).  I figured out I needed to disable
> the mouse support in vim, so I created /etc/vim/vimrc.local and put
> set mouse=
> in there.

Did the information in NEWS.Debian.gz (which should have been presented
by apt-listchanges) not help?

  vim (2:8.0.0022-1) unstable; urgency=medium

    Vim now ships with a defaults.vim file which, when the user has no vimrc,
    enables some options that have historically been disabled by default.  This
    is described in more detail at ":help defaults.vim".

    Since defaults.vim is loaded when the user's vimrc would typically be
    loaded, it will override any settings in /etc/vim/vimrc(.local).  In order
    to disable the loading of defaults.vim, add

      let g:skip_defaults_vim = 1

    to /etc/vim/vimrc(.local).

   -- James McCoy <jamessan at debian.org>  Tue, 04 Oct 2016 20:28:02 -0400

> However, the mouse was STILL being hijacked, and ":set mouse" showed
> that the setting in /etc/vim/vimrc.local was apparently being ignored.
> Via strace I discovered

A simpler approach would be to look at the output of ":scriptnames".

> that defaults.vim was being read AFTER
> /etc/vim/vimrc.local was processed, and that overruled the vimrc.local.
> I don't find this logical, I'd expect that anything I put in
> /etc/vim/vimrc.local would be the "default" setting when starting up vim
> and any other fine-tuning can be done via the users' ~/.vimrc .

Upstream specifically chose to have defaults.vim be loaded _only_ when
the user doesn't have a vimrc file and to leave it up to the sysadminn
to deal with the interaction between defaults.vim and the system vimrc
file.  That's why I provided hints in NEWS.Debian about how to deal with
it at the system level.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB



More information about the pkg-vim-maintainers mailing list