1 | " An example for a vimrc file.
|
---|
2 | "
|
---|
3 | " Maintainer: Bram Moolenaar <Bram@vim.org>
|
---|
4 | " Last change: 2002 Sep 19
|
---|
5 | "
|
---|
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.
|
---|
13 | if v:progname =~? "evim"
|
---|
14 | finish
|
---|
15 | endif
|
---|
16 |
|
---|
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
|
---|
20 |
|
---|
21 | " allow backspacing over everything in insert mode
|
---|
22 | set backspace=indent,eol,start
|
---|
23 |
|
---|
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
|
---|
33 |
|
---|
34 | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
|
---|
35 | " let &guioptions = substitute(&guioptions, "t", "", "g")
|
---|
36 |
|
---|
37 | " Don't use Ex mode, use Q for formatting
|
---|
38 | map Q gq
|
---|
39 |
|
---|
40 | " This is an alternative that also works in block mode, but the deleted
|
---|
41 | " text is lost and it only works for putting the current register.
|
---|
42 | "vnoremap p "_dp
|
---|
43 |
|
---|
44 | :if &term =~ "xterm" || &term =~ "minix"
|
---|
45 | : if has("terminfo")
|
---|
46 | : set t_Co=8
|
---|
47 | : set t_Sf=[3%p1%dm
|
---|
48 | : set t_Sb=[4%p1%dm
|
---|
49 | : else
|
---|
50 | : set t_Co=8
|
---|
51 | : set t_Sf=[3%dm
|
---|
52 | : set t_Sb=[4%dm
|
---|
53 | : endif
|
---|
54 | :endif
|
---|
55 |
|
---|
56 | " Switch syntax highlighting on, when the terminal has colors
|
---|
57 | " Also switch on highlighting the last used search pattern.
|
---|
58 | if &t_Co > 2 || has("gui_running")
|
---|
59 | syntax on
|
---|
60 | set hlsearch
|
---|
61 | endif
|
---|
62 |
|
---|
63 | " Only do this part when compiled with support for autocommands.
|
---|
64 | if has("autocmd")
|
---|
65 |
|
---|
66 | " Enable file type detection.
|
---|
67 | " Use the default filetype settings, so that mail gets 'tw' set to 72,
|
---|
68 | " 'cindent' is on in C files, etc.
|
---|
69 | " Also load indent files, to automatically do language-dependent indenting.
|
---|
70 | filetype plugin indent on
|
---|
71 |
|
---|
72 | " Put these in an autocmd group, so that we can delete them easily.
|
---|
73 | augroup vimrcEx
|
---|
74 | au!
|
---|
75 |
|
---|
76 | " For all text files set 'textwidth' to 78 characters.
|
---|
77 | autocmd FileType text setlocal textwidth=78
|
---|
78 |
|
---|
79 | " When editing a file, always jump to the last known cursor position.
|
---|
80 | " Don't do it when the position is invalid or when inside an event handler
|
---|
81 | " (happens when dropping a file on gvim).
|
---|
82 | autocmd BufReadPost *
|
---|
83 | \ if line("'\"") > 0 && line("'\"") <= line("$") |
|
---|
84 | \ exe "normal g`\"" |
|
---|
85 | \ endif
|
---|
86 |
|
---|
87 | augroup END
|
---|
88 |
|
---|
89 | else
|
---|
90 |
|
---|
91 | set autoindent " always set autoindenting on
|
---|
92 |
|
---|
93 | endif " has("autocmd")
|
---|