Wednesday, March 8, 2017

Re: viminfo file location for Vim 8

David Fishburn wrote:

> On Thu, Jan 26, 2017 at 8:52 AM, David Fishburn <dfishburn.vim@gmail.com>
> wrote:
>
> > I use the following line in my vimrc (Windows):
> >
> > set viminfo=\"50,'500,:500,/500,h,f1,rA:,r$TEMP:,r$TMP:,r$
> > TMPDIR:!,n$VIM/_viminfo
> >
> >
> > For Vim 5,6,7 this works as expected and the _viminfo file is created in
> > my $VIM root directory.
> >
> > When I upgraded to Vim 8, now the _viminfo is being created in whatever
> > directory I launched Vim from. I have been through the docs and do not see
> > what might be causing it.
> >
>
>
> I finally tracked this down to a new Vim 8 feature.
> I use a System vimrc ($VIM/vimrc) rather than a user vimrc ($HOME/.vimrc).
>
> So Vim 8 started sourcing a defaults.vim on me.
>
> This is documented here:
> Defaults without a .vimrc file ~
> *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).
>
>
> I figured this out, after noticing despite me setting the viminfo option,
> it was changed.
> :verbose set viminfo
> viminfo='100,<50,s10,h,rA:,rB:
> Last set from C:\Vim\vim80\defaults.vim
>
>
> I added the following to my $VIM/vimrc file:
> " Vim 8, prevents defaults.vim from being sourced
> let skip_defaults_vim = 1
>
> Hope this helps others on the list and updates all the people who monitor
> and respond to this list as another item to check if someone else complains
> about it.

But 'viminfo' isn't set in defaults.vim. What does happen is that
'nocompatible' is set.

I can see that this is very confusing, and/or will result in many users
disableing the use of defaults.vim. How about only resetting
'compatible' if it's set:

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
" Avoid side effects when it was already reset.
if &compatible
set nocompatible
endif


Any problem with that?

--
From "know your smileys":
;-0 Can't find shift key
,-9 Kann Umschalttaste nicht finden

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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/d/optout.

No comments: