大力支持开源精神。保持开源大旗,今天,我将分享我自己以及结合自己的实际使用互联网的vimrc,我可以给你下的参考,不要见笑哈,说明我rc我写了一个非常详细,可以看看详细。同时,我们也希望借此机会结识了几个Vimer他们.

    PS: 比方说转移工作环境或者切换主机,比較便捷到做法就是安装好vim之后,一遍​​git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle​ ​,将vundle插件装好之后,一阵BundleInstall,就可以完美切换到你曾经使用到Vim环境。十分方便。另外主题下载之后复制到.vim/colors之后就可以适配。地址在.vimrc内部,还有monaco字体配置能够直接git clone https://github.com/jiyinyiyong/monaco-font.git/

    

"========================================
" File Name: .vimrc
" Author: Jin Yuqi
" Email: 179386223@qq.com
" Description: Vim配置文档
" Date: 2014.5.30
"========================================

let mapleader = '\'
let g:mapleader = '\'

" 关闭vi的一致性模式,避免曾经版本号的一些Bug和局限
set nocompatible

" 显示行号
set number

" 设置字体
set gfn=Monaco\ 12

" 设置主题颜色
colorscheme molokai

" 配色打开
syntax on

" 开启语法高亮
syntax enable

" 设置历史记录条数
set history=1000

" 设置取消备份,禁止暂时文件生成
set nobackup
set noswapfile

" 显示当前横竖线
"set cursorline
"set cursorcolumn

" 设置C/C++方式自己主动对齐
set autoindent
set cindent
set smartindent

" 设置搜索时忽略大写和小写
set ignorecase
" 当搜索的时候尝试smart
set smartcase

" 设置在Vim中能够使用鼠标,防止终端无法拷贝
set mouse=a

" 设置tab宽度
set tabstop=4

" 设置自己主动对齐空格数
set shiftwidth=4

" 设置编码方式
set encoding=utf-8

" 检測文件类型
filetype on

" 针对不同的文件,採用不同的缩进方式
filetype indent on

" 同意插件
filetype plugin on

" 设置打开文件的编码格式
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

" 开启及时搜索(is)
set incsearch

" 设置搜索高亮(hlsearch)
set hls

" 总是显示状态栏(Powerline需要2行)
set laststatus=2

" 设置代码匹配,包括括号匹配情况
set showmatch

" 设置匹配跳转时间(1/10秒)
"set mat=2

" 编辑的时候将全部的tab设置为空格(expandtab)
set et

" 使用Backspace直接删除tab
set smarttab

" 不在单词中间折行
set lbr

" 加入水平滚动栏
"set guioptions+=b

" 指定不折行
set nowrap

" 取消菜单条和导航栏
set guioptions-=m
set guioptions-=T

" 设置水平行数和竖直列数
set lines=35
set columns=99

" 使pathogen生效(插件管理器,仅仅需将插件放入bundle,将pathogen.vim放入autoload就可以)
"execute pathogen#infect()


""""""""""Vundle settings""""""""""""
" set nocompatible
filetype off " Vundle必需要求使用filetype off,假设不设置该选项。UltiSnips无法使用
set rtp+=~/.vim/bundle/vundle
call vundle#rc()

" let Vundle manage Vundle
" required
Bundle 'gmarik/vundle'

" My bundles here:
" original repos on GitHub
"Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
" 补全if,else,while,for,while等
Bundle 'SirVer/ultisnips'
Bundle 'scrooloose/nerdtree'

" 对括号等进行光标的控制辅助

"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"Bundle 'tpope/vim-rails.git'
Bundle 'scrooloose/syntastic'
Bundle 'Valloric/YouCompleteMe'
Bundle 'Valloric/ListToggle'
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'majutsushi/tagbar'
Bundle 'Lokaltog/vim-powerline'
Bundle 'kien/ctrlp.vim'
" vim-scripts repos
Bundle 'taglist.vim'
Bundle 'a.vim'
"Bundle 'easytags.vim'
"Bundle 'c.vim'
" non-GitHub repos
"Bundle 'git://git.wincent.com/command-t.git'
" Git repos on your local machine (i.e. when working on your own plugin)
"Bundle 'file:///Users/gmarik/path/to/plugin'

filetype on " 打开此选项以让UltiSnips使用

" TagList settings
" increase the width of the taglist window
"let Tlist_WinWidth=20
" 自己主动打开TagList的window
let Tlist_Auto_Open=0
" 当仅仅剩下Tlist的时候自己主动关闭
let Tlist_Exit_OnlyWindow=1
" 打开tags用单击
let Tlist_Use_SingleClick=1
" close tag folders for inactive buffers
let Tlist_File_Fold_Auto_Close=1
" show the fold indiactor column in the taglist window
let Tlist_Enable_Fold_Column=1
" 自己主动更新TagList包括最新编辑的文件
let Tlist_Auto_Update=1
" 显示一个文件的tag
let Tlist_Show_One_File=1
" 在右側显示窗体
let Tlist_Use_Right_Window=1
" 依照名称排序
let Tlist_Sort_Type="name"
" 让TagList始终解释文件里的tag,无论TagList窗体有没有打开
let Tlist_Process_File_Always=1
" 设置leader键
nnoremap <leader>tl :TlistToggle<CR>

" YCM settings
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_collect_indentifiers_from_tags_files=1
let g:ycm_seed_identifiers_with_syntax=1
" 避免YCM每次载入都对用户提示是否载入
let g:ycm_confirm_extra_conf=0
let g:ycm_autoclose_preview_window_after_completion=1
" 跳到定义或声明
nnoremap <F2> :YcmCompleter GoToDefinitionElseDeclaration<CR>
" 强制进行编译
nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>

""""""""""Syntastic settings""""""""""""
" 在打开文件的时候检查
let g:syntastic_check_on_open = 1
let g:syntastic_cpp_include_dirs = ['/usr/include/']
let g:syntastic_cpp_remove_include_errors = 1
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libstdc++'
"set error or warning signs
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '⚠'
"whether to show balloons
let g:syntastic_enable_balloons = 1
let g:syntastic_always_populate_loc_list = 1

" ListToggle settings
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'

"""""""""" NERDtree settings"""""""""""""""
let NERDTreeWinPos='left'
nnoremap <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif

""""""""""FuzzyFinder settings""""""""""
nnoremap <leader>f :FufFile<CR>
nnoremap <leader>b :FufBuffer<CR>
nnoremap <leader>d :FufDir<CR>

""""""""""UltiSnips settings""""""""""""""""""""""
let g:UltiSnipsExpandTrigger = '<c-l>'

""""""""""Tagbar settings""""""""""""""""""""""
nnoremap <leader>tb :Tagbar<CR>

""""""""""A settings""""""""""""""""""""""
nnoremap <F4> :A<CR>

""""""""""Powerline settings""""""""""""""""""""""
"let g:Powerline_symbols = 'fancy'
"let g:Powerline_cache_enabled = 1

" Test
let g:session_autoload='yes'
let g:session_autosave='yes'

" 參考链接:
" Molokia GitHub地址 https://github.com/tomasr/molokai
" amix vimrc模板地址参考:amix.dk/vim/vimrc.html