mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 7.4.2111
Problem: Defaults are very conservative. Solution: Move settings from vimrc_example.vim to defaults.vim. Load defaults.vim if no .vimrc was found.
This commit is contained in:
parent
eac784eced
commit
8c08b5b569
3
Filelist
3
Filelist
@ -526,8 +526,9 @@ RT_ALL = \
|
|||||||
runtime/macros/urm/examples \
|
runtime/macros/urm/examples \
|
||||||
runtime/macros/urm/urm \
|
runtime/macros/urm/urm \
|
||||||
runtime/macros/urm/urm.vim \
|
runtime/macros/urm/urm.vim \
|
||||||
runtime/mswin.vim \
|
runtime/defaults.vim \
|
||||||
runtime/evim.vim \
|
runtime/evim.vim \
|
||||||
|
runtime/mswin.vim \
|
||||||
runtime/optwin.vim \
|
runtime/optwin.vim \
|
||||||
runtime/ftplugin.vim \
|
runtime/ftplugin.vim \
|
||||||
runtime/ftplugof.vim \
|
runtime/ftplugof.vim \
|
||||||
|
109
runtime/defaults.vim
Normal file
109
runtime/defaults.vim
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
" The default vimrc file.
|
||||||
|
"
|
||||||
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
|
" Last change: 2016 Jul 28
|
||||||
|
"
|
||||||
|
" This is loaded if no vimrc file was found.
|
||||||
|
" Except when Vim is run with "-u NONE" or "-C".
|
||||||
|
" Individual settings can be reverted with ":set option&".
|
||||||
|
" Other commands can be reverted as mentioned below.
|
||||||
|
|
||||||
|
" When started as "evim", evim.vim will already have done these settings.
|
||||||
|
if v:progname =~? "evim"
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Use Vim settings, rather than Vi settings (much better!).
|
||||||
|
" This must be first, because it changes other options as a side effect.
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
" Allow backspacing over everything in insert mode.
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
|
||||||
|
set history=200 " keep 200 lines of command line history
|
||||||
|
set ruler " show the cursor position all the time
|
||||||
|
set showcmd " display incomplete commands
|
||||||
|
set wildmenu " display completion matches in a status line
|
||||||
|
|
||||||
|
" Do incremental searching when it's possible to timeout.
|
||||||
|
if has('reltime')
|
||||||
|
set incsearch
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
|
||||||
|
" confusing.
|
||||||
|
set nrformats-=octal
|
||||||
|
|
||||||
|
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
|
||||||
|
if has('win32')
|
||||||
|
set guioptions-=t
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't use Ex mode, use Q for formatting.
|
||||||
|
" Revert with ":unmap Q".
|
||||||
|
map Q gq
|
||||||
|
|
||||||
|
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
||||||
|
" so that you can undo CTRL-U after inserting a line break.
|
||||||
|
" Revert with ":iunmap <C-U>".
|
||||||
|
inoremap <C-U> <C-G>u<C-U>
|
||||||
|
|
||||||
|
" In many terminal emulators the mouse works just fine. By enabling it you
|
||||||
|
" can position the cursor, Visually select and scroll with the mouse.
|
||||||
|
if has('mouse')
|
||||||
|
set mouse=a
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Switch syntax highlighting on when the terminal has colors or when using the
|
||||||
|
" GUI (which always has colors).
|
||||||
|
if &t_Co > 2 || has("gui_running")
|
||||||
|
" Revert with ":syntax off".
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" I like highlighting strings inside C comments.
|
||||||
|
" Revert with ":unlet c_comment_strings".
|
||||||
|
let c_comment_strings=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Only do this part when compiled with support for autocommands.
|
||||||
|
if has("autocmd")
|
||||||
|
|
||||||
|
" Enable file type detection.
|
||||||
|
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
||||||
|
" 'cindent' is on in C files, etc.
|
||||||
|
" Also load indent files, to automatically do language-dependent indenting.
|
||||||
|
" Revert with ":filetype off".
|
||||||
|
filetype plugin indent on
|
||||||
|
|
||||||
|
" Put these in an autocmd group, so that you can revert them with:
|
||||||
|
" ":augroup vimStartup | au! | augroup END"
|
||||||
|
augroup vimStartup
|
||||||
|
au!
|
||||||
|
|
||||||
|
" When editing a file, always jump to the last known cursor position.
|
||||||
|
" Don't do it when the position is invalid or when inside an event handler
|
||||||
|
" (happens when dropping a file on gvim).
|
||||||
|
autocmd BufReadPost *
|
||||||
|
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
|
||||||
|
\ exe "normal! g`\"" |
|
||||||
|
\ endif
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
endif " has("autocmd")
|
||||||
|
|
||||||
|
" Convenient command to see the difference between the current buffer and the
|
||||||
|
" file it was loaded from, thus the changes you made.
|
||||||
|
" Only define it when not defined already.
|
||||||
|
" Revert with: ":delcommand DiffOrig".
|
||||||
|
if !exists(":DiffOrig")
|
||||||
|
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
|
||||||
|
\ | wincmd p | diffthis
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has('langmap') && exists('+langnoremap')
|
||||||
|
" Prevent that the langmap option applies to characters that result from a
|
||||||
|
" mapping. If unset (default), this may break plugins (but it's backward
|
||||||
|
" compatible).
|
||||||
|
set langnoremap
|
||||||
|
endif
|
@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 7.4. Last change: 2016 Jul 12
|
*options.txt* For Vim version 7.4. Last change: 2016 Jul 28
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -887,7 +887,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
done with ":syntax on".
|
done with ":syntax on".
|
||||||
|
|
||||||
*'backspace'* *'bs'*
|
*'backspace'* *'bs'*
|
||||||
'backspace' 'bs' string (default "")
|
'backspace' 'bs' string (default "", set to "indent,eol,start"
|
||||||
|
in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
|
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
|
||||||
@ -1696,7 +1697,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
|
|
||||||
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
|
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
|
||||||
'compatible' 'cp' boolean (default on, off when a |vimrc| or |gvimrc|
|
'compatible' 'cp' boolean (default on, off when a |vimrc| or |gvimrc|
|
||||||
file is found)
|
file is found, reset in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
This option has the effect of making Vim either more Vi-compatible, or
|
This option has the effect of making Vim either more Vi-compatible, or
|
||||||
@ -3725,8 +3726,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
screen.
|
screen.
|
||||||
|
|
||||||
*'guioptions'* *'go'*
|
*'guioptions'* *'go'*
|
||||||
'guioptions' 'go' string (default "egmrLtT" (MS-Windows),
|
'guioptions' 'go' string (default "egmrLtT" (MS-Windows, "t" is
|
||||||
"aegimrLtT" (GTK, Motif and Athena))
|
removed in |defaults.vim|),
|
||||||
|
"aegimrLtT" (GTK, Motif and Athena),
|
||||||
|
)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{only available when compiled with GUI enabled}
|
{only available when compiled with GUI enabled}
|
||||||
@ -4048,7 +4051,8 @@ 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.
|
NOTE: This option is reset when 'compatible' is set.
|
||||||
|
|
||||||
*'history'* *'hi'*
|
*'history'* *'hi'*
|
||||||
'history' 'hi' number (Vim default: 50, Vi default: 0)
|
'history' 'hi' number (Vim default: 50, Vi default: 0,
|
||||||
|
set to 200 in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
A history of ":" commands, and a history of previous search patterns
|
A history of ":" commands, and a history of previous search patterns
|
||||||
@ -4300,7 +4304,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
evaluating 'includeexpr' |textlock|.
|
evaluating 'includeexpr' |textlock|.
|
||||||
|
|
||||||
*'incsearch'* *'is'* *'noincsearch'* *'nois'*
|
*'incsearch'* *'is'* *'noincsearch'* *'nois'*
|
||||||
'incsearch' 'is' boolean (default off)
|
'incsearch' 'is' boolean (default off, set in |defaults.vim| if the
|
||||||
|
+reltime feature is supported)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{not available when compiled without the
|
{not available when compiled without the
|
||||||
@ -4684,7 +4689,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
< Warning: This deletes all menus that you defined yourself!
|
< Warning: This deletes all menus that you defined yourself!
|
||||||
|
|
||||||
*'langnoremap'* *'lnr'* *'nolangnoremap'* *'nolnr'*
|
*'langnoremap'* *'lnr'* *'nolangnoremap'* *'nolnr'*
|
||||||
'langnoremap' 'lnr' boolean (default off)
|
'langnoremap' 'lnr' boolean (default off, set in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{only available when compiled with the |+langmap|
|
{only available when compiled with the |+langmap|
|
||||||
@ -5150,7 +5155,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
set and to the Vim default value when 'compatible' is reset.
|
set and to the Vim default value when 'compatible' is reset.
|
||||||
|
|
||||||
*'mouse'* *E538*
|
*'mouse'* *E538*
|
||||||
'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
|
'mouse' string (default "", "a" for GUI, MS-DOS and Win32,
|
||||||
|
set to "a" in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
Enable the use of the mouse. Only works for certain terminals
|
Enable the use of the mouse. Only works for certain terminals
|
||||||
@ -5316,7 +5322,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Negative or zero value means no thread scheduling.
|
Negative or zero value means no thread scheduling.
|
||||||
|
|
||||||
*'nrformats'* *'nf'*
|
*'nrformats'* *'nf'*
|
||||||
'nrformats' 'nf' string (default "bin,octal,hex")
|
'nrformats' 'nf' string (default "bin,octal,hex",
|
||||||
|
set to "bin,hex" in |defaults.vim|)
|
||||||
local to buffer
|
local to buffer
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
This defines what bases Vim will consider for numbers when using the
|
This defines what bases Vim will consider for numbers when using the
|
||||||
@ -5986,7 +5993,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
security reasons.
|
security reasons.
|
||||||
|
|
||||||
*'ruler'* *'ru'* *'noruler'* *'noru'*
|
*'ruler'* *'ru'* *'noruler'* *'noru'*
|
||||||
'ruler' 'ru' boolean (default off)
|
'ruler' 'ru' boolean (default off, set in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{not available when compiled without the
|
{not available when compiled without the
|
||||||
@ -6619,8 +6626,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
"n" flag to 'cpoptions'.
|
"n" flag to 'cpoptions'.
|
||||||
|
|
||||||
*'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
|
*'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
|
||||||
'showcmd' 'sc' boolean (Vim default: on, off for Unix, Vi default:
|
'showcmd' 'sc' boolean (Vim default: on, off for Unix,
|
||||||
off)
|
Vi default: off, set in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{not available when compiled without the
|
{not available when compiled without the
|
||||||
@ -8377,7 +8384,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
|
|
||||||
|
|
||||||
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
|
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
|
||||||
'wildmenu' 'wmnu' boolean (default off)
|
'wildmenu' 'wmnu' boolean (default off, set in |defaults.vim|)
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
{not available if compiled without the |+wildmenu|
|
{not available if compiled without the |+wildmenu|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 03
|
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 28
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -806,13 +806,13 @@ accordingly. Vim proceeds in this order:
|
|||||||
For the Macintosh the $VIMRUNTIME/macmap.vim is read.
|
For the Macintosh the $VIMRUNTIME/macmap.vim is read.
|
||||||
|
|
||||||
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC*
|
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC*
|
||||||
c. Four places are searched for initializations. The first that exists
|
c. Five places are searched for initializations. The first that exists
|
||||||
is used, the others are ignored. The $MYVIMRC environment variable is
|
is used, the others are ignored. The $MYVIMRC environment variable is
|
||||||
set to the file that was first found, unless $MYVIMRC was already set
|
set to the file that was first found, unless $MYVIMRC was already set
|
||||||
and when using VIMINIT.
|
and when using VIMINIT.
|
||||||
- The environment variable VIMINIT (see also |compatible-default|) (*)
|
I The environment variable VIMINIT (see also |compatible-default|) (*)
|
||||||
The value of $VIMINIT is used as an Ex command line.
|
The value of $VIMINIT is used as an Ex command line.
|
||||||
- The user vimrc file(s):
|
II The user vimrc file(s):
|
||||||
"$HOME/.vimrc" (for Unix and OS/2) (*)
|
"$HOME/.vimrc" (for Unix and OS/2) (*)
|
||||||
"$HOME/.vim/vimrc" (for Unix and OS/2) (*)
|
"$HOME/.vim/vimrc" (for Unix and OS/2) (*)
|
||||||
"s:.vimrc" (for Amiga) (*)
|
"s:.vimrc" (for Amiga) (*)
|
||||||
@ -829,13 +829,14 @@ accordingly. Vim proceeds in this order:
|
|||||||
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
|
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
|
||||||
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
|
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
|
||||||
See |$VIM| for when $VIM is not set.
|
See |$VIM| for when $VIM is not set.
|
||||||
- The environment variable EXINIT.
|
III The environment variable EXINIT.
|
||||||
The value of $EXINIT is used as an Ex command line.
|
The value of $EXINIT is used as an Ex command line.
|
||||||
- The user exrc file(s). Same as for the user vimrc file, but with
|
IV The user exrc file(s). Same as for the user vimrc file, but with
|
||||||
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
|
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
|
||||||
used, depending on the system. And without the (*)!
|
used, depending on the system. And without the (*)!
|
||||||
- You would usually have "syntax on" and/or "filetype on" commands,
|
V The default vimrc file, $VIMRUNTIME/defaults.vim. This sets up
|
||||||
which trigger initializing filetype detection, see |syntax-loading|.
|
options values and has "syntax on" and "filetype on" commands,
|
||||||
|
which is what most new users will want. See |defaults.vim|.
|
||||||
|
|
||||||
d. If the 'exrc' option is on (which is not the default), the current
|
d. If the 'exrc' option is on (which is not the default), the current
|
||||||
directory is searched for three files. The first that exists is used,
|
directory is searched for three files. The first that exists is used,
|
||||||
@ -912,6 +913,9 @@ accordingly. Vim proceeds in this order:
|
|||||||
The |v:vim_did_enter| variable is set to 1.
|
The |v:vim_did_enter| variable is set to 1.
|
||||||
The |VimEnter| autocommands are executed.
|
The |VimEnter| autocommands are executed.
|
||||||
|
|
||||||
|
The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or
|
||||||
|
gvimrc file.
|
||||||
|
|
||||||
Some hints on using initializations:
|
Some hints on using initializations:
|
||||||
|
|
||||||
Standard setup:
|
Standard setup:
|
||||||
@ -958,16 +962,29 @@ problems if you have a file with only <NL>s and have a line like
|
|||||||
|
|
||||||
*compatible-default*
|
*compatible-default*
|
||||||
When Vim starts, the 'compatible' option is on. This will be used when Vim
|
When Vim starts, the 'compatible' option is on. This will be used when Vim
|
||||||
starts its initializations. But as soon as a user vimrc file is found, or a
|
starts its initializations. But as soon as:
|
||||||
vimrc file in the current directory, or the "VIMINIT" environment variable is
|
- a user vimrc file is found, or
|
||||||
set, it will be set to 'nocompatible'. This has the side effect of setting or
|
- a vimrc file in the current directory, or
|
||||||
resetting other options (see 'compatible'). But only the options that have
|
- the "VIMINIT" environment variable is set, or
|
||||||
not been set or reset will be changed. This has the same effect like the
|
- the "-N" command line argument is given, or
|
||||||
value of 'compatible' had this value when starting Vim. Note that this
|
even when no vimrc file exists.
|
||||||
doesn't happen for the system-wide vimrc file nor when Vim was started with
|
- the |defaults.vim| script is loaded, or
|
||||||
the |-u| command line argument. It does also happen for gvimrc files. The
|
- gvimrc file was found,
|
||||||
$MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or gvimrc
|
then it will be set to 'nocompatible'.
|
||||||
file.
|
|
||||||
|
Note that this does NOT happen when a system-wide vimrc file was found.
|
||||||
|
|
||||||
|
This has the side effect of setting or resetting other options (see
|
||||||
|
'compatible'). But only the options that have not been set or reset will be
|
||||||
|
changed. This has the same effect like the value of 'compatible' had this
|
||||||
|
value when starting Vim.
|
||||||
|
|
||||||
|
'compatible is NOT reset, and |defaults.vim| is not loaded:
|
||||||
|
- when Vim was started with the |-u| command line argument, especially with
|
||||||
|
"-u NONE", or
|
||||||
|
- when started with the |-C| command line argument, or
|
||||||
|
- when the name of the executable ends in "ex". (This has been done to make
|
||||||
|
Vim behave like "ex", when it is started as "ex")
|
||||||
|
|
||||||
But there is a side effect of setting or resetting 'compatible' at the moment
|
But there is a side effect of setting or resetting 'compatible' at the moment
|
||||||
a .vimrc file is found: Mappings are interpreted the moment they are
|
a .vimrc file is found: Mappings are interpreted the moment they are
|
||||||
@ -975,16 +992,24 @@ encountered. This makes a difference when using things like "<CR>". If the
|
|||||||
mappings depend on a certain value of 'compatible', set or reset it before
|
mappings depend on a certain value of 'compatible', set or reset it before
|
||||||
giving the mapping.
|
giving the mapping.
|
||||||
|
|
||||||
The above behavior can be overridden in these ways:
|
*defaults.vim*
|
||||||
- If the "-N" command line argument is given, 'nocompatible' will be used,
|
If Vim is started normally and no user vimrc file is found, the
|
||||||
even when no vimrc file exists.
|
$VIMRUTIME/defaults.vim script is loaded. This will set 'compatible' off,
|
||||||
- If the "-C" command line argument is given, 'compatible' will be used, even
|
switch on syntax highlighting and a few more things. See the script for
|
||||||
when a vimrc file exists.
|
details. NOTE: this is done since Vim 8.0, not in Vim 7.4. (it was added in
|
||||||
- If the "-u {vimrc}" argument is used, 'compatible' will be used.
|
patch 7.4.2111 to be exact).
|
||||||
- When the name of the executable ends in "ex", then this works like the "-C"
|
|
||||||
argument was given: 'compatible' will be used, even when a vimrc file
|
This should work well for new Vim users. If you create your own .vimrc, it is
|
||||||
exists. This has been done to make Vim behave like "ex", when it is started
|
recommended to add this line somewhere near the top: >
|
||||||
as "ex".
|
source $VIMRUNTIME/defaults.vim
|
||||||
|
Then Vim works like before you had a .vimrc. Copying $VIMRUNTIME/vimrc_example
|
||||||
|
is way to do this. Alternatively, you can copy defaults.vim to your .vimrc
|
||||||
|
and modify it.
|
||||||
|
|
||||||
|
If you don't like some of the defaults, you can still source defaults.vim and
|
||||||
|
revert individual settings. See the defaults.vim file for hints on how to
|
||||||
|
revert each item.
|
||||||
|
|
||||||
|
|
||||||
Avoiding trojan horses: *trojan-horse*
|
Avoiding trojan horses: *trojan-horse*
|
||||||
While reading the "vimrc" or the "exrc" file in the current directory, some
|
While reading the "vimrc" or the "exrc" file in the current directory, some
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" Vim script for Evim key bindings
|
" Vim script for Evim key bindings
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2006 Mar 29
|
" Last Change: 2016 Jul 24
|
||||||
|
|
||||||
" Don't use Vi-compatible mode.
|
" Don't use Vi-compatible mode.
|
||||||
set nocompatible
|
set nocompatible
|
||||||
@ -63,4 +63,12 @@ if has("autocmd")
|
|||||||
|
|
||||||
endif " has("autocmd")
|
endif " has("autocmd")
|
||||||
|
|
||||||
|
" Add optional packages.
|
||||||
|
"
|
||||||
|
" The matchit plugin makes the % command work better, but it is not backwards
|
||||||
|
" compatible.
|
||||||
|
if has('syntax') && has('eval')
|
||||||
|
packadd matchit
|
||||||
|
endif
|
||||||
|
|
||||||
" vim: set sw=2 :
|
" vim: set sw=2 :
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" An example for a vimrc file.
|
" An example for a vimrc file.
|
||||||
"
|
"
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last change: 2016 Jun 21
|
" Last change: 2016 Jul 28
|
||||||
"
|
"
|
||||||
" To use it, copy it to
|
" To use it, copy it to
|
||||||
" for Unix and OS/2: ~/.vimrc
|
" for Unix and OS/2: ~/.vimrc
|
||||||
@ -14,60 +14,26 @@ if v:progname =~? "evim"
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Use Vim settings, rather than Vi settings (much better!).
|
" Get the defaults that most users want.
|
||||||
" This must be first, because it changes other options as a side effect.
|
source $VIMRUNTIME/defaults.vim
|
||||||
set nocompatible
|
|
||||||
|
|
||||||
" allow backspacing over everything in insert mode
|
|
||||||
set backspace=indent,eol,start
|
|
||||||
|
|
||||||
if has("vms")
|
if has("vms")
|
||||||
set nobackup " do not keep a backup file, use versions instead
|
set nobackup " do not keep a backup file, use versions instead
|
||||||
else
|
else
|
||||||
set backup " keep a backup file (restore to previous version)
|
set backup " keep a backup file (restore to previous version)
|
||||||
|
if has('persistent_undo')
|
||||||
set undofile " keep an undo file (undo changes after closing)
|
set undofile " keep an undo file (undo changes after closing)
|
||||||
endif
|
endif
|
||||||
set history=50 " keep 50 lines of command line history
|
|
||||||
set ruler " show the cursor position all the time
|
|
||||||
set showcmd " display incomplete commands
|
|
||||||
set incsearch " do incremental searching
|
|
||||||
|
|
||||||
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
|
|
||||||
" let &guioptions = substitute(&guioptions, "t", "", "g")
|
|
||||||
|
|
||||||
" Don't use Ex mode, use Q for formatting
|
|
||||||
map Q gq
|
|
||||||
|
|
||||||
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
|
||||||
" so that you can undo CTRL-U after inserting a line break.
|
|
||||||
inoremap <C-U> <C-G>u<C-U>
|
|
||||||
|
|
||||||
" In many terminal emulators the mouse works just fine, thus enable it.
|
|
||||||
if has('mouse')
|
|
||||||
set mouse=a
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Switch syntax highlighting on when the terminal has colors or when using the
|
|
||||||
" GUI (which always has colors).
|
|
||||||
if &t_Co > 2 || has("gui_running")
|
if &t_Co > 2 || has("gui_running")
|
||||||
syntax on
|
" Switch on highlighting the last used search pattern.
|
||||||
|
|
||||||
" Also switch on highlighting the last used search pattern.
|
|
||||||
set hlsearch
|
set hlsearch
|
||||||
|
|
||||||
" I like highlighting strings inside C comments.
|
|
||||||
let c_comment_strings=1
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Only do this part when compiled with support for autocommands.
|
" Only do this part when compiled with support for autocommands.
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
|
|
||||||
" Enable file type detection.
|
|
||||||
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
|
||||||
" 'cindent' is on in C files, etc.
|
|
||||||
" Also load indent files, to automatically do language-dependent indenting.
|
|
||||||
filetype plugin indent on
|
|
||||||
|
|
||||||
" Put these in an autocmd group, so that we can delete them easily.
|
" Put these in an autocmd group, so that we can delete them easily.
|
||||||
augroup vimrcEx
|
augroup vimrcEx
|
||||||
au!
|
au!
|
||||||
@ -75,14 +41,6 @@ if has("autocmd")
|
|||||||
" For all text files set 'textwidth' to 78 characters.
|
" For all text files set 'textwidth' to 78 characters.
|
||||||
autocmd FileType text setlocal textwidth=78
|
autocmd FileType text setlocal textwidth=78
|
||||||
|
|
||||||
" When editing a file, always jump to the last known cursor position.
|
|
||||||
" Don't do it when the position is invalid or when inside an event handler
|
|
||||||
" (happens when dropping a file on gvim).
|
|
||||||
autocmd BufReadPost *
|
|
||||||
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
|
|
||||||
\ exe "normal! g`\"" |
|
|
||||||
\ endif
|
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -91,22 +49,6 @@ else
|
|||||||
|
|
||||||
endif " has("autocmd")
|
endif " has("autocmd")
|
||||||
|
|
||||||
" Convenient command to see the difference between the current buffer and the
|
|
||||||
" file it was loaded from, thus the changes you made.
|
|
||||||
" Only define it when not defined already.
|
|
||||||
if !exists(":DiffOrig")
|
|
||||||
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
|
|
||||||
\ | wincmd p | diffthis
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has('langmap') && exists('+langnoremap')
|
|
||||||
" Prevent that the langmap option applies to characters that result from a
|
|
||||||
" mapping. If unset (default), this may break plugins (but it's backward
|
|
||||||
" compatible).
|
|
||||||
set langnoremap
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" Add optional packages.
|
" Add optional packages.
|
||||||
"
|
"
|
||||||
" The matchit plugin makes the % command work better, but it is not backwards
|
" The matchit plugin makes the % command work better, but it is not backwards
|
||||||
|
13
src/Makefile
13
src/Makefile
@ -1071,7 +1071,8 @@ SCRIPTLOC = $(VIMRTLOC)
|
|||||||
### the runtime directory is not below it.
|
### the runtime directory is not below it.
|
||||||
#VIMRUNTIMEDIR = $(VIMRTLOC)
|
#VIMRUNTIMEDIR = $(VIMRTLOC)
|
||||||
|
|
||||||
### Name of the evim file target.
|
### Name of the defaults/evim/mswin file target.
|
||||||
|
VIM_DEFAULTS_FILE = $(DESTDIR)$(SCRIPTLOC)/defaults.vim
|
||||||
EVIM_FILE = $(DESTDIR)$(SCRIPTLOC)/evim.vim
|
EVIM_FILE = $(DESTDIR)$(SCRIPTLOC)/evim.vim
|
||||||
MSWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/mswin.vim
|
MSWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/mswin.vim
|
||||||
|
|
||||||
@ -2240,11 +2241,13 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
|
|||||||
chmod $(VIMSCRIPTMOD) $(SYS_SYNMENU_FILE)
|
chmod $(VIMSCRIPTMOD) $(SYS_SYNMENU_FILE)
|
||||||
$(INSTALL_DATA) $(SCRIPTSOURCE)/delmenu.vim $(SYS_DELMENU_FILE)
|
$(INSTALL_DATA) $(SCRIPTSOURCE)/delmenu.vim $(SYS_DELMENU_FILE)
|
||||||
chmod $(VIMSCRIPTMOD) $(SYS_DELMENU_FILE)
|
chmod $(VIMSCRIPTMOD) $(SYS_DELMENU_FILE)
|
||||||
# install the evim file
|
# install the defaults/evim/mswin file
|
||||||
$(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE)
|
$(INSTALL_DATA) $(SCRIPTSOURCE)/defaults.vim $(VIM_DEFAULTS_FILE)
|
||||||
chmod $(VIMSCRIPTMOD) $(MSWIN_FILE)
|
chmod $(VIMSCRIPTMOD) $(VIM_DEFAULTS_FILE)
|
||||||
$(INSTALL_DATA) $(SCRIPTSOURCE)/evim.vim $(EVIM_FILE)
|
$(INSTALL_DATA) $(SCRIPTSOURCE)/evim.vim $(EVIM_FILE)
|
||||||
chmod $(VIMSCRIPTMOD) $(EVIM_FILE)
|
chmod $(VIMSCRIPTMOD) $(EVIM_FILE)
|
||||||
|
$(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE)
|
||||||
|
chmod $(VIMSCRIPTMOD) $(MSWIN_FILE)
|
||||||
# install the rgb.txt file
|
# install the rgb.txt file
|
||||||
$(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(SYS_RGB_FILE)
|
$(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(SYS_RGB_FILE)
|
||||||
chmod $(VIMSCRIPTMOD) $(SYS_RGB_FILE)
|
chmod $(VIMSCRIPTMOD) $(SYS_RGB_FILE)
|
||||||
@ -2612,7 +2615,7 @@ uninstall_runtime:
|
|||||||
-rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-??
|
-rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-??
|
||||||
-rm -f $(SYS_RGB_FILE)
|
-rm -f $(SYS_RGB_FILE)
|
||||||
-rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE)
|
-rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE)
|
||||||
-rm -f $(SYS_BUGR_FILE) $(EVIM_FILE) $(MSWIN_FILE)
|
-rm -f $(SYS_BUGR_FILE) $(VIM_DEFAULTS_FILE) $(EVIM_FILE) $(MSWIN_FILE)
|
||||||
-rm -f $(DEST_SCRIPT)/gvimrc_example.vim $(DEST_SCRIPT)/vimrc_example.vim
|
-rm -f $(DEST_SCRIPT)/gvimrc_example.vim $(DEST_SCRIPT)/vimrc_example.vim
|
||||||
-rm -f $(SYS_FILETYPE_FILE) $(SYS_FTOFF_FILE) $(SYS_SCRIPTS_FILE)
|
-rm -f $(SYS_FILETYPE_FILE) $(SYS_FTOFF_FILE) $(SYS_SCRIPTS_FILE)
|
||||||
-rm -f $(SYS_INDOFF_FILE) $(SYS_INDENT_FILE)
|
-rm -f $(SYS_INDOFF_FILE) $(SYS_INDENT_FILE)
|
||||||
|
@ -905,6 +905,11 @@
|
|||||||
/* #define USR_VIMRC_FILE2 "~/bar/.vimrc" */
|
/* #define USR_VIMRC_FILE2 "~/bar/.vimrc" */
|
||||||
/* #define USR_VIMRC_FILE3 "$VIM/.vimrc" */
|
/* #define USR_VIMRC_FILE3 "$VIM/.vimrc" */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VIM_DEFAULTS_FILE Name of the defaults.vim script file
|
||||||
|
*/
|
||||||
|
/* #define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EVIM_FILE Name of the evim.vim script file
|
* EVIM_FILE Name of the evim.vim script file
|
||||||
*/
|
*/
|
||||||
|
11
src/main.c
11
src/main.c
@ -2997,11 +2997,14 @@ source_startup_scripts(mparm_T *parmp)
|
|||||||
DOSO_VIMRC) == FAIL
|
DOSO_VIMRC) == FAIL
|
||||||
#endif
|
#endif
|
||||||
&& process_env((char_u *)"EXINIT", FALSE) == FAIL
|
&& process_env((char_u *)"EXINIT", FALSE) == FAIL
|
||||||
&& do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL)
|
&& do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL
|
||||||
{
|
|
||||||
#ifdef USR_EXRC_FILE2
|
#ifdef USR_EXRC_FILE2
|
||||||
(void)do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE);
|
&& do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE) == FAIL
|
||||||
#endif
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
/* When no .vimrc file was found: source defaults.vim. */
|
||||||
|
do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3009,7 +3012,7 @@ source_startup_scripts(mparm_T *parmp)
|
|||||||
* Read initialization commands from ".vimrc" or ".exrc" in current
|
* Read initialization commands from ".vimrc" or ".exrc" in current
|
||||||
* directory. This is only done if the 'exrc' option is set.
|
* directory. This is only done if the 'exrc' option is set.
|
||||||
* Because of security reasons we disallow shell and write commands
|
* Because of security reasons we disallow shell and write commands
|
||||||
* now, except for unix if the file is owned by the user or 'secure'
|
* now, except for Unix if the file is owned by the user or 'secure'
|
||||||
* option has been reset in environment of global ".exrc" or ".vimrc".
|
* option has been reset in environment of global ".exrc" or ".vimrc".
|
||||||
* Only do this if VIMRC_FILE is not the same as USR_VIMRC_FILE or
|
* Only do this if VIMRC_FILE is not the same as USR_VIMRC_FILE or
|
||||||
* SYS_VIMRC_FILE.
|
* SYS_VIMRC_FILE.
|
||||||
|
@ -160,6 +160,9 @@ typedef long off_t;
|
|||||||
#ifndef USR_VIMRC_FILE4
|
#ifndef USR_VIMRC_FILE4
|
||||||
# define USR_VIMRC_FILE4 "$VIM/.vimrc"
|
# define USR_VIMRC_FILE4 "$VIM/.vimrc"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef VIM_DEFAULTS_FILE
|
||||||
|
# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim"
|
||||||
|
#endif
|
||||||
#ifndef EVIM_FILE
|
#ifndef EVIM_FILE
|
||||||
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#ifndef USR_VIMRC_FILE3
|
#ifndef USR_VIMRC_FILE3
|
||||||
# define USR_VIMRC_FILE3 "$VIM\\_vimrc"
|
# define USR_VIMRC_FILE3 "$VIM\\_vimrc"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef VIM_DEFAULTS_FILE
|
||||||
|
# define VIM_DEFAULTS_FILE "$VIMRUNTIME\\defaults.vim"
|
||||||
|
#endif
|
||||||
#ifndef EVIM_FILE
|
#ifndef EVIM_FILE
|
||||||
# define EVIM_FILE "$VIMRUNTIME\\evim.vim"
|
# define EVIM_FILE "$VIMRUNTIME\\evim.vim"
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,6 +139,9 @@
|
|||||||
#ifndef SYS_OPTWIN_FILE
|
#ifndef SYS_OPTWIN_FILE
|
||||||
# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
|
# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef VIM_DEFAULTS_FILE
|
||||||
|
# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim"
|
||||||
|
#endif
|
||||||
#ifndef EVIM_FILE
|
#ifndef EVIM_FILE
|
||||||
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
||||||
#endif
|
#endif
|
||||||
|
@ -303,6 +303,10 @@ typedef struct dsc$descriptor DESC;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VIM_DEFAULTS_FILE
|
||||||
|
# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EVIM_FILE
|
#ifndef EVIM_FILE
|
||||||
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
||||||
#endif
|
#endif
|
||||||
|
@ -758,6 +758,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2111,
|
||||||
/**/
|
/**/
|
||||||
2110,
|
2110,
|
||||||
/**/
|
/**/
|
||||||
@ -5349,6 +5351,9 @@ list_version(void)
|
|||||||
version_msg("\"\n");
|
version_msg("\"\n");
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
version_msg(_(" defaults file: \""));
|
||||||
|
version_msg(VIM_DEFAULTS_FILE);
|
||||||
|
version_msg("\"\n");
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
# ifdef SYS_MENU_FILE
|
# ifdef SYS_MENU_FILE
|
||||||
version_msg(_(" system menu file: \""));
|
version_msg(_(" system menu file: \""));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user