1 execute pathogen#infect() 2 syntax on 3 set cindent " 使用 C/C++ 语言的自动缩进方式" 4 set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s "设置C/C++语言的具体缩进方式")} 5 set shiftwidth=4 " (自动) 缩进使用的4个空格" 6 set nu 7 set tabstop=4 8 set nobackup 9 set cursorline 10 "set cursorcolumn 11 set autoindent 12 set ruler 13 set mouse=a 14 set showmatch 15 highlight LineNr ctermfg=darkgreen 16 highlight LineNr ctermbg=black 17 18 "设置水平滚动条 19 set guioptions+=b 20 21 map <C-n> :NERDTree<CR> 22 map <C-t> :TlistToggle<CR> 23 map <C-A> ggVG 24 map! <C-A> <Esc>ggVG 25 map <F12> gg=G 26 vmap <C-c> "+y 27 28 let Tlist_Show_One_File=1 " 只展示一个文件的taglist 29 let Tlist_Exit_OnlyWindow=1 " 当taglist是最后以个窗口时自动退出 30 let Tlist_Use_Right_Window=1 " 在右边显示taglist窗口 31 let Tlist_Sort_Type="name" " tag按名字排序 32 33 filetype plugin indent on 34 35 set completeopt=longest,menu 36 let OmniCpp_NamespaceSearch = 2 " search namespaces in the current buffer and in included files 37 let OmniCpp_ShowPrototypeInAbbr = 1 " 显示函数参数列表 38 let OmniCpp_MayCompleteScope = 1 " 输入 :: 后自动补全 39 let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"] 40 41 set tags+=~/.vim/tags/cpp_src/tags 42 43 nnoremap <F9> <Esc>:w<CR>:!g++ -std=c++11 % -o /tmp/a.out && /tmp/a.out<CR> 44 nnoremap <C-F9> <Esc>:w<CR>:!g++ -std=c++11 %<CR> 45 nnoremap <F8> <Esc>:w<CR>:!g++ -std=c++11 -g % -o /tmp/a.out && gdb /tmp/a.out<CR> 46 47 imap <c-> {<cr>}<c-o>O<left><right> 48 map <F2> :call SetTitle()<CR> 49 func SetTitle() 50 let l = 0 51 let l = l + 1 | call setline(l, '#include <iostream>') 52 let l = l + 1 | call setline(l, '#include <cstdio>') 53 let l = l + 1 | call setline(l, '#include <cstring>') 54 let l = l + 1 | call setline(l, '') 55 let l = l + 1 | call setline(l, 'using namespace std;') 56 let l = l + 1 | call setline(l, '') 57 let l = l + 1 | call setline(l, 'int main()') 58 let l = l + 1 | call setline(l, '{') 59 let l = l + 1 | call setline(l, '') 60 let l = l + 1 | call setline(l, ' return 0;') 61 let l = l + 1 | call setline(l, '}') 62 endfunc 63 64 "powerline{ 65 "set guifont=PowerlineSymbols for Powerline 66 "set nocompatible 67 "set t_Co=099 68 "let g:Powerline_symbols='fancy' 69 "} 70 71 set rtp+={repository_root}/powerline/bindings/vim