-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
268 lines (228 loc) · 7.43 KB
/
vimrc
File metadata and controls
268 lines (228 loc) · 7.43 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
set nocompatible
"set term=screen-256color
set background=dark
set t_Co=256
set backspace=indent,eol,start
set nobk
set tags=tags;
set history=100 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set ic
syntax on
if &t_Co > 2 || has("gui_running")
"colorscheme office-dark
"colorscheme vrunchbang-light
"colorscheme solarized
"colorscheme freya
colorscheme colorsbox-material
set hlsearch
else
colorscheme colorsbox-material
endif
if has("autocmd")
filetype plugin indent on
augroup vimrcEx
au!
autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
"colorscheme lanzarotta
"colorscheme desertEx
"colorscheme molokai
"syntax enable
"if has('gui_running')
" set background=light
"else
" set background=dark
"endif
"colorscheme solarized
set nu
"let g:NERDTree_title='NERD Tree'
"function! NERDTree_Start()
" exec 'NERDTree'
"endfunction
"
"function! NERDTree_IsValid()
" return 1
"endfunction
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
"let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWindowLayout = 'BufExplorer|FileExplorer, TagsExplorer'
"let g:winManagerWindowLayout = 'BufExplorer'
" 显示/隐藏 MiniBufExplorer 窗口
map <Leader>b :TMiniBufExplorer<cr>
let g:winManagerWidth=35
let g:bufExplorerMaxHeight=50
"let g:miniBufExplorerMoreThanOne=0
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1
nmap wm :WMToggle<cr>
map <c-w><c-f> :FirstExplorerWindow<cr>
map <c-w><c-b> :BottomExplorerWindow<cr>
"let g:miniBufExplMapWindowNavArrows = 1
":set cscopeprg=gtags-cscope
":cs add GTAGS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
endif
"在插入模式下移动光标
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" This is for new-omni-completion
filetype plugin indent on
set completeopt=longest,menu
""""""""""""""""""""""""""""""
" lookupfile setting
" """"""""""""""""""""""""""""""
let g:LookupFile_MinPatLength = 2 "最少输入2个字符才开始查找
let g:LookupFile_PreserveLastPattern = 0 "不保存上次查找的字符串
let g:LookupFile_PreservePatternHistory = 1 "保存查找历史
let g:LookupFile_AlwaysAcceptFirst = 1 "回车打开第一个匹配项目
let g:LookupFile_AllowNewFiles = 0 "不允许创建不存在的文件
if filereadable("./filenametags") "设置tag文件的名字
let g:LookupFile_TagExpr ='"./filenametags"'
endif
nmap <silent> <F6> :LUBufs<CR>
"映射LookupFile为,lk
"nmap <silent> <leader>lk :LUTags<cr>
""映射LUBufs为,ll
"nmap <silent> <leader>ll :LUBufs<cr>
""映射LUWalk为,lw
"nmap <silent> <leader>lw :LUWalk<cr>
" vim insert mode Auto-completion
set wildmenu "显示补全列表
set wildmode=longest:full "补全行为设置
"
" guicolorscheme plugin setup
"
" if (&t_Co == 256 || &t_Co == 88) && !has('gui_running') && filereadable(expand("$HOME/.vim/plugin/guicolorscheme.vim"))
" runtime! plugin/guicolorscheme.vim
" "GuiColorScheme desertEx
" GuiColorScheme freya
"else
" "colorscheme desertEx
" colorscheme freya
"endif
"
"
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
"""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "# File Name: ".expand("%"))
call append(line(".")+1, "# Author: xiaofeng zhang")
call append(line(".")+2, "# mail: xiaofeng.zhang@intel.com")
call append(line(".")+3, "# Created Time:".strftime("%c"))
call append(line(".")+4, "# #########################################################################")
call append(line(".")+5,"#!/bin/bash")
call append(line(".")+6,"")
else
call setline(1, "/*************************************************************************")
call append(line("."), " * File Name: ".expand("%"))
call append(line(".")+1, " * Author: xiaofeng zhang")
call append(line(".")+2, " * Mail: xiaofeng.zhang@intel.com ")
call append(line(".")+3, " * Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
"CtrlP plugin
"It's totally useless and waste my time to use it
"..... -- by xiaofeng, 2016.7. 25
"------------------------
"set runtimepath^=~/.vim/bundle/ctrlp.vim
"
"let g:ctrlp_map = '<leader>p'
"let g:ctrlp_cmd = 'CtrlP'
"map <leader>f :CtrlPMRU<CR>
"set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
"
"let g:ctrlp_custom_ignore = {
" \ 'dir': '\v[\/]\.(git|out|svn)$',
" \ 'file': '\v\.(exe|so|dll)$',
" \ 'link': 'some_bad_symbolic_links',
" \ }
"let g:ctrlp_working_path_mode='raw'
"let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:1000,results:1000'
"let g:ctrlp_match_window_reversed=0
"let g:ctrlp_mruf_max=500
"let g:ctrlp_follow_symlinks=1
"let g:ctrlp_max_files=0
"let g:ctrlp_max_depth = 40
"rainbow_parentheses
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
autocmd VimEnter * RainbowParenthesesToggle
autocmd Syntax * RainbowParenthesesLoadRound
autocmd Syntax * RainbowParenthesesLoadSquare
autocmd Syntax * RainbowParenthesesLoadBraces
nnoremap <F10> :RainbowParenthesesToggle<CR>
execute pathogen#infect()
call pathogen#helptags()