blob: e11e4cff555962c753b8536aa2cbec29360af053 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" An example for a vimrc file.
2"
3" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar6f345a12019-12-17 21:27:18 +01004" Last change: 2019 Dec 17
Bram Moolenaar071d4272004-06-13 20:20:40 +00005"
6" To use it, copy it to
Bram Moolenaar6f345a12019-12-17 21:27:18 +01007" for Unix: ~/.vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +00008" for Amiga: s:.vimrc
Bram Moolenaar6f345a12019-12-17 21:27:18 +01009" for MS-Windows: $VIM\_vimrc
Bram Moolenaarb3f74062020-02-26 16:16:53 +010010" for Haiku: ~/config/settings/vim/vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +000011" for OpenVMS: sys$login:.vimrc
12
Bram Moolenaar314dd792019-02-03 15:27:20 +010013" When started as "evim", evim.vim will already have done these settings, bail
14" out.
Bram Moolenaar071d4272004-06-13 20:20:40 +000015if v:progname =~? "evim"
16 finish
17endif
18
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020019" Get the defaults that most users want.
20source $VIMRUNTIME/defaults.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000021
22if has("vms")
23 set nobackup " do not keep a backup file, use versions instead
24else
Bram Moolenaar76756882014-02-05 22:02:01 +010025 set backup " keep a backup file (restore to previous version)
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020026 if has('persistent_undo')
27 set undofile " keep an undo file (undo changes after closing)
28 endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000029endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
Bram Moolenaar071d4272004-06-13 20:20:40 +000031if &t_Co > 2 || has("gui_running")
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020032 " Switch on highlighting the last used search pattern.
Bram Moolenaar071d4272004-06-13 20:20:40 +000033 set hlsearch
34endif
35
Bram Moolenaar314dd792019-02-03 15:27:20 +010036" Put these in an autocmd group, so that we can delete them easily.
37augroup vimrcEx
Bram Moolenaar071d4272004-06-13 20:20:40 +000038 au!
39
40 " For all text files set 'textwidth' to 78 characters.
41 autocmd FileType text setlocal textwidth=78
Bram Moolenaar314dd792019-02-03 15:27:20 +010042augroup END
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000043
Bram Moolenaaraedfcbe2016-03-25 17:02:51 +010044" Add optional packages.
45"
46" The matchit plugin makes the % command work better, but it is not backwards
47" compatible.
Bram Moolenaar24a98a02017-09-27 22:23:55 +020048" The ! means the package won't be loaded right away but when plugins are
49" loaded during initialization.
Bram Moolenaar802a0d92016-06-26 16:17:58 +020050if has('syntax') && has('eval')
Bram Moolenaar24a98a02017-09-27 22:23:55 +020051 packadd! matchit
Bram Moolenaar802a0d92016-06-26 16:17:58 +020052endif