Skip to content

Commit 05f6723

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 5e73ac7 + b56195e commit 05f6723

19 files changed

Lines changed: 314 additions & 128 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ src/testdir/messages
7979
src/testdir/viminfo
8080
src/memfile_test
8181
src/json_test
82+
src/message_test
8283

8384
# From MacVim
8485
.*.swp

Filelist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,9 @@ RT_ALL = \
526526
runtime/macros/urm/examples \
527527
runtime/macros/urm/urm \
528528
runtime/macros/urm/urm.vim \
529-
runtime/mswin.vim \
529+
runtime/defaults.vim \
530530
runtime/evim.vim \
531+
runtime/mswin.vim \
531532
runtime/optwin.vim \
532533
runtime/ftplugin.vim \
533534
runtime/ftplugof.vim \

runtime/defaults.vim

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
" The default vimrc file.
2+
"
3+
" Maintainer: Bram Moolenaar <[email protected]>
4+
" Last change: 2016 Jul 28
5+
"
6+
" This is loaded if no vimrc file was found.
7+
" Except when Vim is run with "-u NONE" or "-C".
8+
" Individual settings can be reverted with ":set option&".
9+
" Other commands can be reverted as mentioned below.
10+
11+
" When started as "evim", evim.vim will already have done these settings.
12+
if v:progname =~? "evim"
13+
finish
14+
endif
15+
16+
" Use Vim settings, rather than Vi settings (much better!).
17+
" This must be first, because it changes other options as a side effect.
18+
set nocompatible
19+
20+
" Allow backspacing over everything in insert mode.
21+
set backspace=indent,eol,start
22+
23+
set history=200 " keep 200 lines of command line history
24+
set ruler " show the cursor position all the time
25+
set showcmd " display incomplete commands
26+
set wildmenu " display completion matches in a status line
27+
28+
" Do incremental searching when it's possible to timeout.
29+
if has('reltime')
30+
set incsearch
31+
endif
32+
33+
" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
34+
" confusing.
35+
set nrformats-=octal
36+
37+
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
38+
if has('win32')
39+
set guioptions-=t
40+
endif
41+
42+
" Don't use Ex mode, use Q for formatting.
43+
" Revert with ":unmap Q".
44+
map Q gq
45+
46+
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
47+
" so that you can undo CTRL-U after inserting a line break.
48+
" Revert with ":iunmap <C-U>".
49+
inoremap <C-U> <C-G>u<C-U>
50+
51+
" In many terminal emulators the mouse works just fine. By enabling it you
52+
" can position the cursor, Visually select and scroll with the mouse.
53+
if has('mouse')
54+
set mouse=a
55+
endif
56+
57+
" Switch syntax highlighting on when the terminal has colors or when using the
58+
" GUI (which always has colors).
59+
if &t_Co > 2 || has("gui_running")
60+
" Revert with ":syntax off".
61+
syntax on
62+
63+
" I like highlighting strings inside C comments.
64+
" Revert with ":unlet c_comment_strings".
65+
let c_comment_strings=1
66+
endif
67+
68+
" Only do this part when compiled with support for autocommands.
69+
if has("autocmd")
70+
71+
" Enable file type detection.
72+
" Use the default filetype settings, so that mail gets 'tw' set to 72,
73+
" 'cindent' is on in C files, etc.
74+
" Also load indent files, to automatically do language-dependent indenting.
75+
" Revert with ":filetype off".
76+
filetype plugin indent on
77+
78+
" Put these in an autocmd group, so that you can revert them with:
79+
" ":augroup vimStartup | au! | augroup END"
80+
augroup vimStartup
81+
au!
82+
83+
" When editing a file, always jump to the last known cursor position.
84+
" Don't do it when the position is invalid or when inside an event handler
85+
" (happens when dropping a file on gvim).
86+
autocmd BufReadPost *
87+
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
88+
\ exe "normal! g`\"" |
89+
\ endif
90+
91+
augroup END
92+
93+
endif " has("autocmd")
94+
95+
" Convenient command to see the difference between the current buffer and the
96+
" file it was loaded from, thus the changes you made.
97+
" Only define it when not defined already.
98+
" Revert with: ":delcommand DiffOrig".
99+
if !exists(":DiffOrig")
100+
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
101+
\ | wincmd p | diffthis
102+
endif
103+
104+
if has('langmap') && exists('+langnoremap')
105+
" Prevent that the langmap option applies to characters that result from a
106+
" mapping. If unset (default), this may break plugins (but it's backward
107+
" compatible).
108+
set langnoremap
109+
endif

runtime/doc/options.txt

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 7.4. Last change: 2016 Jul 12
1+
*options.txt* For Vim version 7.4. Last change: 2016 Jul 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -892,7 +892,8 @@ A jump table for the options with a short description can be found at |Q_op|.
892892
done with ":syntax on".
893893

894894
*'backspace'* *'bs'*
895-
'backspace' 'bs' string (default "")
895+
'backspace' 'bs' string (default "", set to "indent,eol,start"
896+
in |defaults.vim|)
896897
global
897898
{not in Vi}
898899
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
@@ -1709,7 +1710,7 @@ A jump table for the options with a short description can be found at |Q_op|.
17091710

17101711
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
17111712
'compatible' 'cp' boolean (default on, off when a |vimrc| or |gvimrc|
1712-
file is found)
1713+
file is found, reset in |defaults.vim|)
17131714
global
17141715
{not in Vi}
17151716
This option has the effect of making Vim either more Vi-compatible, or
@@ -3836,8 +3837,10 @@ A jump table for the options with a short description can be found at |Q_op|.
38363837
screen.
38373838

38383839
*'guioptions'* *'go'*
3839-
'guioptions' 'go' string (default "egmrLtT" (MS-Windows),
3840-
"aegimrLtT" (GTK, Motif and Athena))
3840+
'guioptions' 'go' string (default "egmrLtT" (MS-Windows, "t" is
3841+
removed in |defaults.vim|),
3842+
"aegimrLtT" (GTK, Motif and Athena),
3843+
)
38413844
global
38423845
{not in Vi}
38433846
{only available when compiled with GUI enabled}
@@ -4161,7 +4164,8 @@ A jump table for the options with a short description can be found at |Q_op|.
41614164
NOTE: This option is reset when 'compatible' is set.
41624165

41634166
*'history'* *'hi'*
4164-
'history' 'hi' number (Vim default: 50, Vi default: 0)
4167+
'history' 'hi' number (Vim default: 50, Vi default: 0,
4168+
set to 200 in |defaults.vim|)
41654169
global
41664170
{not in Vi}
41674171
A history of ":" commands, and a history of previous search patterns
@@ -4414,7 +4418,8 @@ A jump table for the options with a short description can be found at |Q_op|.
44144418
evaluating 'includeexpr' |textlock|.
44154419

44164420
*'incsearch'* *'is'* *'noincsearch'* *'nois'*
4417-
'incsearch' 'is' boolean (default off)
4421+
'incsearch' 'is' boolean (default off, set in |defaults.vim| if the
4422+
+reltime feature is supported)
44184423
global
44194424
{not in Vi}
44204425
{not available when compiled without the
@@ -4798,7 +4803,7 @@ A jump table for the options with a short description can be found at |Q_op|.
47984803
< Warning: This deletes all menus that you defined yourself!
47994804

48004805
*'langnoremap'* *'lnr'* *'nolangnoremap'* *'nolnr'*
4801-
'langnoremap' 'lnr' boolean (default off)
4806+
'langnoremap' 'lnr' boolean (default off, set in |defaults.vim|)
48024807
global
48034808
{not in Vi}
48044809
{only available when compiled with the |+langmap|
@@ -5290,7 +5295,8 @@ A jump table for the options with a short description can be found at |Q_op|.
52905295
set and to the Vim default value when 'compatible' is reset.
52915296

52925297
*'mouse'* *E538*
5293-
'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
5298+
'mouse' string (default "", "a" for GUI, MS-DOS and Win32,
5299+
set to "a" in |defaults.vim|)
52945300
global
52955301
{not in Vi}
52965302
Enable the use of the mouse. Only works for certain terminals
@@ -5456,7 +5462,8 @@ A jump table for the options with a short description can be found at |Q_op|.
54565462
Negative or zero value means no thread scheduling.
54575463

54585464
*'nrformats'* *'nf'*
5459-
'nrformats' 'nf' string (default "bin,octal,hex")
5465+
'nrformats' 'nf' string (default "bin,octal,hex",
5466+
set to "bin,hex" in |defaults.vim|)
54605467
local to buffer
54615468
{not in Vi}
54625469
This defines what bases Vim will consider for numbers when using the
@@ -6126,7 +6133,7 @@ A jump table for the options with a short description can be found at |Q_op|.
61266133
security reasons.
61276134

61286135
*'ruler'* *'ru'* *'noruler'* *'noru'*
6129-
'ruler' 'ru' boolean (default off)
6136+
'ruler' 'ru' boolean (default off, set in |defaults.vim|)
61306137
global
61316138
{not in Vi}
61326139
{not available when compiled without the
@@ -6759,8 +6766,8 @@ A jump table for the options with a short description can be found at |Q_op|.
67596766
"n" flag to 'cpoptions'.
67606767

67616768
*'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
6762-
'showcmd' 'sc' boolean (Vim default: on, off for Unix, Vi default:
6763-
off)
6769+
'showcmd' 'sc' boolean (Vim default: on, off for Unix,
6770+
Vi default: off, set in |defaults.vim|)
67646771
global
67656772
{not in Vi}
67666773
{not available when compiled without the
@@ -8531,7 +8538,7 @@ A jump table for the options with a short description can be found at |Q_op|.
85318538

85328539

85338540
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
8534-
'wildmenu' 'wmnu' boolean (default off)
8541+
'wildmenu' 'wmnu' boolean (default off, set in |defaults.vim|)
85358542
global
85368543
{not in Vi}
85378544
{not available if compiled without the |+wildmenu|

runtime/doc/starting.txt

Lines changed: 57 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 03
1+
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -807,13 +807,13 @@ accordingly. Vim proceeds in this order:
807807
MacVim.app, this only applies to the older Carbon version).
808808

809809
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC*
810-
c. Four places are searched for initializations. The first that exists
810+
c. Five places are searched for initializations. The first that exists
811811
is used, the others are ignored. The $MYVIMRC environment variable is
812812
set to the file that was first found, unless $MYVIMRC was already set
813813
and when using VIMINIT.
814-
- The environment variable VIMINIT (see also |compatible-default|) (*)
815-
The value of $VIMINIT is used as an Ex command line.
816-
- The user vimrc file(s):
814+
I The environment variable VIMINIT (see also |compatible-default|) (*)
815+
The value of $VIMINIT is used as an Ex command line.
816+
II The user vimrc file(s):
817817
"$HOME/.vimrc" (for Unix and OS/2) (*)
818818
"$HOME/.vim/vimrc" (for Unix and OS/2) (*)
819819
"s:.vimrc" (for Amiga) (*)
@@ -830,13 +830,14 @@ accordingly. Vim proceeds in this order:
830830
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
831831
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
832832
See |$VIM| for when $VIM is not set.
833-
- The environment variable EXINIT.
834-
The value of $EXINIT is used as an Ex command line.
835-
- The user exrc file(s). Same as for the user vimrc file, but with
836-
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
837-
used, depending on the system. And without the (*)!
838-
- You would usually have "syntax on" and/or "filetype on" commands,
839-
which trigger initializing filetype detection, see |syntax-loading|.
833+
III The environment variable EXINIT.
834+
The value of $EXINIT is used as an Ex command line.
835+
IV The user exrc file(s). Same as for the user vimrc file, but with
836+
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
837+
used, depending on the system. And without the (*)!
838+
V The default vimrc file, $VIMRUNTIME/defaults.vim. This sets up
839+
options values and has "syntax on" and "filetype on" commands,
840+
which is what most new users will want. See |defaults.vim|.
840841

841842
d. If the 'exrc' option is on (which is not the default), the current
842843
directory is searched for three files. The first that exists is used,
@@ -913,6 +914,9 @@ accordingly. Vim proceeds in this order:
913914
The |v:vim_did_enter| variable is set to 1.
914915
The |VimEnter| autocommands are executed.
915916

917+
The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or
918+
gvimrc file.
919+
916920
Some hints on using initializations:
917921

918922
Standard setup:
@@ -959,33 +963,54 @@ problems if you have a file with only <NL>s and have a line like
959963

960964
*compatible-default*
961965
When Vim starts, the 'compatible' option is on. This will be used when Vim
962-
starts its initializations. But as soon as a user vimrc file is found, or a
963-
vimrc file in the current directory, or the "VIMINIT" environment variable is
964-
set, it will be set to 'nocompatible'. This has the side effect of setting or
965-
resetting other options (see 'compatible'). But only the options that have
966-
not been set or reset will be changed. This has the same effect like the
967-
value of 'compatible' had this value when starting Vim. Note that this
968-
doesn't happen for the system-wide vimrc file nor when Vim was started with
969-
the |-u| command line argument. It does also happen for gvimrc files. The
970-
$MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or gvimrc
971-
file.
966+
starts its initializations. But as soon as:
967+
- a user vimrc file is found, or
968+
- a vimrc file in the current directory, or
969+
- the "VIMINIT" environment variable is set, or
970+
- the "-N" command line argument is given, or
971+
even when no vimrc file exists.
972+
- the |defaults.vim| script is loaded, or
973+
- gvimrc file was found,
974+
then it will be set to 'nocompatible'.
975+
976+
Note that this does NOT happen when a system-wide vimrc file was found.
977+
978+
This has the side effect of setting or resetting other options (see
979+
'compatible'). But only the options that have not been set or reset will be
980+
changed. This has the same effect like the value of 'compatible' had this
981+
value when starting Vim.
982+
983+
'compatible is NOT reset, and |defaults.vim| is not loaded:
984+
- when Vim was started with the |-u| command line argument, especially with
985+
"-u NONE", or
986+
- when started with the |-C| command line argument, or
987+
- when the name of the executable ends in "ex". (This has been done to make
988+
Vim behave like "ex", when it is started as "ex")
972989

973990
But there is a side effect of setting or resetting 'compatible' at the moment
974991
a .vimrc file is found: Mappings are interpreted the moment they are
975992
encountered. This makes a difference when using things like "<CR>". If the
976993
mappings depend on a certain value of 'compatible', set or reset it before
977994
giving the mapping.
978995

979-
The above behavior can be overridden in these ways:
980-
- If the "-N" command line argument is given, 'nocompatible' will be used,
981-
even when no vimrc file exists.
982-
- If the "-C" command line argument is given, 'compatible' will be used, even
983-
when a vimrc file exists.
984-
- If the "-u {vimrc}" argument is used, 'compatible' will be used.
985-
- When the name of the executable ends in "ex", then this works like the "-C"
986-
argument was given: 'compatible' will be used, even when a vimrc file
987-
exists. This has been done to make Vim behave like "ex", when it is started
988-
as "ex".
996+
*defaults.vim*
997+
If Vim is started normally and no user vimrc file is found, the
998+
$VIMRUTIME/defaults.vim script is loaded. This will set 'compatible' off,
999+
switch on syntax highlighting and a few more things. See the script for
1000+
details. NOTE: this is done since Vim 8.0, not in Vim 7.4. (it was added in
1001+
patch 7.4.2111 to be exact).
1002+
1003+
This should work well for new Vim users. If you create your own .vimrc, it is
1004+
recommended to add this line somewhere near the top: >
1005+
source $VIMRUNTIME/defaults.vim
1006+
Then Vim works like before you had a .vimrc. Copying $VIMRUNTIME/vimrc_example
1007+
is way to do this. Alternatively, you can copy defaults.vim to your .vimrc
1008+
and modify it.
1009+
1010+
If you don't like some of the defaults, you can still source defaults.vim and
1011+
revert individual settings. See the defaults.vim file for hints on how to
1012+
revert each item.
1013+
9891014

9901015
Avoiding trojan horses: *trojan-horse*
9911016
While reading the "vimrc" or the "exrc" file in the current directory, some

runtime/evim.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim script for Evim key bindings
22
" Maintainer: Bram Moolenaar <[email protected]>
3-
" Last Change: 2006 Mar 29
3+
" Last Change: 2016 Jul 24
44

55
" Don't use Vi-compatible mode.
66
set nocompatible
@@ -63,4 +63,12 @@ if has("autocmd")
6363

6464
endif " has("autocmd")
6565

66+
" Add optional packages.
67+
"
68+
" The matchit plugin makes the % command work better, but it is not backwards
69+
" compatible.
70+
if has('syntax') && has('eval')
71+
packadd matchit
72+
endif
73+
6674
" vim: set sw=2 :

0 commit comments

Comments
 (0)