Vim's Python Code detection Tool

Source: Internet
Author: User

Here are three VIM plug-ins, one is Pyflakes, the other is PEP8, and their fit Flake8 installed

Installation is simple, find your. Vim directory, unzip the two compressed packets and put them in.
Go below vim official down down.
Pyflakes http://www.vim.org/scripts/script.php?script_id=2441
PEP8 http://www.vim.org/scripts/script.php?script_id=2914
Flake8 http://www.vim.org/scripts/script.php?script_id=4440
and put it in ~/.vim/ftplugin/python.
Note that the user's. Vim directory is placed. So if you're using the root account, you need to put a copy in the/root/.vim. Additionally PEP8 need to install PEP8 for Python

#pip install-u PEP8 Configuration

Flakes added to VIMRC inside.

if has("gui_running")
highlight SpellBad term=underline gui=undercurl guisp=Orange
endif
let g:pyflakes_use_quickfix = 1 "这是开关

PEP8 can set which key to detect, default F5

"let g:pep8_map=‘whatever key‘

Flake8
"Auto-check file for errors on write:
let g:PyFlakeOnWrite = 1
"List of checkers used:
let g:PyFlakeCheckers = ‘pep8,mccabe,pyflakes‘
"Default maximum complexity for mccabe:
let g:PyFlakeDefaultComplexity=10
"List of disabled pep8 warnings and errors:
let g:PyFlakeDisabledMessages = ‘E501‘
"Default height of quickfix window:
let g:PyFlakeCWindow = 6
"Whether to place signs or not:
let g:PyFlakeSigns = 1
"Maximum line length for PyFlakeAuto command
let g:PyFlakeMaxLineLength = 100
"Visual-mode key command for PyFlakeAuto
let g:PyFlakeRangeCommand = ‘Q‘

Use

Flakes will be prompted directly on the code editing page, with a malformed monogram red

The PEP8 is a hint in the Output window of vim

And Flake8 can prompt the line and error message directly at the time of saving

Quick fix Pyflakeauto feature for Flake8
We can bind it to the FX button.
Add the following map to the VIMRC to fix the PEP8 error directly by F6
map <F6> :PyFlakeAuto<CR>

There are Pychecker, Pylint and other testing, it is not listed.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Vim's Python Code detection Tool

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.