Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 594292 - >=app-editors/vim-8: mouse always enabled
Summary: >=app-editors/vim-8: mouse always enabled
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-18 22:31 UTC by Jason A. Donenfeld
Modified: 2016-09-20 18:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason A. Donenfeld gentoo-dev 2016-09-18 22:31:43 UTC
I realize this might be an upstream issue, but I figure I'll ask here before sounding alarms up top.

I use VIM in the console. I don't like VIM's mouse support, so I don't use it. I never had to deal with it in VIM 7, but it's snuck its way into VIM 8 in a very odd fashion.

When I run `vim some/file` mouse mode is bizarrely and very unfortunately enabled.

Putting 'set mouse=' in /etc/vim/vimrc.local doesn't seem to have an impact. However, I can turn mouse mode off for each instance of root VIM by running ":set mouse=" everytime I start th eprogram. Of course, this is a PITA, and in the first place I don't want it to be on, ever.

Note that this is with nearly vanilla VIM; I don't have any customisations. I don't even have a ~/.vimrc...

What makes it all the more perplexing is that this bug goes away if I run:
   $ touch ~/.vimrc

In other words, if ~/.vimrc exists, the bug goes away, no matter if that file is actually empty.

Very perplexing indeed.

Any ideas?
Comment 1 Jason A. Donenfeld gentoo-dev 2016-09-18 22:40:49 UTC
Okay, trudging through the VIM source code, apparently if there's no ~/.vimrc, then it sources /usr/share/vim/vim80/defaults.vim. It's either/or. That's weird behavior!

That file has this in it:

" Bail out if something that ran earlier, e.g. a system wide vimrc, does not
" want Vim to use these default values.
if exists('skip_defaults_vim')
  finish
endif


Perhaps this belongs in /etc/vim/vimrc?
Comment 2 Coacher 2016-09-18 22:41:30 UTC
> I don't even have a ~/.vimrc...

:help defaults.vim
If Vim is started normally and no user vimrc file is found, the
$VIMRUTIME/defaults.vim script is loaded.  This will set 'compatible' off,
switch on syntax highlighting and a few more things.  See the script for
details.  NOTE: this is done since Vim 8.0, not in Vim 7.4. (it was added in
patch 7.4.2111 to be exact).

and 'set mouse=a' is in defaults.vim, see ':help mouse'.
Comment 3 Jason A. Donenfeld gentoo-dev 2016-09-18 22:44:57 UTC
Yes, okay, so this is new in VIM 8. Apparently we should be putting 'let g:skip_defaults_vim = 1' in /etc/vim/vimrc. I can confirm this fixes the problem.

Mind if I merge this and revbump the build?


diff --git a/app-editors/vim-core/files/vimrc-r4 b/app-editors/vim-core/files/vimrc-r4
index 07fffcc..fdc316b 100644
--- a/app-editors/vim-core/files/vimrc-r4
+++ b/app-editors/vim-core/files/vimrc-r4
@@ -190,6 +190,10 @@ augroup END
 endif " has("autocmd")
 " }}}
 
+" We don't want VIM to load their own built-in defaults, preferring ours here
+" instead:
+let g:skip_defaults_vim = 1
+
 " {{{ vimrc.local
 if filereadable("@GENTOO_PORTAGE_EPREFIX@/etc/vim/vimrc.local")
   source @GENTOO_PORTAGE_EPREFIX@/etc/vim/vimrc.local
Comment 4 Jason A. Donenfeld gentoo-dev 2016-09-20 18:04:21 UTC
10:44:12        @monsieurp | zx2c4: hi! wrt your vim patch it LGTM

commit c7caaf374650078707df8ce9b313e967ceff56f6
Author: Jason A. Donenfeld <zx2c4@gentoo.org>
Date:   Tue Sep 20 20:02:44 2016 +0200

    app-editors/vim-core: don't use vim's defaults (bug #594292)