blob: a68ebe53d352a9697c41e4d8e7a29c4a9c17bf59 [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 Moolenaar24a98a02017-09-27 22:23:55 +02004" Last change: 2017 Sep 20
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
12" When started as "evim", evim.vim will already have done these settings.
13if v:progname =~? "evim"
14 finish
15endif
16
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020017" Get the defaults that most users want.
18source $VIMRUNTIME/defaults.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20if has("vms")
21 set nobackup " do not keep a backup file, use versions instead
22else
Bram Moolenaar76756882014-02-05 22:02:01 +010023 set backup " keep a backup file (restore to previous version)
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020024 if has('persistent_undo')
25 set undofile " keep an undo file (undo changes after closing)
26 endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000027endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
Bram Moolenaar071d4272004-06-13 20:20:40 +000029if &t_Co > 2 || has("gui_running")
Bram Moolenaar8c08b5b2016-07-28 22:24:15 +020030 " Switch on highlighting the last used search pattern.
Bram Moolenaar071d4272004-06-13 20:20:40 +000031 set hlsearch
32endif
33
34" Only do this part when compiled with support for autocommands.
35if has("autocmd")
36
Bram Moolenaar071d4272004-06-13 20:20:40 +000037 " Put these in an autocmd group, so that we can delete them easily.
38 augroup vimrcEx
39 au!
40
41 " For all text files set 'textwidth' to 78 characters.
42 autocmd FileType text setlocal textwidth=78
43
Bram Moolenaar071d4272004-06-13 20:20:40 +000044 augroup END
45
46else
47
48 set autoindent " always set autoindenting on
49
50endif " has("autocmd")
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000051
Bram Moolenaaraedfcbe2016-03-25 17:02:51 +010052" Add optional packages.
53"
54" The matchit plugin makes the % command work better, but it is not backwards
55" compatible.
Bram Moolenaar24a98a02017-09-27 22:23:55 +020056" The ! means the package won't be loaded right away but when plugins are
57" loaded during initialization.
Bram Moolenaar802a0d92016-06-26 16:17:58 +020058if has('syntax') && has('eval')
Bram Moolenaar24a98a02017-09-27 22:23:55 +020059 packadd! matchit
Bram Moolenaar802a0d92016-06-26 16:17:58 +020060endif