viminfo file location for Vim 8

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

viminfo file location for Vim 8

David Fishburn-2
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.

The text for the viminfo options for the "n" parameter appears to be unchanged between Vim 7 and Vim 8:

Other options you might want to use:
n name used for the viminfo file (must be the last option)

I have also tried shortening my set viminfo line and playing around.

Anyone have any ideas?

Thanks,
David

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: viminfo file location for Vim 8

David Fishburn-2

On Thu, Jan 26, 2017 at 8:52 AM, David Fishburn <[hidden email]> 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.

David

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: viminfo file location for Vim 8

Bram Moolenaar

David Fishburn wrote:

> On Thu, Jan 26, 2017 at 8:52 AM, David Fishburn <[hidden email]>
> 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 -- [hidden email] -- 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: viminfo file location for Vim 8

Tony Mechelynck
In reply to this post by David Fishburn-2
On Tue, Mar 7, 2017 at 3:52 PM, David Fishburn <[hidden email]> wrote:

>
> On Thu, Jan 26, 2017 at 8:52 AM, David Fishburn <[hidden email]>
> 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'm surprised by this affirmation. By default, the viminfo is read and
written in your $HOME directory instead, or, on Windows only, in $VIM
if $HOME is not set.

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

The problem is that your system vimrc is sourced too early (see :help
startup) and that, as you found out, if you don't have a .vimrc Vim
sets its "new defaults", similar to what the vimrc_example.vim used to
do; but this happens when looking for a user vimrc and not finding
one, thus after the system vimrc (if any) has been sourced.

If, as is recommended, you had put your user defaults in a "user
vimrc" (in your $HOME directory, thus applying only to you), not in a
system-wide "system vimrc" (applying to every login name on your
system), you wouldn't have had this problem.

If you have a user vimrc, sourcing the vimrc_example.vim from it will
still implicitly source the defaults.vim too, but after that point in
your vimrc you can override any default that doesn't suit you. For
instance I use "filetype indent off" when coming back from sourcing
the example vimrc, because I don't like the way Vim does
autoindenting. As for the viminfo, having it in $HOME suits me so I
don't set its name, I just use

if has('viminfo')
  set vi='500,!,%,c
  if has('unix')
    set vi+=r/mnt/
  endif
endif " +viminfo


Best regards,
Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: viminfo file location for Vim 8

David Fishburn-2
In reply to this post by Bram Moolenaar


On Wed, Mar 8, 2017 at 4:40 PM, Bram Moolenaar <[hidden email]> wrote:

David Fishburn wrote:

> On Thu, Jan 26, 2017 at 8:52 AM, David Fishburn <[hidden email]>
> 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?


I launched Vim using:
gvim.exe -u vimrc_viminfo_location -U vimrc_viminfo_location test.txt


My vimrc_viminfo had the following:
        " Do not keep compatibility with Vi, use all of Vim's features
        set nocompatible
        set hlsearch
        " Do not use select mode, only use visual mode (see next option)
        set selectmode=
        " This option controls the behaviour of the buttons when selecting
        " text.  I dont like selectmode, since it is useless <g>.  Using
        " visual mode all the time when selecting text allows you to perform
        " a lot more functions over the selected range.
        " selectmode is really there to make Vim more like Windows.
        " This also forces the buttons on the mouse to perform like Unix, not
        " Windows
        behave xterm
        set cursorline
        set cursorcolumn
        set laststatus=2
        set shortmess=at
        set whichwrap=<,>,h,l
        set history=500
        set nobackup
        set nowritebackup
        set incsearch
        set showcmd
        set showbreak=>>
        set nostartofline
        set joinspaces
        set nrformats-=octal
        set ignorecase smartcase
        set virtualedit=
        set modelines=10
        set shiftwidth=4
        set nodigraph
        set esckeys
        set hidden
        set ruler
        set showmatch
        set visualbell
        set wildmenu
        set noerrorbells
        set autoindent
        set autochdir
        set foldopen+=jump
        set hidden
        set expandtab
        set tabstop=4

        syntax on
        filetype on
        filetype plugin on
        " VimInfo
        " \"50      - save only the first 50 lines of each register
        " '1000     - save 1000 local marks
        " h         - disable 'hlsearch' highlighting when starting
        " f1        - global marks are stored A - Z
        " rA:       - A: is a removable media, dont store stuff about it
        " r...:     - ...=directory, $TEMP: are temporary files, dont store stuff about it
        " :500      - lines of history
        " /500      - size of the search history
        " !         - save and restore global variables
        " n...      - viminfo file name and location
        set viminfo=\"50,'1000,h,f1,rA:,r$TEMP:,r$TMP:,r$TMPDIR:,:500,/500,!,n$VIM/_viminfo
        " Avoid command-line redraw on every entered character
        " by turning off Arabic shaping
        if has('arabic')
            set noarabicshape
        endif
        if has('linux')
            set fileformats=unix,dos,mac      " Leave files in Unix format first
        elseif has('macunix')
            set fileformats=mac,unix,dos      " Leave files in Mac format first
        else
            set fileformats=dos,unix,mac      " Leave files in DOS format first
        endif


And the resulting Vim had:

set viminfo?
  viminfo="50,'1000,h,f1,rA:,r$TEMP:,r$TMP:,r$TMPDIR:,:500,/500,!,n$VIM/_viminfo


So yes Bram, the change to defaults.vim from:
        set nocompatible

To:
        if &compatible
          set nocompatible
        endif


Would have prevented my issue.

Thanks,
David

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.