Mercurial > vim
annotate runtime/defaults.vim @ 31505:dc282943639c v9.0.1085
patch 9.0.1085: compiler warns for uninitialized variable
Commit: https://github.com/vim/vim/commit/9b8a365d019bb948efba5b5276d52bdd99e15d05
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 20 20:47:28 2022 +0000
patch 9.0.1085: compiler warns for uninitialized variable
Problem: Compiler warns for uninitialized variable.
Solution: Initialize the variable. Remove unused function. (John Marriott)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Dec 2022 22:00:04 +0100 |
parents | c968191a8557 |
children | 7296f4ef3ead |
rev | line source |
---|---|
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " The default vimrc file. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org> |
28010 | 4 " Last change: 2022 Mar 03 |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " This is loaded if no vimrc file was found. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " Except when Vim is run with "-u NONE" or "-C". |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " Individual settings can be reverted with ":set option&". |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " Other commands can be reverted as mentioned below. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " When started as "evim", evim.vim will already have done these settings. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 if v:progname =~? "evim" |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 finish |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
10096
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
16 " Bail out if something that ran earlier, e.g. a system wide vimrc, does not |
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
17 " want Vim to use these default values. |
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
18 if exists('skip_defaults_vim') |
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
19 finish |
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
20 endif |
1eab38e5cfdf
commit https://github.com/vim/vim/commit/b07a82b6d5f904ed3e623e775c3458adb1cc0a3e
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
21 |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " Use Vim settings, rather than Vi settings (much better!). |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 " This must be first, because it changes other options as a side effect. |
11152
c780e3774dac
patch 8.0.0463: side effects from resetting 'compatible' in defaults.vim
Christian Brabandt <cb@256bit.org>
parents:
10096
diff
changeset
|
24 " Avoid side effects when it was already reset. |
c780e3774dac
patch 8.0.0463: side effects from resetting 'compatible' in defaults.vim
Christian Brabandt <cb@256bit.org>
parents:
10096
diff
changeset
|
25 if &compatible |
c780e3774dac
patch 8.0.0463: side effects from resetting 'compatible' in defaults.vim
Christian Brabandt <cb@256bit.org>
parents:
10096
diff
changeset
|
26 set nocompatible |
c780e3774dac
patch 8.0.0463: side effects from resetting 'compatible' in defaults.vim
Christian Brabandt <cb@256bit.org>
parents:
10096
diff
changeset
|
27 endif |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
11297
2db80d94107d
patch 8.0.0534: defaults.vim does not work well with tiny features
Christian Brabandt <cb@256bit.org>
parents:
11152
diff
changeset
|
29 " When the +eval feature is missing, the set command above will be skipped. |
2db80d94107d
patch 8.0.0534: defaults.vim does not work well with tiny features
Christian Brabandt <cb@256bit.org>
parents:
11152
diff
changeset
|
30 " Use a trick to reset compatible only when the +eval feature is missing. |
11362
2c2b7f486fb0
patch 8.0.0566: setting nocompatible for the tiny version moves the cursor
Christian Brabandt <cb@256bit.org>
parents:
11297
diff
changeset
|
31 silent! while 0 |
2c2b7f486fb0
patch 8.0.0566: setting nocompatible for the tiny version moves the cursor
Christian Brabandt <cb@256bit.org>
parents:
11297
diff
changeset
|
32 set nocompatible |
2c2b7f486fb0
patch 8.0.0566: setting nocompatible for the tiny version moves the cursor
Christian Brabandt <cb@256bit.org>
parents:
11297
diff
changeset
|
33 silent! endwhile |
11297
2db80d94107d
patch 8.0.0534: defaults.vim does not work well with tiny features
Christian Brabandt <cb@256bit.org>
parents:
11152
diff
changeset
|
34 |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 " Allow backspacing over everything in insert mode. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 set backspace=indent,eol,start |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 set history=200 " keep 200 lines of command line history |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 set ruler " show the cursor position all the time |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 set showcmd " display incomplete commands |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 set wildmenu " display completion matches in a status line |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
9917
8c0b13fe60dc
commit https://github.com/vim/vim/commit/e07e797db0c5ef1aafc650d8bb0d39fb052cf1e1
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
43 set ttimeout " time out for key codes |
8c0b13fe60dc
commit https://github.com/vim/vim/commit/e07e797db0c5ef1aafc650d8bb0d39fb052cf1e1
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
44 set ttimeoutlen=100 " wait up to 100ms after Esc for special key |
8c0b13fe60dc
commit https://github.com/vim/vim/commit/e07e797db0c5ef1aafc650d8bb0d39fb052cf1e1
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
45 |
9678
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
9669
diff
changeset
|
46 " Show @@@ in the last line if it is truncated. |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
9669
diff
changeset
|
47 set display=truncate |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
9669
diff
changeset
|
48 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
10011
diff
changeset
|
49 " Show a few lines of context around the cursor. Note that this makes the |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
10011
diff
changeset
|
50 " text scroll if you mouse-click near the start or end of the window. |
10011
306f72cd32c2
commit https://github.com/vim/vim/commit/4427db9bb2f4b4587559eac18cc7ba10c52c6e8b
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
51 set scrolloff=5 |
306f72cd32c2
commit https://github.com/vim/vim/commit/4427db9bb2f4b4587559eac18cc7ba10c52c6e8b
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
52 |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 " Do incremental searching when it's possible to timeout. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 if has('reltime') |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 set incsearch |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 " confusing. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 set nrformats-=octal |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 if has('win32') |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 set guioptions-=t |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
28010 | 67 " Don't use Q for Ex mode, use it for formatting. Except for Select mode. |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 " Revert with ":unmap Q". |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 map Q gq |
28010 | 70 sunmap Q |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 " so that you can undo CTRL-U after inserting a line break. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 " Revert with ":iunmap <C-U>". |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 inoremap <C-U> <C-G>u<C-U> |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 " In many terminal emulators the mouse works just fine. By enabling it you |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 " can position the cursor, Visually select and scroll with the mouse. |
18465
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
79 " Only xterm can grab the mouse events when using the shift key, for other |
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
80 " terminals use ":", select text and press Esc. |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 if has('mouse') |
18465
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
82 if &term =~ 'xterm' |
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
83 set mouse=a |
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
84 else |
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
85 set mouse=nvi |
d7619a9874cd
patch 8.1.2226: cannot use system copy/paste in non-xterm terminals
Bram Moolenaar <Bram@vim.org>
parents:
18343
diff
changeset
|
86 endif |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
89 " Only do this part when Vim was compiled with the +eval feature. |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
90 if 1 |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
91 |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
92 " Enable file type detection. |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
93 " Use the default filetype settings, so that mail gets 'tw' set to 72, |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
94 " 'cindent' is on in C files, etc. |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
95 " Also load indent files, to automatically do language-dependent indenting. |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
96 " Revert with ":filetype off". |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
97 filetype plugin indent on |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
99 " Put these in an autocmd group, so that you can revert them with: |
26219 | 100 " ":augroup vimStartup | exe 'au!' | augroup END" |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
101 augroup vimStartup |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
102 au! |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
104 " When editing a file, always jump to the last known cursor position. |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
105 " Don't do it when the position is invalid, when inside an event handler |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
106 " (happens when dropping a file on gvim) and for a commit message (it's |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
107 " likely a different one than last time). |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
108 autocmd BufReadPost * |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
109 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
110 \ | exe "normal! g`\"" |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
111 \ | endif |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
113 augroup END |
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
114 |
26153
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
115 " Quite a few people accidentally type "q:" instead of ":q" and get confused |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
116 " by the command line window. Give a hint about how to get out. |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
117 " If you don't like this you can put this in your vimrc: |
26219 | 118 " ":augroup vimHints | exe 'au!' | augroup END" |
26153
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
119 augroup vimHints |
26219 | 120 au! |
121 autocmd CmdwinEnter * | |
26153
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
122 \ echohl Todo | |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
123 \ echo 'You discovered the command-line window! You can close it with ":q".' | |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
124 \ echohl None |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
125 augroup END |
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
22565
diff
changeset
|
126 |
15884
de7d35007cc1
patch 8.1.0948: when built without +eval "Vim --clean" produces errors
Bram Moolenaar <Bram@vim.org>
parents:
15729
diff
changeset
|
127 endif |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 |
22456
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
129 " Switch syntax highlighting on when the terminal has colors or when using the |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
130 " GUI (which always has colors). |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
131 if &t_Co > 2 || has("gui_running") |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
132 " Revert with ":syntax off". |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
133 syntax on |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
134 |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
135 " I like highlighting strings inside C comments. |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
136 " Revert with ":unlet c_comment_strings". |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
137 let c_comment_strings=1 |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
138 endif |
693b7e5d7f3a
patch 8.2.1776: filetype.vim may be loaded twice
Bram Moolenaar <Bram@vim.org>
parents:
18489
diff
changeset
|
139 |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 " Convenient command to see the difference between the current buffer and the |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 " file it was loaded from, thus the changes you made. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 " Only define it when not defined already. |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 " Revert with: ":delcommand DiffOrig". |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 if !exists(":DiffOrig") |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 \ | wincmd p | diffthis |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9917
diff
changeset
|
149 if has('langmap') && exists('+langremap') |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 " Prevent that the langmap option applies to characters that result from a |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9917
diff
changeset
|
151 " mapping. If set (default), this may break plugins (but it's backward |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 " compatible). |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9917
diff
changeset
|
153 set nolangremap |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 endif |