centos 的位置在:/etc/vimrc
1 if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
2 set fileencodings=ucs-bom,utf-8,latin1
3 endif
4 syn on
5 set number
6 set nocompatible " Use Vim defaults (much better!)
7 set bs=indent,eol,start " allow backspacing over everything in insert mode
8 "set ai " always set autoindenting on
9 "set backup " keep a backup file
10 set viminfo='20,\"50 " read/write a .viminfo file, don't store more
11 " than 50 lines of registers
12 set history=50 " keep 50 lines of command line history
13 set ruler " show the cursor position all the time
14 set listchars=tab:>-,trail:-
15 highlight WhitespaceEOL ctermbg=red guibg=red
16 match WhitespaceEOL /\s\+$/
17 " Only do this part when compiled with support for autocommands
18 if has("autocmd")
19 augroup redhat
20 autocmd!
21 " In text files, always limit the width of text to 78 characters
22 autocmd BufRead *.txt set tw=78
23 " When editing a file, always jump to the last cursor position
24 autocmd BufReadPost *
25 \ if line("'\"") > 0 && line ("'\"") <= line("$") |
26 \ exe "normal! g'\"" |
27 \ endif
28 " don't write swapfile on most commonly used directories for NFS mounts or USB sticks
29 autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
30 " start with spec file template
31 autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
32 augroup END
33 endif
34
35 if has("cscope") && filereadable("/usr/bin/cscope")
36 set csprg=/usr/bin/cscope
37 set csto=0
38 set cst
39 set nocsverb
40 " add any database in current directory
41 if filereadable("cscope.out")
42 cs add cscope.out
43 " else add database pointed to by environment
44 elseif $CSCOPE_DB != ""
45 cs add $CSCOPE_DB
46 endif
47 set csverb
48 endif
49
50 " Switch syntax highlighting on, when the terminal has colors
51 " Also switch on highlighting the last used search pattern.
52 if &t_Co > 2 || has("gui_running")
53 syntax on
54 set hlsearch
55 endif