1 "========================================== 2 " Author: wklken 3 " Version: 9.1 4 " Email: wklken@yeah.net 5 " BlogPost: http://www.wklken.me 6 " ReadMe: README.md 7 " Donation: http://www.wklken.me/pages/donation.html 8 " Last_modify: 2015-12-15 9 " Sections: 10 " -> Initial Plugin 加載插件 11 " -> General Settings 基礎設置 12 " -> Display Settings 展現/排版等界面格式設置 13 " -> FileEncode Settings 文件編碼設置 14 " -> Others 其它配置 15 " -> HotKey Settings 自定義快捷鍵 16 " -> FileType Settings 針對文件類型的設置 17 " -> Theme Settings 主題設置 18 " 19 " -> 插件配置和具體設置在vimrc.bundles中 20 "========================================== 21 22 colorscheme molokai 23 24 "========================================== 25 " Initial Plugin 加載插件 26 "========================================== 27 " 開啓語法高亮 28 syntax on 29 30 " install bundles 31 if filereadable(expand("~/.vimrc.bundles")) 32 source ~/.vimrc.bundles 33 endif 34 35 " ensure ftdetect et al work by including this after the bundle stuff 36 filetype plugin indent on 37 38 " NOTE: 如下配置有詳細說明,一些特性不喜歡能夠直接註解掉 39 40 "========================================== 41 " General Settings 基礎設置 42 "========================================== 43 44 45 " history存儲容量 46 set history=2000 47 48 " 檢測文件類型 49 filetype on 50 " 針對不一樣的文件類型採用不一樣的縮進格式 51 filetype indent on 52 " 容許插件 53 filetype plugin on 54 " 啓動自動補全 55 filetype plugin indent on 56 57 " 突出顯示當前列 58 "set cursorcolumn 59 " 突出顯示當前行 60 set cursorline 61 62 " 設置 退出vim後,內容顯示在終端屏幕, 能夠用於查看和複製, 不須要能夠去掉 63 " 好處:誤刪什麼的,若是之前屏幕打開,能夠找回 64 "set t_ti= t_te= 65 66 "========================================== 67 " Display Settings 展現/排版等界面格式設置 68 "========================================== 69 70 " 顯示當前的行號列號 71 set ruler 72 " 在狀態欄顯示正在輸入的命令 73 set showcmd 74 " 左下角顯示當前vim模式 75 set showmode 76 77 " 顯示行號 78 set number 79 " 取消換行 80 set nowrap 81 82 " 括號配對狀況, 跳轉並高亮一下匹配的括號 83 set showmatch 84 " How many tenths of a second to blink when matching brackets 85 set matchtime=2 86 87 88 " 設置文內智能搜索提示 89 " 高亮search命中的文本 90 set hlsearch 91 " 打開增量搜索模式,隨着鍵入即時搜索 92 set incsearch 93 " 搜索時忽略大小寫 94 set ignorecase 95 " 有一個或以上大寫字母時仍大小寫敏感 96 set smartcase 97 98 " 代碼摺疊 99 set foldenable 100 " 摺疊方法 101 " manual 手工摺疊 102 " indent 使用縮進表示摺疊 103 " expr 使用表達式定義摺疊 104 " syntax 使用語法定義摺疊 105 " diff 對沒有更改的文本進行摺疊 106 " marker 使用標記進行摺疊, 默認標記是 {{{ 和 }}} 107 set foldmethod=indent 108 set foldlevel=99 109 110 " 縮進配置 111 " Smart indent 112 set smartindent 113 " 打開自動縮進 114 " never add copyindent, case error " copy the previous indentation on autoindenting 115 set autoindent 116 117 " tab相關變動 118 " 設置Tab鍵的寬度 [等同的空格個數] 119 set tabstop=4 120 " 每一次縮進對應的空格數 121 set shiftwidth=4 122 " 按退格鍵時能夠一次刪掉 4 個空格 123 set softtabstop=4 124 " insert tabs on the start of a line according to shiftwidth, not tabstop 按退格鍵時能夠一次刪掉 4 個空格 125 set smarttab 126 " 將Tab自動轉化成空格[須要輸入真正的Tab鍵時,使用 Ctrl+V + Tab] 127 set expandtab 128 " 縮進時,取整 use multiple of shiftwidth when indenting with '<' and '>' 129 set shiftround 130 131 " A buffer becomes hidden when it is abandoned 132 set hidden 133 set wildmode=list:longest 134 set ttyfast 135 136 137 "========================================== 138 " others 其它設置 139 "========================================== 140 " vimrc文件修改以後自動加載, windows 141 autocmd! bufwritepost _vimrc source % 142 " vimrc文件修改以後自動加載, linux 143 autocmd! bufwritepost .vimrc source % 144 145 " 自動補全配置 146 " 讓Vim的補全菜單行爲與通常IDE一致(參考VimTip1228) 147 set completeopt=longest,menu 148 149 " 打開自動定位到最後編輯的位置, 須要確認 .viminfo 當前用戶可寫 150 if has("autocmd") 151 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 152 endif 153 154 autocmd StdinReadPre * let s:std_in=1 155 "========================================== 156 " omnicppcomplete插件 157 "========================================== 158 set nocp 159 set tags+=/home/yk/.vim/tags/cpp 160 let OmniCpp_GlobalScopeSearch = 1 161 let OmniCpp_NamespaceSearch = 1 162 let OmniCpp_DisplayMode = 0 163 let OmniCpp_ShowPrototypeInAbbr = 1 164 let OmniCpp_ShowAccess = 1 165 let OmniCpp_DefaultNamespaces = ["std"] 166 let OmniCpp_MayCompleteDot = 1 167 let OmniCpp_MayCompleteArrow = 1 168 let OmniCpp_MayCompleteScope = 1 169 let OmniCpp_SelectFirstItem = 1 170 au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif 171 set completeopt=menuone,menu,longest,preview 172 hi Pmenu guibg=#708090 guifg=#000000 173 hi PmenuSel guibg=#2F4F4F 174 175 "========================================== 176 " NERD_Tree插件 177 "========================================== 178 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree 179 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 180 let NERDTreeSortOrder=['//$','/.cpp$','/.c$', '/.h$', '/.py$', '/.lua$', '*'] 181 let NERDTreeCaseSensitiveSort=0 182 let NERDTreeWinSize=34 183 let NERDTreeShowLineNumbers=1 184 let NERDTreeShowBookmarks=1 185 let NERDTreeDirArrows=1 186 let NERDTreeChDirMode=2 187 let NERDChristmasTree=1 188 let NERDTreeMouseMode=2 189 let NERDTreeHighlightCursorline=1 190 191 "========================================== 192 " taglist_46插件 193 "========================================== 194 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | TlistToggle 195 autocmd bufenter * if (winnr("$") == 1 && exists("b:TlistToggle") && b:TlistToggle == "primary") | q | endif 196 let Tlist_Auto_Open=1 197 let Tlist_Show_One_File=1 198 let Tlist_Exit_OnlyWindow=1 199 let Tlist_Use_Right_Window = 1 200 let Tlist_WinWidth=36 201 202 "========================================== 203 " MiniBufExplorer插件 204 "========================================== 205 let g:miniBufExplMapWindowNavVim = 1 206 let g:miniBufExplMapWindowNavArrows = 1 207 let g:miniBufExplMapCTabSwitchBufs = 1 208 let g:miniBufExplModSelTarget = 1 209 let g:miniBufExplMoreThanOne=0 210 211 "========================================== 212 " SuperTab插件 213 "========================================== 214 let g:SuperTabDefaultCompletionType="context" 215 216 "========================================== 217 " Winmanager插件 218 "========================================== 219 "autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | WMToggle 220 "autocmd bufenter * if (winnr("$") == 1 && exists("b:WMToggle") && b:WMToggle == "primary") | q | endif 221 222 let g:AutoOpenWinManager = 1 223 let g:NERDTree_title="[Explorer]" 224 let g:winManagerWindowLayout = "NERDTree" 225 226 let g:winManagerWidth=34 227 let g:defaultExplorer=1 228 229 function! NERDTree_Start() 230 exec 'NERDTree' 231 endfunction 232 233 function! NERDTree_IsValid() 234 return 1 235 endfunction
附上vimrchtml