个人使用vim配置,安装YCM(YouCompleteMe,jedi, vundle等插件),具体的配置如下:
1 execute pathogen#infect() 2 syntax on 3 filetype plugin on 4 5 "{一般设置 6 set fileencodings=utf-8,gbk 7 set ambiwidth=double 8 9 set smartindent 10 set smarttab 11 set expandtab 12 set tabstop=4 13 set softtabstop=4 14 set shiftwidth=4 15 set backspace=2 16 set nu 17 set hls 18 19 "{折叠代码 20 set foldmethod=indent 21 set foldlevel=99 22 nnoremap <space> za 23 "} 24 25 26 "{光标重回上次退出位置 27 autocmd BufReadPost * if line("'"") && line("'"") <= line("$") | exe "normal `"" | endif 28 29 "} 30 31 32 "{ 33 set nocompatible " be iMproved 34 35 filetype off " required! /** 从这行开始,vimrc配置 **/ 36 37 set rtp+=~/.vim/bundle/vundle/ 38 39 call vundle#rc() 40 41 42 43 "let Vundle manage Vundle 44 45 " required! 46 47 Bundle 'gmarik/vundle' 48 49 " My Bundles here: /* 插件配置格式 */ 50 51 "BundleInstall 52 53 " original repos on github (Github网站上非vim-scripts仓库的插件,按下面格式填写) 54 Bundle 'Valloric/YouCompleteMe' 55 Bundle 'honza/vim-snippets' 56 Bundle 'jonathanfilip/lucius' 57 Bundle 'tomasr/molokai' 58 59 "Bundle 'tpope/vim-fugitive' 60 61 "Bundle 'Lokaltog/vim-easymotion' 62 63 "Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} 64 65 "Bundle 'tpope/vim-rails.git' 66 67 " vim-scripts repos (vim-scripts仓库里的,按下面格式填写) 68 69 "Bundle 'L9' 70 71 "Bundle 'FuzzyFinder' 72 " 73 "" non github repos (非上面两种情况的,按下面格式填写) 74 " 75 "Bundle 'git://git.wincent.com/command-t.git' 76 " 77 "" ... 78 79 filetype plugin indent on " required! /** vimrc文件配置结束 **/ 80 "} 81 82 83 84 "{taglist 85 "let Tlist_Auto_Highlight_Tag=1 86 "let Tlist_Auto_Open=1 87 "let Tlist_Auto_Update=1 88 "let Tlist_Display_Tag_Scope=1 89 "let Tlist_Exit_OnlyWindow=1 90 "let Tlist_Enable_Dold_Column=1 91 "let Tlist_File_Fold_Auto_Close=1 92 "let Tlist_Show_One_File=1 93 "let Tlist_Use_Right_Window=1 94 "let Tlist_Use_SingleClick=1 95 "nnoremap <silent> <F8> :TlistToggle<CR> 96 "} 97 98 99 100 let mapleader = "," 101 let g:mapleader = "," 102 autocmd FileType python set omnifunc=pythoncomplete#Complete 103 autocmd FileType python setlocal completeopt-=preview 104 autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS 105 autocmd FileType html set omnifunc=htmlcomplete#CompleteTags 106 autocmd FileType css set omnifunc=csscomplete#CompleteCSS 107 autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags 108 autocmd FileType php set omnifunc=phpcomplete#CompletePHP 109 autocmd FileType c set omnifunc=ccomplete#Complete 110 111 112 let g:pydiction_location='~/.vim/complete-dict' 113 set autoindent 114 set tabstop=4 115 set shiftwidth=4 116 set expandtab 117 set number 118 119 120 "{jedi bundle 121 let g:jedi#auto_initialization = 0 122 let g:jedi#auto_vim_configuration = 0 123 let g:jedi#use_tabs_not_buffers = 1 124 let g:jedi#use_splits_not_buffers = "left" 125 let g:jedi#popup_on_dot = 0 126 let g:jedi#popup_select_first = 0 127 let g:jedi#show_call_signatures = "1" 128 let g:jedi#goto_command = "<leader>d" 129 let g:jedi#goto_assignments_command = "<leader>g" 130 let g:jedi#goto_definitions_command = "" 131 let g:jedi#documentation_command = "K" 132 let g:jedi#usages_command = "<leader>n" 133 let g:jedi#completions_command = "<C-Space>" 134 let g:jedi#rename_command = "<leader>r" 135 let g:jedi#completions_enabled = 0 136 137 "} 138 "{YouCompleteMe 139 let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/clang/testdata/client_data/' "配置默认的ycm_extra_conf.py 140 let g:ycm_error_symbol = '>>' 141 let g:ycm_warning_symbol = '>*' 142 nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR> 143 nnoremap <leader>gf :YcmCompleter GoToDefinition<CR> 144 nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR> 145 nmap <F4> :YcmDiags<CR> 146 "打开vim时不再询问是否加载ycm_extra_conf.py配置 147 let g:ycm_confirm_extra_conf=1 148 "使用ctags生成的tags文件 149 let g:ycm_collect_identifiers_from_tag_files = 1 150 "python with virtualenv support 151 py << EOF 152 import os 153 import sys 154 if 'VIRTUAL_ENV' in os.environ: 155 project_base_dir = os.environ['VIRTUAL_ENV'] 156 activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') 157 execfile(activate_this, dict(__file__=activate_this)) 158 EOF 159 "} 160 " 161 "{界面设置 162 colorscheme desert 163 "colorscheme molokai 164 165 "}