Fix ":set go+=c" and menu autoenabling bugs.
[MacVim/jjgod.git] / runtime / vimrc_example.vim
blobeaf3fd6baead91a792433ad0ea2cb308f4d0ad05
1 " An example for a vimrc file.
3 " Maintainer:   Bram Moolenaar <Bram@vim.org>
4 " Last change:  2006 Nov 16
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
12 " When started as "evim", evim.vim will already have done these settings.
13 if v:progname =~? "evim"
14   finish
15 endif
17 " Use Vim settings, rather then Vi settings (much better!).
18 " This must be first, because it changes other options as a side effect.
19 set nocompatible
21 " allow backspacing over everything in insert mode
22 set backspace=indent,eol,start
24 if has("vms")
25   set nobackup          " do not keep a backup file, use versions instead
26 else
27   set backup            " keep a backup file
28 endif
29 set history=50          " keep 50 lines of command line history
30 set ruler               " show the cursor position all the time
31 set showcmd             " display incomplete commands
32 set incsearch           " do incremental searching
34 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
35 " let &guioptions = substitute(&guioptions, "t", "", "g")
37 " Don't use Ex mode, use Q for formatting
38 map Q gq
40 " In many terminal emulators the mouse works just fine, thus enable it.
41 set mouse=a
43 " Switch syntax highlighting on, when the terminal has colors
44 " Also switch on highlighting the last used search pattern.
45 if &t_Co > 2 || has("gui_running")
46   syntax on
47   set hlsearch
48 endif
50 " Only do this part when compiled with support for autocommands.
51 if has("autocmd")
53   " Enable file type detection.
54   " Use the default filetype settings, so that mail gets 'tw' set to 72,
55   " 'cindent' is on in C files, etc.
56   " Also load indent files, to automatically do language-dependent indenting.
57   filetype plugin indent on
59   " Put these in an autocmd group, so that we can delete them easily.
60   augroup vimrcEx
61   au!
63   " For all text files set 'textwidth' to 78 characters.
64   autocmd FileType text setlocal textwidth=78
66   " When editing a file, always jump to the last known cursor position.
67   " Don't do it when the position is invalid or when inside an event handler
68   " (happens when dropping a file on gvim).
69   autocmd BufReadPost *
70     \ if line("'\"") > 0 && line("'\"") <= line("$") |
71     \   exe "normal! g`\"" |
72     \ endif
74   augroup END
76 else
78   set autoindent                " always set autoindenting on
80 endif " has("autocmd")
82 " Convenient command to see the difference between the current buffer and the
83 " file it was loaded from, thus the changes you made.
84 command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
85                 \ | wincmd p | diffthis