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 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
| """"""""""""""""""""""""""""""""""""""""""""""""""
set tags=~/.vim/tagfiles/stl_tags set tags+=~/.vim/tagfiles/systags set tags+=~/.vim/tagfiles/opengl_tags set tags+=./tags,./../tags,./**/tags
map :w:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
:run macros/gdb_mappings.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! MySys() if has("win32") return "windows" else return "linux" endif endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set nocompatible
set history=700
filetype plugin on filetype indent on
set autoread
let mapleader = "," let g:mapleader = ","
nmap w :w!
nmap m :w:make
map ss :source $HOME/.vimrc
map ee :e $HOME/.vimrc
set langmenu=zh_CN.UTF-8 language messages zh_CN.utf-8
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set so=5 set wildmenu set ruler set cmdheight=2 set hid
set backspace=eol,start,indent set whichwrap+=,h,l
set ignorecase set smartcase
set hlsearch set incsearch set nolazyredraw set magic set showmatch set mat=2 set showcmd
set noerrorbells set novisualbell set t_vb= set tm=500
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" syntax enable
winpos 130 20 set lines=37 columns=150
if MySys() == "mac" set gfn=Menlo:h14 set shell=/bin/bash elseif MySys() == "windows" set gfn=Bitstream\ Vera\ Sans\ Mono:h10 elseif MySys() == "linux" set gfn=Ubuntu\ Mono\ 12 set shell=/bin/bash endif
if has("gui_running") set guioptions-=T set t_Co=256 set background=dark colorscheme peaksea set nu else colorscheme zellner set background=dark set nonu endif
set encoding=utf8 try lang en_US catch endtry
let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936 set fenc=utf-8 set fencs=utf-8,gb18030,gbk,gb2312,cp936,ucs-bom,euc-jp set ffs=unix,dos,mac
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set expandtab set shiftwidth=4 set tabstop=4 set smarttab
set lbr set tw=500
set ai set si set wrap
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map :noh
map j map k map h map l
map bd :Bclose
map ba :1,300 bd!
map :bn map :bp
map tn :tabnew map te :tabedit map tc :tabclose map tm :tabmove
map cd :cd %:p:h
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
set laststatus=2
set statusline=\ %{HasPaste()}%t%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c\ %=[%{GitBranch()}] "set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ [%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]\ %=[%{GitBranch()}]“
function! CurDir() let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g") return curdir endfunction
function! HasPaste() if &paste return 'PASTE MODE ' else return '' endif endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" vnoremap $1 `>a)` vnoremap $2 `>a]` vnoremap $3 `>a}` vnoremap $$ `>a vnoremap $q `>a'` vnoremap $e `>a"`
" Map auto complete of (, ", ', [ inoremap $1 ()i inoremap $2 []i inoremap $3 {}i inoremap $4 {o}O inoremap $q ''i inoremap $e ""i inoremap $t <>i
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" iab xdate =strftime("%d/%m/%y %H:%M:%S")
autocmd BufEnter * lcd %:p:h
if has("autocmd") filetype plugin indent on augroup vimrcEx au! autocmd FileType text setlocal textwidth=78 autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") Git Vim configuration "“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_enable_auto_select=1
let g:winManagerWindowLayout='FileExplorer|TagList' nmap wm :WMToggle
"cscope的主要功能是通过同的子命令"find "cscope find"的用法:
set cscopequickfix=s-,c-,d-,i-,t-,e- map :call Do_CsTag() nmap s :cs find s =expand(""):copen nmap g :cs find g =expand("") nmap c :cs find c =expand(""):copen nmap t :cs find t =expand(""):copen nmap e :cs find e =expand(""):copen nmap f :cs find f =expand(""):copen nmap i :cs find i ^=expand("")$:copen nmap d :cs find d =expand(""):copen function Do_CsTag() let dir = getcwd() if filereadable("tags") if(g:iswindows==1) let tagsdeleted=delete(dir."\\"."tags else let tagsdeleted=delete("./"."tags") endif if(tagsdeleted!=0) echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None return endif endif if has("cscope") silent! execute "cs kill -1" endif if filereadable("cscope.files") if(g:iswindows==1) let csfilesdeleted=delete(dir."\\"."cscope.files else let csfilesdeleted=delete("./"."cscope.files") endif if(csfilesdeleted!=0) echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None return endif endif if filereadable("cscope.out") if(g:iswindows==1) let csoutdeleted=delete(dir."\\"."cscope.out else let csoutdeleted=delete("./"."cscope.out") endif if(csoutdeleted!=0) echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None return endif endif if(executable('ctags')) "silent! execute "!ctags -R --c-types=+p --fields=+S * silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ." endif if(executable('cscope') && has("cscope") ) if(g:iswindows!=1) silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' > cscope.files" else silent! execute "!dir /s/b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files" endif silent! execute "!cscope -b" execute "normal :" if filereadable("cscope.out") execute "cs add cscope.out" endif endif endfunction
map :silent! Tlist let Tlist_Ctags_Cmd='ctags' let Tlist_Use_Right_Window=0 let Tlist_Show_One_File=0 let Tlist_File_Fold_Auto_Close=1 let Tlist_Exit_OnlyWindow=1 let Tlist_Process_File_Always=0 let Tlist_Inc_Winwidth=0
let g:miniBufExplMapCTabSwitchBufs=1
"C-w,h j k l 向"左,下,上,右
let g:miniBufExplorerMoreThanOne=0
nnoremap :Grep
"如果是gvim, 直接在代码上按下Ctrl+F2, 如果是vim, 用"mm
"按下"Ctrl+X Ctrl+O
let OmniCpp_NamespaceSearch = 1 let OmniCpp_GlobalScopeSearch = 1 let OmniCpp_ShowAccess = 1 let OmniCpp_ShowPrototypeInAbbr = 1 let OmniCpp_MayCompleteDot = 1 let OmniCpp_MayCompleteArrow = 1 let OmniCpp_MayCompleteScope = 1 let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
set completeopt=menuone,menu,longest
"let g:SuperTabDefaultCompletionType="
" Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++
map fg : Dox let g:DoxygenToolkit_authorName="Cedric Porter" let g:DoxygenToolkit_licenseTag="GPL v4 \" let g:DoxygenToolkit_undocTag="DOXIGEN_SKIP_BLOCK" let g:DoxygenToolkit_briefTag_pre = "@brief\t" let g:DoxygenToolkit_paramTag_pre = "@param\t" let g:DoxygenToolkit_returnTag = "@return\t" let g:DoxygenToolkit_briefTag_funcName = "no" let g:DoxygenToolkit_maxFunctionProtoLines = 30
map :call StartPython() function StartPython() :w :!python %:t endfunction
let NERDChristmasTree=1
let NERDTreeAutoCenter=1 let NERDTreeShowHidden=1 map : NERDTreeToggle map : NERDTreeClose
|