comparison runtime/defaults.vim @ 9669:284b4eb307fc v7.4.2111

commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 28 22:24:15 2016 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Jul 2016 22:30:05 +0200
parents
children 8c9e13109df8
comparison
equal deleted inserted replaced
9668:7d1ab1664b75 9669:284b4eb307fc
1 " The default vimrc file.
2 "
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
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