GVIM——简直美如画,有没有!
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
附上vimrc