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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"=================================================="
" encoding setting
"=================================================="
set encoding=utf8
set fileencodings=utf8,gbk,cp936,gb18030,big5

"=================================================="
" filetype setting
"=================================================="
syntax on
filetype on
filetype plugin on
filetype plugin indent on

"=================================================="
" editor layout
"=================================================="
set nocompatible
set shiftwidth=4
set tabstop=4
set softtabstop=4
set background=dark
set cindent
set ruler
set hls
set ic
set nu
set ai

"=================================================="
" plugin mapping and setting
"=================================================="
" taglist mapping
nnoremap <F12> :TlistToggle<CR>
" NERDtree mapping
nmap <F6> :NERDTreeToggle<CR>
" quickfix mapping
map <F7> :make<CR>
map <F8> <ESC>:call QFSwitch()<CR>
map <S-F8> <ESC>:colder<CR>
map <C-F8> <ESC>:cnewer<CR>
map <C-n> <ESC>:cnext<CR>
map <C-p> <ESC>:cprev<CR>
function! QFSwitch()
redir => ls_output
execute ':silent! ls'
redir END
let exists = match(ls_output, "[Quickfix List")
if exists == -1
execute ':copen'
else
execute ':cclose'
endif
endfunction
" code complete popout color setting
highlight Pmenu ctermfg=0 ctermbg=2
highlight PmenuSel ctermfg=0 ctermbg=7
highlight PmenuSbar ctermfg=7 ctermbg=0
highlight PmenuThumb ctermfg=0 ctermbg=7

"=================================================="
" omnicomplete omnifunc setting
"=================================================="
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1

"=================================================="
" syntax and snipMate filetype setting
"=================================================="
" cross link between php and html
augroup php
autocmd BufRead,BufNewFile *.php set filetype=php.html
autocmd BufRead,BufNewFile *.html set filetype=html.php
augroup END
" link lex to c
augroup lex
autocmd BufRead,BufNewFile *.l set filetype=lex.c
augroup END
" cuda to cpp
augroup cuda
autocmd BufRead,BufNewFile *.cu set filetype=c.cpp
augroup END