@@ -11,6 +11,49 @@ Editors
1111Text Editors
1212-------------
1313
14+ ** VIM **
15+
16+ There exist a couple of plugins and settings for the VIM editor to aid python
17+ development. If you only develop in Python, a good start is to set the default
18+ settings for indentation and linewrapping to values compliant with PEP8::
19+
20+ set textwidth=79
21+ set shiftwidth=4
22+ set tabstop=4
23+ set expandtab
24+ set softtabstop=4
25+ set shiftround
26+
27+ With these settings newlines are inserted after 79 characters and indentation
28+ is set to 4 spaces per tab. If you also use VIM for other languages, there is a
29+ handy plugin at indent _, which handles indentation settings for python source
30+ files.
31+ Additionally there is also a handy syntax plugin at syntax _ featuring some
32+ improvements over the syntax file included in VIM 6.1.
33+
34+ These plugins supply you with a basic environment for developing in Python.
35+ However in order to improve the programming flow we also want to continually
36+ check for PEP8 compliance and check syntax. Luckily there exist PEP8 _ and
37+ Pyflakes _ to do this for you. If your VIM is compiled with `+python ` you can
38+ also utilize some very handy plugins to do these checks from within the editor.
39+ For PEP8 checking install vim-pep8 _. Now you can map the vim function
40+ `Pep8() ` to any hotkey or action you want. Similarly for pyflakes you can
41+ install vim-pyflakes _. Now you can map `Pyflakes() ` like the PEP8 function and
42+ have it called quickly. Both plugins will display errors in a quickfix list and
43+ provide an easy way to jump to the corresponding line. A very handy setting is
44+ calling these functions whenever a buffer is saved. In order to do this, enter
45+ the following lines into your vimrc::
46+
47+ autocmd BufWritePost *.py call Pyflakes()
48+ autocmd BufWritePost *.py call Pep8()
49+
50+
51+ .. _indent : http://www.vim.org/scripts/script.php?script_id=974
52+ .. _syntax : http://www.vim.org/scripts/script.php?script_id=790
53+ .. _Pyflakes : http://pypi.python.org/pypi/pyflakes/
54+ .. _vim-pyflakes : https://github.com/nvie/vim-pyflakes
55+ .. _PEP8 : http://pypi.python.org/pypi/pep8/
56+ .. _vim-pep8 : https://github.com/nvie/vim-pep8
1457
1558
1659IDEs
0 commit comments