1. 程式人生 > >vim配置python編輯器

vim配置python編輯器

環境:centos7 + python2.7

坑:centos7中自帶的vim 版本是7.4.160,安裝完成YMC後報:YouCompleteMe unavailable: requires Vim 7.4.1578+.

解決方法:升級VIM 到8版本後解決

vimrc配置檔案:

set nocompatible              " be iMproved, required
set backspace=2
syntax on                     " 語法高亮
filetype off                  " required
filetype indent on            " 根據檔案型別縮排
filetype plugin on            " for vim Makefile
set nu                        " 顯示行號
" 縮排設定
set autoindent                " 自動縮排
set cindent                   " C風格縮排
set smartindent               " 智慧縮排

" 普通檔案Tab設定             
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" 括號匹配
set showmatch
set matchtime=1               " 匹配高亮時間(單位是十分之一秒)
set completeopt=longest,menu    "讓Vim的補全選單行為與一般IDE一致(參考VimTip1228)

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Chiel92/vim-autoformat'

call vundle#end()            " required
filetype plugin indent on    " required

let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:ycm_complete_in_strings = 0 " 設定YCM不在字串內補全
let g:ycm_confirm_extra_conf = 0 
let g:ycm_seed_identifiers_with_syntax = 1 


參考文章:

http://blog.csdn.net/nzyalj/article/details/75331822