blob: 02e4143be630bb5aafd4612848d81a5a93ebfe49 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" An example for a vimrc file.
2"
Christian Brabandte978b452023-08-13 10:33:05 +02003" Maintainer: The Vim Project <https://github.com/vim/vim>
4" Last Change: 2023 Aug 10
5" Former Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006"
7" To use it, copy it to
Bram Moolenaar6f345a12019-12-17 21:27:18 +01008" for Unix: ~/.vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +00009" for Amiga: s:.vimrc
Bram Moolenaar6f345a12019-12-17 21:27:18 +010010" for MS-Windows: $VIM\_vimrc
Bram Moolenaarb3f74062020-02-26 16:16:53 +010011" for Haiku: ~/config/settings/vim/vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +000012" for OpenVMS: sys$login:.vimrc
13
Bram Moolenaar314dd792019-02-03 15:27:20 +010014" When started as "evim", evim.vim will already have done these settings, bail
15" out.
Bram Moolenaar071d4272004-06-13 20:20:40 +000016if v:progname =~? "evim"
17 finish
18endif
19
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020020" Get the defaults that most users want.
21source $VIMRUNTIME/defaults.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
23if has("vms")
24 set nobackup " do not keep a backup file, use versions instead
25else
Bram Moolenaar76756882014-02-05 22:02:01 +010026 set backup " keep a backup file (restore to previous version)
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020027 if has('persistent_undo')
28 set undofile " keep an undo file (undo changes after closing)
29 endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000030endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000031
Bram Moolenaar071d4272004-06-13 20:20:40 +000032if &t_Co > 2 || has("gui_running")
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020033 " Switch on highlighting the last used search pattern.
Bram Moolenaar071d4272004-06-13 20:20:40 +000034 set hlsearch
35endif
36
Bram Moolenaar314dd792019-02-03 15:27:20 +010037" Put these in an autocmd group, so that we can delete them easily.
38augroup vimrcEx
Bram Moolenaar071d4272004-06-13 20:20:40 +000039 au!
40
41 " For all text files set 'textwidth' to 78 characters.
42 autocmd FileType text setlocal textwidth=78
Bram Moolenaar314dd792019-02-03 15:27:20 +010043augroup END
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000044
Bram Moolenaaraedfcbe2016-03-25 17:02:51 +010045" Add optional packages.
46"
47" The matchit plugin makes the % command work better, but it is not backwards
48" compatible.
Bram Moolenaar24a98a02017-09-27 22:23:55 +020049" The ! means the package won't be loaded right away but when plugins are
50" loaded during initialization.
Bram Moolenaar802a0d92016-06-26 16:17:58 +020051if has('syntax') && has('eval')
Bram Moolenaar24a98a02017-09-27 22:23:55 +020052 packadd! matchit
Bram Moolenaar802a0d92016-06-26 16:17:58 +020053endif