我的vim配置文件

来源:互联网 发布:淘宝口碑好的大码女装 编辑:程序博客网 时间:2024/05/29 15:18
经过一段时间的折腾,我的vim配置文件最终如下:
set nocompatible        " 去掉vi一致性模式""""""""""""""""""""""""""""""""""""""""""""" 使用vundle自动安装插件""""""""""""""""""""""""""""""""""""""""""filetype offif has('win32') || has("win64")    set rtp+=$VIM/vimfiles/bundle/vundle/else    set rtp+=~/.vim/bundle/Vundle.vimendifcall vundle#begin()Bundle 'gmarik/vundle'filetype plugin indent onBundle 'L9'Bundle 'drmingdrmer/xptemplate'Bundle 'christoomey/vim-run-interactive'Bundle 'croaky/vim-colors-github'Bundle 'danro/rename.vim'Bundle 'kchmck/vim-coffee-script'Bundle 'kien/ctrlp.vim'Bundle 'pbrisbin/vim-mkdir'Bundle 'scrooloose/syntastic'Bundle 'slim-template/vim-slim'Bundle 'thoughtbot/vim-rspec'Bundle 'tpope/vim-bundler'Bundle 'tpope/vim-endwise'Bundle 'tpope/vim-fugitive'Bundle 'tpope/vim-rails'Bundle 'tpope/vim-surround'Bundle 'vim-ruby/vim-ruby'Bundle 'vim-scripts/ctags.vim'Bundle 'vim-scripts/matchit.zip'Bundle 'vim-scripts/tComment'Bundle "mattn/emmet-vim"Bundle "scrooloose/nerdtree"Bundle "bling/vim-airline"Bundle "godlygeek/tabular"Bundle "jelera/vim-javascript-syntax"Bundle "othree/html5.vim"Bundle "xsbeats/vim-blade"Bundle "Raimondi/delimitMate"Bundle "groenewege/vim-less"Bundle "evanmiller/nginx-vim-syntax"Bundle "Lokaltog/vim-easymotion"Bundle 'MarcWeber/vim-addon-mw-utils'Bundle 'tomtom/tlib_vim'Bundle 'SirVer/ultisnips'Bundle 'honza/vim-snippets'Bundle 'Shougo/neocomplcache'Bundle 'majutsushi/tagbar'Bundle 'junegunn/vim-easy-align'Bundle 'tomtom/tcomment_vim'Bundle 'terryma/vim-multiple-cursors'Bundle "tomasr/molokai"Bundle "altercation/vim-colors-solarized"call vundle#end()filetype onfiletype indent onfiletype plugin onfiletype plugin indent on"""""""""""""""""""""""""""""""""""""""""""" 设置文件的编码格式以及字体""""""""""""""""""""""""""""""""""""""""""if has("win32") || has("win64")    "set guifont=Consolas:h13    set guifont=DejaVu_Sans_Mono_for_Powerline:h11else    set guifont=DejaVu\ Sans\ Mono\ for\Powerline\ 11endifset encoding=utf-8set fileencodings=utf-8,chinese,latin-lif has("win32")    set fileencoding=chineseelse    set fileencoding=utf-8endifsource $VIMRUNTIME/delmenu.vimsource $VIMRUNTIME/menu.vimlanguage messages zh_CN.utf-8""""""""""""""""""""""""""""""""""""""""""""" 通用设置""""""""""""""""""""""""""""""""""""""""""set guioptions-=T       " 去掉工具栏set number              " 显示行号set history=100         " 记录的命令数syntax enable           " 开启语法高亮syntax on               " 允许指定语法配色set ignorecase          " 搜索时大小写不敏感set smartcase           " 智能大小写模式set wildmenu            " 命令智能补全set incsearch           " 开启实时搜索功能set hlsearch            " 高亮显示搜索结果set lbr                 " 不要再单词中断行set mouse=a             " 启用鼠标set selection=inclusive " 光标位置在选中范围内set clipboard+=unnamed  " 复制到系统粘贴板set ruler               " 显示状态栏set nobackup            " 不进行备份set nowritebackup       " 取消备份文件set dy=lastline         " 显示最多行,不用@@set showmatch           " 显示括号匹配set showcmd             " 显示输入命令set scrolloff=3         " 保持3行距离set sidescrolloff=3     " 边缘时翻页set autowrite           " 自动保存set magic               " 正则表达式相关set showtabline=1       " 显示标签页set autoread            " 文件改动是自动载入set noeb                " 去掉输入错误提示音set vb t_vb=            " 去掉命令错误提示音set mousemodel=popup    " 右键弹出快捷菜单""" tab键和缩进设置set autoindent          " 自动缩进set cindent             " C语法缩进 set smartindent         " 智能缩进set expandtab           " 将tab转为空格set tabstop=4           " 设置tab键位数set shiftwidth=4        " 4空格转为tabset softtabstop=4       " 连续空格转为制表符" 光标移动到最左边或最右边自动折行set whichwrap=b,s,<,>,[,]" 退格键可以折行删除set backspace=indent,eol,start" 输入大括号按下回车使自动格式化imap {<CR> {<CR>}<ESC>k$a<CR>if has('gui_running')    set cursorline      " 高亮显示当前行endifcolo desert             " 设置配色主题""""""""""""""""""""""""""""""""""""""""""""" 不同类型文件设置""""""""""""""""""""""""""""""""""""""""""autocmd BufNewFile,BufRead *.py,*.pyw setf pythonautocmd BufNewFile,BufRead *.rb,*erb setlocal et sta sw=2 sts=2autocmd Filetype ruby set et sta sw=2 sts=2autocmd Filetype eruby set et sta sw=2 sts=2autocmd Filetype lisp set et sta sw=4 sts=4""""""""""""""""""""""""""""""""""""""""""""" leader按键以及tab栏切换设置 """"""""""""""""""""""""""""""""""""""""""let mapleader=";"nnoremap <C-l> gt           " 跳转到后一个tabnnoremap <C-h> gT           " 跳转到后一个tabnnoremap <leader>t :tabe<CR>""""""""""""""""""""""""""""""""""""""""""""" 定义Alt+方向键进行窗口间跳转""""""""""""""""""""""""""""""""""""""""""noremap <F2> <C-W><C-W>     " 依次遍历各窗口noremap <M-Left> <C-W>h     " 跳转到左窗口noremap <M-Right> <C-W>l    " 跳转到右窗口noremap <M-Up> <C-W>k       " 跳转到上窗口noremap <M-Down> <C-W>j     " 跳转到下窗口  """"""""""""""""""""""""""""""""""""""""""""" NerdTree插件""""""""""""""""""""""""""""""""""""""""""" 按下F3键开启/关闭NERDTreemap <F3> :NERDTreeMirror<CR>map <F3> :NERDTreeToggle<CR>" 控制光标移动超过一定距离时,自动将焦点移到屏中let NERDTreeAutoCenter=1" 指定鼠标模式(1.双击打开;2.单目录双文件3.单击打开let NERDTreeMouseMode=2" 是否默认显示书签列表let NERDTreeShowBookmarks=0" 是否显示隐藏文件let NERDTreeShowHidden=1" 窗口位置(left or right)let NERDTreeWinPos='left'" 窗口宽度let NERDTreeWinSize=30""""""""""""""""""""""""""""""""""""""""""""" airline设置""""""""""""""""""""""""""""""""""""""""""set t_Co=256set laststatus=2set lazyredrawlet g:airline_theme='powerlineish'" 使用powerline打过补丁的字体let g:airline_powerline_fonts=1if !exists('g:airline_symbols')    let g:airline_symbols={}endif" 关闭空白符检测let g:airline#extensions#whitespace#enabled=0let g:airline_detect_modified=1let g:airline_detect_paste=1" enable bufferline integrationlet g:airline#extensions#bufferline#enabled=1" enable syntastic integrationlet g:airline#extensions#synastic#enabled=1" enable tabbar integrationlet g:airline#extensions#synastic#enabled=1" 开启tablinelet g:airline#extensions#tabline#enabled=1" tabline中当前buffer两端的分隔字符let g:airline#extensions#tabline#left_sep=' '" tabline中未激活buffer两端的分隔字符let g:airline#extensions#tabline#left_alt_sep='|'" tabline中buffer显示编号let g:airline#extensions#tabline#buffer_nr_show=1" 映射切换buffer的键位nnoremap [b :bp<CR>nnoremap ]b :bn<CR>nnoremap <C-Left> :bp<CR>nnoremap <C-Right> :bn<CR>""""""""""""""""""""""""""""""""""""""""""""" Ctrlp 设置""""""""""""""""""""""""""""""""""""""""""if has('win32') || has('win64')    set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\*else    set wildignore+=*/.git/*,*/.hg/*.*/.svn/*endif""""""""""""""""""""""""""""""""""""""""""""" neocomplacache 设置""""""""""""""""""""""""""""""""""""""""""let g:acp_enableAtStartup=0" Use neocomplcache" 最好关闭,要不提示太频繁let g:neocomplcache_enable_at_startup=0 " Use smartcaselet g:neocomplcache_enable_smart_case=1" Set minimum syntax keyword lengthlet g:neocomplcache_min_syntax_length=3" AutoComplPop like behavior"let g:neocomplcache_enable_auto_select=1inoremap <expr><C-g> neocomplcache#undo_completion()" <TAB>: completion.inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"""""""""""""""""""""""""""""""""""""""""""""" syntastic 设置""""""""""""""""""""""""""""""""""""""""""let g:syntastic_enable_highlighting=0let g:syntastic_check_on_open=1let g:syntastic_mode_map={ 'mode': 'passive',            \ 'active_filetypes': ['ruby', 'python'],            \ 'passive_filetypes': [] }""""""""""""""""""""""""""""""""""""""""""""" Ultisinps 设置""""""""""""""""""""""""""""""""""""""""""let g:UltisnipsExpandTrigger="<C-k>"let g:UltisnipsJumpForwardTrigger="<C-n>"let g:UltisnipsJumpBackwardTrigger="<C-p>"""""""""""""""""""""""""""""""""""""""""""""" linux下面字典位置的设置""""""""""""""""""""""""""""""""""""""""""" C-x C-k 在字典查找并补齐" C-x C-o 万能补全功能,C-n自动补全if has('unix')    set dictionary+=/usr/share/dict/words    set isk+=-          " 设置-为单词的一部分endif""""""""""""""""""""""""""""""""""""""""""""" Tagbar设置""""""""""""""""""""""""""""""""""""""""""nmap <F4> :TagbarToggle<CR>let g:tagbar_left=1

0 0
原创粉丝点击