Patch 8.0.0716
Problem:    Not easy to start Vim cleanly without changing the viminfo file.
            Not possible to know whether the -i command line flag was used.
Solution:   Add the --clean command line argument.  Add the 'viminfofile'
            option.  Add "-u DEFAULTS".
Files:      src/main.c, runtime/doc/starting.txt, src/option.c, src/option.h,
            src/ex_cmds.c, src/globals.h, runtime/doc/options.txt


*** ../vim-8.0.0715/src/main.c  2017-06-27 14:43:51.199020498 +0200
--- src/main.c  2017-07-15 19:14:37.537873992 +0200
***************
*** 433,439 ****
  #ifndef NO_VIM_MAIN
      /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
       * Allows for setting 'loadplugins' there. */
!     if (params.use_vimrc != NULL && STRCMP(params.use_vimrc, "NONE") == 0)
        p_lpl = FALSE;
  
      /* Execute --cmd arguments. */
--- 433,441 ----
  #ifndef NO_VIM_MAIN
      /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
       * Allows for setting 'loadplugins' there. */
!     if (params.use_vimrc != NULL
!           && (STRCMP(params.use_vimrc, "NONE") == 0
!               || STRCMP(params.use_vimrc, "DEFAULTS") == 0))
        p_lpl = FALSE;
  
      /* Execute --cmd arguments. */
***************
*** 1869,1874 ****
--- 1871,1877 ----
            case '-':           /* "--" don't take any more option arguments */
                                /* "--help" give help message */
                                /* "--version" give version message */
+                               /* "--clean" clean context */
                                /* "--literal" take files literally */
                                /* "--nofork" don't fork */
                                /* "--not-a-term" don't warn for not a term */
***************
*** 1886,1891 ****
--- 1889,1899 ----
                    msg_didout = FALSE;
                    mch_exit(0);
                }
+               else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0)
+               {
+                   parmp->use_vimrc = (char_u *)"DEFAULTS";
+                   set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0);
+               }
                else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0)
                {
  #ifdef EXPAND_FILENAMES
***************
*** 2318,2324 ****
  #endif
  
                case 'i':       /* "-i {viminfo}" use for viminfo */
!                   use_viminfo = (char_u *)argv[0];
                    break;
  
                case 's':       /* "-s {scriptin}" read from script file */
--- 2326,2332 ----
  #endif
  
                case 'i':       /* "-i {viminfo}" use for viminfo */
!                   set_option_value((char_u *)"vif", 0L, (char_u *)argv[0], 0);
                    break;
  
                case 's':       /* "-s {scriptin}" read from script file */
***************
*** 2988,2994 ****
       */
      if (parmp->use_vimrc != NULL)
      {
!       if (STRCMP(parmp->use_vimrc, "NONE") == 0
                                     || STRCMP(parmp->use_vimrc, "NORC") == 0)
        {
  #ifdef FEAT_GUI
--- 2996,3004 ----
       */
      if (parmp->use_vimrc != NULL)
      {
!       if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0)
!           do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE);
!       else if (STRCMP(parmp->use_vimrc, "NONE") == 0
                                     || STRCMP(parmp->use_vimrc, "NORC") == 0)
        {
  #ifdef FEAT_GUI
***************
*** 3383,3388 ****
--- 3393,3399 ----
  #ifdef FEAT_VIMINFO
      main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
  #endif
+     main_msg(_("--clean\t\t'nocompatible', Vim defaults, no plugins, no 
viminfo"));
      main_msg(_("-h  or  --help\tPrint Help (this message) and exit"));
      main_msg(_("--version\t\tPrint version information and exit"));
  
*** ../vim-8.0.0715/runtime/doc/starting.txt    2016-11-24 15:09:03.409856638 
+0100
--- runtime/doc/starting.txt    2017-07-15 19:14:25.941964102 +0200
***************
*** 140,150 ****
  --noplugin    Skip loading plugins.  Resets the 'loadplugins' option.
                {not in Vi}
                Note that the |-u| argument may also disable loading plugins:
!                       argument        load vimrc files        load plugins ~
!                       (nothing)               yes                 yes
!                       -u NONE                 no                  no
!                       -u NORC                 no                  yes
!                       --noplugin              yes                 no
  
  --startuptime {fname}                                 *--startuptime*
                During startup write timing messages to the file {fname}.
--- 140,151 ----
  --noplugin    Skip loading plugins.  Resets the 'loadplugins' option.
                {not in Vi}
                Note that the |-u| argument may also disable loading plugins:
!                       argument   load: vimrc files  plugins  defaults.vim ~
!                       (nothing)            yes        yes       yes
!                       -u NONE              no         no        no
!                       -u DEFAULTS          no         no        yes
!                       -u NORC              no         yes       no
!                       --noplugin           yes        no        yes
  
  --startuptime {fname}                                 *--startuptime*
                During startup write timing messages to the file {fname}.
***************
*** 230,235 ****
--- 231,237 ----
                the executable "view" has the same effect as the -R argument.
                The 'updatecount' option will be set to 10000, meaning that
                the swap file will not be updated automatically very often.
+               See |-M| for disallowing modifications.
  
                                                        *-m*
  -m            Modifications not allowed to be written.  The 'write' option
***************
*** 464,484 ****
  --nofork      GUI: Do not fork.  Same as |-f|.
                                                        *-u* *E282*
  -u {vimrc}    The file {vimrc} is read for initializations.  Most other
!               initializations are skipped; see |initialization|.  This can
!               be used to start Vim in a special mode, with special
                mappings and settings.  A shell alias can be used to make
                this easy to use.  For example: >
                        alias vimc vim -u ~/.c_vimrc !*
  <             Also consider using autocommands; see |autocommand|.
                When {vimrc} is equal to "NONE" (all uppercase), all
                initializations from files and environment variables are
                skipped, including reading the |gvimrc| file when the GUI
                starts.  Loading plugins is also skipped.
                When {vimrc} is equal to "NORC" (all uppercase), this has the
                same effect as "NONE", but loading plugins is not skipped.
!               Using the "-u" argument has the side effect that the
!               'compatible' option will be on by default.  This can have
!               unexpected effects.  See |'compatible'|.
                {not in Vi}
  
                                                        *-U* *E230*
--- 466,495 ----
  --nofork      GUI: Do not fork.  Same as |-f|.
                                                        *-u* *E282*
  -u {vimrc}    The file {vimrc} is read for initializations.  Most other
!               initializations are skipped; see |initialization|.
! 
!               This can be used to start Vim in a special mode, with special
                mappings and settings.  A shell alias can be used to make
                this easy to use.  For example: >
                        alias vimc vim -u ~/.c_vimrc !*
  <             Also consider using autocommands; see |autocommand|.
+ 
                When {vimrc} is equal to "NONE" (all uppercase), all
                initializations from files and environment variables are
                skipped, including reading the |gvimrc| file when the GUI
                starts.  Loading plugins is also skipped.
+ 
                When {vimrc} is equal to "NORC" (all uppercase), this has the
                same effect as "NONE", but loading plugins is not skipped.
! 
!               When {vimrc} is equal to "DEFAULTS" (all uppercase), this has
!               the same effect as "NONE", but the |defaults.vim| script is
!               loaded, which will also set 'nocompatible'.
! 
!               Using the "-u" argument with another argument than DEFAULTS
!               has the side effect that the 'compatible' option will be on by
!               default.  This can have unexpected effects.  See
!               |'compatible'|.
                {not in Vi}
  
                                                        *-U* *E230*
***************
*** 496,501 ****
--- 507,519 ----
                ":rv" or ":wv" are used.  See also |viminfo-file|.
                {not in Vi}
  
+                                                       *--clean*
+ --clean               Equal to "-u DEFAULTS -i NONE":
+               - initializations from files and environment variables is
+                 skipped
+               - the |defaults.vim| script is loaded, which implies
+                 'nocompatible': use Vim defaults
+               - no viminfo file is read or written
                                                        *-x*
  -x            Use encryption to read/write files.  Will prompt for a key,
                which is then stored in the 'key' option.  All writes will
***************
*** 867,872 ****
--- 885,891 ----
        Loading plugins won't be done when:
        - The 'loadplugins' option was reset in a vimrc file.
        - The |--noplugin| command line argument is used.
+       - The |--clean| command line argument is used.
        - The "-u NONE" command line argument is used |-u|.
        - When Vim was compiled without the |+eval| feature.
        Note that using "-c 'set noloadplugins'" doesn't work, because the
***************
*** 989,994 ****
--- 1008,1014 ----
  - a vimrc file in the current directory, or
  - the "VIMINIT" environment variable is set, or
  - the "-N" command line argument is given, or
+ - the "--clean" command line argument is given, or
    even when no vimrc file exists.
  - the |defaults.vim| script is loaded, or
  - gvimrc file was found,
***************
*** 1219,1225 ****
  - Use `:cquit`.  Also when there are changes.
  
  When using `:cquit` or when there was an error message Vim exits with exit
! code 1.  Errors can be avoided by using `:silent!`.
  
  ==============================================================================
  8. Saving settings                                    *save-settings*
--- 1239,1245 ----
  - Use `:cquit`.  Also when there are changes.
  
  When using `:cquit` or when there was an error message Vim exits with exit
! code 1.  Errors can be avoided by using `:silent!` or with `:catch`.
  
  ==============================================================================
  8. Saving settings                                    *save-settings*
*** ../vim-8.0.0715/src/option.c        2017-07-15 15:16:34.722463986 +0200
--- src/option.c        2017-07-15 18:53:10.259718986 +0200
***************
*** 2986,2991 ****
--- 2986,3000 ----
                            {(char_u *)0L, (char_u *)0L}
  #endif
                            SCRIPTID_INIT},
+     {"viminfofile", "vif",  P_STRING|P_ONECOMMA|P_NODUP|P_SECURE|P_VI_DEF,
+ #ifdef FEAT_VIMINFO
+                           (char_u *)&p_viminfofile, PV_NONE,
+                           {(char_u *)"", (char_u *)0L}
+ #else
+                           (char_u *)NULL, PV_NONE,
+                           {(char_u *)0L, (char_u *)0L}
+ #endif
+                           SCRIPTID_INIT},
      {"virtualedit", "ve",   P_STRING|P_ONECOMMA|P_NODUP|P_VI_DEF
                                                            |P_VIM|P_CURSWANT,
  #ifdef FEAT_VIRTUALEDIT
*** ../vim-8.0.0715/src/option.h        2017-07-15 14:03:53.927047056 +0200
--- src/option.h        2017-07-15 18:24:09.193086923 +0200
***************
*** 920,925 ****
--- 920,926 ----
  #endif
  #ifdef FEAT_VIMINFO
  EXTERN char_u *p_viminfo;     /* 'viminfo' */
+ EXTERN char_u *p_viminfofile; /* 'viminfofile' */
  #endif
  #ifdef FEAT_SESSION
  EXTERN char_u *p_vdir;        /* 'viewdir' */
*** ../vim-8.0.0715/src/ex_cmds.c       2017-07-11 18:28:42.409319604 +0200
--- src/ex_cmds.c       2017-07-15 18:27:13.515684786 +0200
***************
*** 1743,1749 ****
  no_viminfo(void)
  {
      /* "vim -i NONE" does not read or write a viminfo file */
!     return (use_viminfo != NULL && STRCMP(use_viminfo, "NONE") == 0);
  }
  
  /*
--- 1743,1749 ----
  no_viminfo(void)
  {
      /* "vim -i NONE" does not read or write a viminfo file */
!     return STRCMP(p_viminfofile, "NONE") == 0;
  }
  
  /*
***************
*** 2093,2100 ****
  {
      if (file == NULL || *file == NUL)
      {
!       if (use_viminfo != NULL)
!           file = use_viminfo;
        else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL)
        {
  #ifdef VIMINFO_FILE2
--- 2093,2100 ----
  {
      if (file == NULL || *file == NUL)
      {
!       if (*p_viminfofile != NUL)
!           file = p_viminfofile;
        else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL)
        {
  #ifdef VIMINFO_FILE2
*** ../vim-8.0.0715/src/globals.h       2017-06-24 16:03:02.751998272 +0200
--- src/globals.h       2017-07-15 18:49:55.533206552 +0200
***************
*** 1036,1042 ****
  EXTERN int    do_redraw INIT(= FALSE);    /* extra redraw once */
  
  EXTERN int    need_highlight_changed INIT(= TRUE);
- EXTERN char_u *use_viminfo INIT(= NULL);  /* name of viminfo file to use */
  
  #define NSCRIPT 15
  EXTERN FILE   *scriptin[NSCRIPT];         /* streams to read script from */
--- 1036,1041 ----
*** ../vim-8.0.0715/runtime/doc/options.txt     2017-06-18 22:40:36.532444606 
+0200
--- runtime/doc/options.txt     2017-07-15 19:09:24.896284077 +0200
***************
*** 8221,8233 ****
                        {not available when compiled without the |+viminfo|
                        feature}
        When non-empty, the viminfo file is read upon startup and written
!       when exiting Vim (see |viminfo-file|).  The string should be a comma
!       separated list of parameters, each consisting of a single character
!       identifying the particular parameter, followed by a number or string
!       which specifies the value of that parameter.  If a particular
!       character is left out, then the default value is used for that
!       parameter.  The following is a list of the identifying characters and
!       the effect of their value.
        CHAR    VALUE   ~
                                                        *viminfo-!*
        !       When included, save and restore global variables that start
--- 8333,8346 ----
                        {not available when compiled without the |+viminfo|
                        feature}
        When non-empty, the viminfo file is read upon startup and written
!       when exiting Vim (see |viminfo-file|). Except when 'viminfofile' is
!       "NONE".
!       The string should be a comma separated list of parameters, each
!       consisting of a single character identifying the particular parameter,
!       followed by a number or string which specifies the value of that
!       parameter.  If a particular character is left out, then the default
!       value is used for that parameter.  The following is a list of the
!       identifying characters and the effect of their value.
        CHAR    VALUE   ~
                                                        *viminfo-!*
        !       When included, save and restore global variables that start
***************
*** 8287,8295 ****
                has been used since the last search command.
                                                        *viminfo-n*
        n       Name of the viminfo file.  The name must immediately follow
!               the 'n'.  Must be at the end of the option!  If the "-i"
!               argument was given when starting Vim, that file name overrides
!               the one given here with 'viminfo'.  Environment variables are
                expanded when opening the file, not when setting the option.
                                                        *viminfo-r*
        r       Removable media.  The argument is a string (up to the next
--- 8400,8408 ----
                has been used since the last search command.
                                                        *viminfo-n*
        n       Name of the viminfo file.  The name must immediately follow
!               the 'n'.  Must be at the end of the option!  If the
!               'viminfofile' option is set, that file name overrides the one
!               given here with 'viminfo'.  Environment variables are
                expanded when opening the file, not when setting the option.
                                                        *viminfo-r*
        r       Removable media.  The argument is a string (up to the next
***************
*** 8327,8332 ****
--- 8440,8458 ----
  
        This option cannot be set from a |modeline| or in the |sandbox|, for
        security reasons.
+       NOTE: This option is set to the Vim default value when 'compatible'
+       is reset.
+ 
+                               *'viminfofile'* *'vif'*
+ 'viminfofile' 'vif'   string  (default: "")
+                       global
+                       {not in Vi}
+                       {not available when compiled without the |+viminfo|
+                       feature}
+       When non-empty, overrides the file name used for viminfo.
+       When equal to "NONE" no viminfo file will be read or written.
+       This option can be set with the |-i| command line flag.  The |--clean|
+       command line flag sets it to "NONE".
  
                                            *'virtualedit'* *'ve'*
  'virtualedit' 've'    string  (default "")
*** ../vim-8.0.0715/src/version.c       2017-07-15 17:01:50.354726173 +0200
--- src/version.c       2017-07-15 18:02:38.878914803 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     716,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
161. You get up before the sun rises to check your e-mail, and you
     find yourself in the very same chair long after the sun has set.

 /// Bram Moolenaar -- [email protected] -- 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_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/d/optout.

Raspunde prin e-mail lui