From 2808cd2258661afd9dc1aa172930969ad55fdb77 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Sun, 24 Apr 2011 17:51:34 +0200 Subject: [PATCH] add basic vim config --- docs/starting/dev-env.rst | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/starting/dev-env.rst b/docs/starting/dev-env.rst index cbddc5275..46539b01f 100644 --- a/docs/starting/dev-env.rst +++ b/docs/starting/dev-env.rst @@ -11,6 +11,49 @@ Editors Text Editors ------------- +** VIM ** + +There exist a couple of plugins and settings for the VIM editor to aid python +development. If you only develop in Python, a good start is to set the default +settings for indentation and linewrapping to values compliant with PEP8:: + + set textwidth=79 + set shiftwidth=4 + set tabstop=4 + set expandtab + set softtabstop=4 + set shiftround + +With these settings newlines are inserted after 79 characters and indentation +is set to 4 spaces per tab. If you also use VIM for other languages, there is a +handy plugin at indent_, which handles indentation settings for python source +files. +Additionally there is also a handy syntax plugin at syntax_ featuring some +improvements over the syntax file included in VIM 6.1. + +These plugins supply you with a basic environment for developing in Python. +However in order to improve the programming flow we also want to continually +check for PEP8 compliance and check syntax. Luckily there exist PEP8_ and +Pyflakes_ to do this for you. If your VIM is compiled with `+python` you can +also utilize some very handy plugins to do these checks from within the editor. +For PEP8 checking install vim-pep8_. Now you can map the vim function +`Pep8()` to any hotkey or action you want. Similarly for pyflakes you can +install vim-pyflakes_. Now you can map `Pyflakes()` like the PEP8 function and +have it called quickly. Both plugins will display errors in a quickfix list and +provide an easy way to jump to the corresponding line. A very handy setting is +calling these functions whenever a buffer is saved. In order to do this, enter +the following lines into your vimrc:: + + autocmd BufWritePost *.py call Pyflakes() + autocmd BufWritePost *.py call Pep8() + + +.. _indent: http://www.vim.org/scripts/script.php?script_id=974 +.. _syntax: http://www.vim.org/scripts/script.php?script_id=790 +.. _Pyflakes: http://pypi.python.org/pypi/pyflakes/ +.. _vim-pyflakes: https://github.com/nvie/vim-pyflakes +.. _PEP8: http://pypi.python.org/pypi/pep8/ +.. _vim-pep8: https://github.com/nvie/vim-pep8 IDEs pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy