當前位置:
首頁 > 知識 > 打造Python的vim環境

打造Python的vim環境

準備用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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

最後,分享一個有完整步驟的鏈接:https://www.cnblogs.com/linxiyue/p/7834817.html

打造Python的vim環境

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 程序員小新人學習 的精彩文章:

開源一個Android自定義圖表庫
Python爬蟲之基本原理

TAG:程序員小新人學習 |