强烈拥护开源精神,高举开源大旗,今天我就分享下我自己结合网上还有自己实际使用配的vimrc,可以给各位参考下,不要见笑哈,具体说明我在rc里写的也很详细,可以具体看下,也希望可以借这个机会能多认识认识几个Vimer们
"======================================== " File Name: .vimrc " Author: Jin Yuqi " Email: [email protected] " 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
时间: 2024-10-12 13:35:50