配置vim for python

标签(空格分隔): vim python 自动补全


1.pathogen 插件管理器

描述
Manage your ‘runtimepath’ with ease. In practical terms, pathogen.vim makes it super easy to install plugins and runtime files in their own private directories.

下载地址:http://www.vim.org/scripts/script.php?script_id=2332

安装

mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

配置
Add this to your vimrc:

execute pathogen#infect()

If you’re brand new to Vim and lacking a vimrc, vim ~/.vimrc and paste in the following super-minimal example:

execute pathogen#infect()
syntax on
filetype plugin indent on

Now any plugins you wish to install can be extracted to a subdirectory under ~/.vim/bundle, and they will be added to the ‘runtimepath’.

2.Pydiction tab键自动补全

描述
Pydiction allows you to Tab-complete Python code in Vim such as keywords, built-ins, standard library, and third-party modules.

下载地址:http://vim.sourceforge.net/scripts/script.php?script_id=850

安装

cd ~/.vim/bundle
git clone https://github.com/rkulla/pydiction.git

配置
In your vimrc file, first add the following line to enable filetype plugins:

filetype plugin on

then make sure you set g:pydiction_location to the full path of where you installed complete-dict. Ex:

let g:pydiction_location = ‘/path/to/complete-dict’

for example, if you used Pathogen to install Pydiction, you would set this to:

let g:pydiction_location = ‘/home/user/.vim/bundle/pydiction/complete-dict’

and the dictionary will be available to all of your virtualenv’s as well.

You can change the height of the completion menu by setting g:pydiction_menu_height in your vimrc:

let g:pydiction_menu_height = 3

3.syntastic 语法检查

描述
Syntastic is a syntax checking plugin for Vim that runs files through external syntax checkers and displays any resulting errors to the user.

下载地址:https://github.com/scrooloose/syntastic

screenshot

Last but not least: syntastic doesn’t know how to do any syntax checks by itself. In order to get meaningful results you need to install external checkers corresponding to the types of files you use.

安装
Install syntastic as a Pathogen bundle
You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:

cd ~/.vim/bundle && \
git clone –depth=1 https://github.com/scrooloose/syntastic.git

Quit vim and start it back up to reload it, then type:

:Helptags

Recommended settings

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

pylint Python 代码分析工具

描述
Pylint 是一个 Python 代码分析工具,它分析 Python 代码中的错误,查找不符合代码风格标准

下载地址:https://www.pylint.org/

安装
ubuntu:sudo apt-get install pylint

要求
pylint需要使用到其他的软件包
1.astroid
安装:

git clone https://github.com/PyCQA/astroid/
sudo python setup.py install

2.isort
安装

ubuntu:git clone https://github.com/timothycrosley/isort.git
sudo python setup.py install

在.vimrc文件添加

let g:syntastic_python_checkers=[‘pylint’]

禁用syntastic对python的检查,但是不影响检查其他语言:

let g:syntastic_python_checkers=[]

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值