From c4da113ef98dcfd6f2a088b1693c0317dcb5bf42 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 15 Jul 2017 19:39:43 +0200 Subject: patch 8.0.0716: not easy to start Vim cleanly 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". --- runtime/doc/debug.txt | 4 ++-- runtime/doc/options.txt | 40 ++++++++++++++++++++++++++-------------- runtime/doc/starting.txt | 41 ++++++++++++++++++++++++++++++----------- runtime/doc/usr_01.txt | 10 +++++----- 4 files changed, 63 insertions(+), 32 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index f539acaa9..4547eabe0 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -1,4 +1,4 @@ -*debug.txt* For Vim version 8.0. Last change: 2012 Feb 11 +*debug.txt* For Vim version 8.0. Last change: 2017 Jul 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -53,7 +53,7 @@ Use this command to start Vim: valgrind --log-file=valgrind.log --leak-check=full ./vim Note: Vim will run much slower. If your .vimrc is big or you have several -plugins you need to be patient for startup, or run with the "-u NONE" +plugins you need to be patient for startup, or run with the "--clean" argument. There are often a few leaks from libraries, such as getpwuid() and diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b083efc53..bbf9cf1ba 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4966,8 +4966,8 @@ A jump table for the options with a short description can be found at |Q_op|. When on the plugin scripts are loaded when starting up |load-plugins|. This option can be reset in your |vimrc| file to disable the loading of plugins. - Note that using the "-u NONE" and "--noplugin" command line arguments - reset this option. |-u| |--noplugin| + Note that using the "-u NONE", "-u DEFAULTS" and "--noplugin" command + line arguments reset this option. See |-u| and |--noplugin|. *'luadll'* 'luadll' string (default depends on the build) @@ -7330,7 +7330,7 @@ A jump table for the options with a short description can be found at |Q_op|. Watch out for errors in expressions. They may render Vim unusable! If you are stuck, hold down ':' or 'Q' to get a prompt, then quit and - edit your .vimrc or whatever with "vim -u NONE" to get it right. + edit your .vimrc or whatever with "vim --clean" to get it right. Examples: Emulate standard status line with 'ruler' set > @@ -7755,7 +7755,7 @@ A jump table for the options with a short description can be found at |Q_op|. NOTE: This option is reset when 'compatible' is set. *'termkey'* *'tk'* -'termkey' 'tk' string (default "CTRL-W") +'termkey' 'tk' string (default "CTRL-W") local to window {not in Vi} The key that precedes a Vim command in a terminal window. Other keys @@ -8333,13 +8333,14 @@ A jump table for the options with a short description can be found at |Q_op|. {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. + 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 @@ -8399,9 +8400,9 @@ A jump table for the options with a short description can be found at |Q_op|. 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 + 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 @@ -8442,6 +8443,17 @@ A jump table for the options with a short description can be found at |Q_op|. 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 "") global diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index eb1fdc895..0ea6ea284 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 8.0. Last change: 2017 Jan 15 +*starting.txt* For Vim version 8.0. Last change: 2017 Jul 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -140,11 +140,12 @@ a slash. Thus "-R" means recovery and "-/R" readonly. --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 + 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}. @@ -465,21 +466,30 @@ a slash. Thus "-R" means recovery and "-/R" readonly. --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 + 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'|. + + 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* @@ -497,6 +507,13 @@ a slash. Thus "-R" means recovery and "-/R" readonly. ":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 @@ -868,6 +885,7 @@ accordingly. Vim proceeds in this order: 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 @@ -990,6 +1008,7 @@ starts its initializations. But as soon as: - 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, diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt index c45c156dc..b450c4e58 100644 --- a/runtime/doc/usr_01.txt +++ b/runtime/doc/usr_01.txt @@ -1,4 +1,4 @@ -*usr_01.txt* For Vim version 8.0. Last change: 2010 Nov 03 +*usr_01.txt* For Vim version 8.0. Last change: 2017 Jul 15 VIM USER MANUAL - by Bram Moolenaar @@ -140,19 +140,19 @@ On other systems, you have to do a little work: 1. Copy the tutor file. You can do this with Vim (it knows where to find it): > - vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' + vim --clean -c 'e $VIMRUNTIME/tutor/tutor' -c 'w! TUTORCOPY' -c 'q' < This will write the file "TUTORCOPY" in the current directory. To use a translated version of the tutor, append the two-letter language code to the filename. For French: > - vim -u NONE -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q' + vim --clean -c 'e $VIMRUNTIME/tutor/tutor.fr' -c 'w! TUTORCOPY' -c 'q' < 2. Edit the copied file with Vim: > - vim -u NONE -c "set nocp" TUTORCOPY + vim --clean TUTORCOPY < - The extra arguments make sure Vim is started in a good mood. + The --clean argument makes sure Vim is started with nice defaults. 3. Delete the copied file when you are finished with it: > -- cgit v1.2.1