準備用vim寫python3,所以配置一下環境。在此記錄一下過程中出錯的地方,以便自己和同行查用。
1、在下載python3之後,改了python軟連接,也修改了/usr/bin/yum頭部的python爲python2.7,yum安裝時報錯:File “/usr/libexec/urlgrabber-ext-down”, line 28,
修改了/usr/libexec/urlgrabber-ext-down和/usr/bin/yum-config-manager頭部的python爲python2.7解決。
2、在git 下載vundle的時候,報錯:fatal: unable to access ‘https://github.com/VundleVim/Vundle.vim.git/‘: Peer reports incompatible or unsupported protocol version.
使用yum update -y nss curl libcurl解決
3、安裝YouCompleteMe之後,出現報錯:E185: Cannot find color scheme ‘Zenburn’ ,YouCompleteMe unavailable: requires Vim 7.4.1578+.。vim版本不兼容,重新安裝vim8解決。
另附.vimrc配置,包括一些用到的插件:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'Valloric/YouCompleteMe'
Plugin 'altercation/vim-colors-solarized'
Plugin 'Yggdroot/indentLine'
Plugin 'jnurmine/Zenburn'
Plugin 'scrooloose/nerdtree'
" 你的所有插件要寫在這行之前,即在vundle#begin()和vundle#end()之間
call vundle#end() " required
filetype plugin indent on " required
set nocompatible "關閉與vi的兼容模式
set number "顯示行號
set nowrap "不自動折行
set showmatch "顯示匹配的括號
set scrolloff=3 "距離頂部和底部3行"
set encoding=utf-8 "編碼
set fenc=utf-8 "編碼
set mouse=a "啓用鼠標
set hlsearch "搜索高亮
syntax on "語法高亮
map <C-n> :NERDTreeToggle<CR>
au BufNewFile,BufRead *.py
\ set tabstop=4 "tab寬度
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79 "行最大寬度
\ set expandtab "tab替換爲空格鍵
\ set autoindent "自動縮進
\ set fileformat=unix "保存文件格式
"代碼摺疊,zc創建摺疊,za打開或關閉摺疊
set foldmethod=indent
set foldlevel=9
colorscheme Zenburn
"syntax enable
"set background=light or dark
"colorscheme solarized
最後,分享一個有完整步驟的鏈接:https://www.cnblogs.com/linxiyue/p/7834817.html