blob: b05793bd101540bb13328c8a9b81efc29bf228e7 [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 Moolenaar314dd792019-02-03 15:27:20 +01004" Last change: 2019 Jan 26
Bram Moolenaar071d4272004-06-13 20:20:40 +00005"
6" To use it, copy it to
7" for Unix and OS/2: ~/.vimrc
8" for Amiga: s:.vimrc
9" for MS-DOS and Win32: $VIM\_vimrc
10" for OpenVMS: sys$login:.vimrc
11
Bram Moolenaar314dd792019-02-03 15:27:20 +010012" When started as "evim", evim.vim will already have done these settings, bail
13" out.
Bram Moolenaar071d4272004-06-13 20:20:40 +000014if v:progname =~? "evim"
15 finish
16endif
17
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020018" Get the defaults that most users want.
19source $VIMRUNTIME/defaults.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21if has("vms")
22 set nobackup " do not keep a backup file, use versions instead
23else
Bram Moolenaar76756882014-02-05 22:02:01 +010024 set backup " keep a backup file (restore to previous version)
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020025 if has('persistent_undo')
26 set undofile " keep an undo file (undo changes after closing)
27 endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000028endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
Bram Moolenaar071d4272004-06-13 20:20:40 +000030if &t_Co > 2 || has("gui_running")
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020031 " Switch on highlighting the last used search pattern.
Bram Moolenaar071d4272004-06-13 20:20:40 +000032 set hlsearch
33endif
34
Bram Moolenaar314dd792019-02-03 15:27:20 +010035" Put these in an autocmd group, so that we can delete them easily.
36augroup vimrcEx
Bram Moolenaar071d4272004-06-13 20:20:40 +000037 au!
38
39 " For all text files set 'textwidth' to 78 characters.
40 autocmd FileType text setlocal textwidth=78
Bram Moolenaar314dd792019-02-03 15:27:20 +010041augroup END
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000042
Bram Moolenaaraedfcbe2016-03-25 17:02:51 +010043" Add optional packages.
44"
45" The matchit plugin makes the % command work better, but it is not backwards
46" compatible.
Bram Moolenaar24a98a02017-09-27 22:23:55 +020047" The ! means the package won't be loaded right away but when plugins are
48" loaded during initialization.
Bram Moolenaar802a0d92016-06-26 16:17:58 +020049if has('syntax') && has('eval')
Bram Moolenaar24a98a02017-09-27 22:23:55 +020050 packadd! matchit
Bram Moolenaar802a0d92016-06-26 16:17:58 +020051endif