vi 颜色设置

编辑~./vimrc文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
set nocompatible " Use Vim defaults (much better!)  
set bs=2 " allow backspacing over everything in insert mode
set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

syntax on
set hlsearch
set incsearch
set tabstop=4
set autoindent
set cindent
set confirm
set number
set expandtab
set autoindent
set smartindent
filetype indent on
if v:lang =~ "utf8" || v:lang =~ "UTF-8"
set fileencodings=utf-8,latin1
endif
set syn=cpp

" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
if line("'"") > 0 && line ("'"") <= line("{1") |
exe "normal! g'"" |
endif
endif

if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
syntax on
set hlsearch

if &term=="xterm"
set t_Co=8
set t_Sb=m
set t_Sf=m
endif
set tags=tags
se cursorline
se cursorcolumn
hi cursorline cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
hi cursorcolumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white