background preloader

VIM

Facebook Twitter

Jedi - an awesome autocompletion/static analysis library for Python — Jedi 0.12.0 documentation. Release v0.7.1.alpha1. (Installation) Jedi is an autocompletion tool for Python that can be used in IDEs/editors. Jedi works. Jedi is fast. It understands all of the basic Python syntax elements including many builtin functions. Additionaly, Jedi suports two different goto functions and has support for renaming as well as Pydoc support and some other IDE features. Jedi uses a very simple API to connect with IDE’s. To give you a simple example how you can use the Jedi library, here is an example for the autocompletion feature: >>> import jedi>>> source = '''... import datetime... datetime.da'''>>> script = jedi.Script(source, 3, len('datetime.da'), 'example.py')>>> script<Script: 'example.py'>>>> completions = script.completions()>>> completions [<Completion: date>, <Completion: datetime>, ...]

>>> print(completions[0].complete)te>>> print(completions[0].name)date. Vim as a Python IDE - Martin Brochhaus. Vim as a Python IDE - Martin Brochhaus. Klen/python-mode. Davidhalter/jedi-vim. Davidhalter/jedi. Vim as a Python IDE. Ropevim, rope in vim. John Anderson ( sontek ) - Turning Vim into a modern Python IDE. $ git clone $ cd dotfiles $ .

John Anderson ( sontek ) - Turning Vim into a modern Python IDE

/install.sh vim Download PDF Version Back in 2008, I wrote the article Python with a modular IDE (Vim). Years later, I have people e-mailing me and commenting daily asking for more information, even though most of the information in it is outdated. Here is the modern way to work with Python and Vim to achieve the perfect environment. Because one of the most important parts about a development environment is the ability to easily reproduce across machines, we are going to store our vim configuration in git: $ mkdir ~/.vim/ $ mkdir ~/.vim/{autoload,bundle} $ cd ~/.vim/ $ git init The purpose of the autoload directory is to automatically load the vim plugin Pathogen, which we'll then use to load all other plugins that are located in the bundle directory.

You'll need to add the following to your ~/.vimrc so that pathogen will be loaded properly. Filetype off call pathogen#runtime_append_all_bundles() call pathogen#helptags() Thats it! Code Folding Window Splits Pep8. Indenting Python with VIM. Vim’s default configuration for Python sucks!

Indenting Python with VIM

If you have used Vim to write Python code, you probably know this very well. It does not align to parentheses and braces. dict(foo=bar<return> _ <= directly insert a 'tab' {'hello': 'world',<return> _ <= Same thing! It doesn’t add indentation after Python keyword if True:<return> _ <= Come on! Not even mentioning insanities like: insert tabs instead of spaces, or tab width is 8 spaces.

Making Vim PEP-8 friendly Sane defaults First I would like to point out something when writing a Vim configuration file. Generally don’t use the autocmd command to add hooks to a specific filename’s extension. VIM as Python IDE. Finding the perfect IDE for Python isn’t an easy feat.

VIM as Python IDE

There are a great many to chose from, but even though some of them offer really nifty features, I can’t help myself but feel attracted to VIM anyway. I feel that no IDE accomplishes the task of giving the comfort of complete power over the code – something is always missing out. This is why I always come back to using IDLE and VIM. Those two seem to be best companions when doing some quick and agile hacking – but when it comes to managing bigger and longer term projects, this combo needs some tweaking. But when it’s done, VIM will be a powerful IDE for Python – including code completion(with pydoc display), graphical debugging, task-management and a project view. This is where we are going: So, these are my thoughts on a VIM setup for coding (Python).

Modern GUI VIM implementations like GVIM or MacVIM give the user the opportunity to organize their open files in tabs. From the eye-candy to the implementation. Vim home page.