Features Tutorials

Vim as a Python IDE, or Python IDE as Vim

“Vim as a Python IDE” is a hot topic. Everybody knows Vim is an incredible text editor for typing and editing text very quickly and efficiently (if you are an experienced Vim user, that is). Moreover, it is highly customizable, reliable, works in almost any environment and is praised by experienced developers as well. Naturally, lots of people choose Vim as their editor for coding in Python and other languages.


While Vim is a great choice indeed, as soon as you try to use it for anything it wasn’t designed for, you run into problems. For example, if you use it as an IDE. Clearly, many Python developers want it to be an IDE simply because productive Python development requires more than just a great editor. While this may work for some languages, it just doesn’t for Python, which is really hard to maintain on large and complex projects.

With Python, there is a real need to get rid of routine tasks and use supplementary tools like code inspections, error highlighting on the fly, dependency checks, quick-fixes, refactorings, a debugger, frameworks support, testing assistance, Version control, search and navigation, project management, remote development assistance, PEP-8 compliance checks. That’s quite a list. And all these features must work together in a reliable, efficient and robust fashion.

That’s what IDEs are designed for. They provide the necessary level of efficiency and comfort for using many tools and features in one place.

For better or worse, Vim is not an IDE. Sure, it is customizable and supports many things, with lots of plugins and add-ons and other bells and whistles. Yet it’s really far off from being a real IDE.

Here is a poignant example of Vim being overloaded. The result of many sophisticated hacks modifications, which are not clear even for experienced Vim users, is the following cramped editor window:

If you wanted an IDE to begin with, this is definitely the hard way to get one.

PyCharm has an upside-down approach to this problem. PyCharm is a complete IDE with a highly customizable and powerful editor inherited from the IntelliJ Platform. But you don’t have to choose between an IDE or Vim: thanks to the IdeaVim plugin (available for all IntelliJ-based products), you really can get the best of both worlds. IdeaVim supports many Vim features including shortcuts, motion keys, many types of commands, registers, macros, modes  and a lot more.

But don’t take our word for it. “Nothing can replace Vim, but IdeaVim feels closer than any other editor’s attempts,” says Andrew Brookins, an experienced developer who has tried different text editors and tools for Python and Web development, in his amazingly comprehensive review One Year Later: An Epic Review of PyCharm 2.7 from a Vim User’s Perspective. We strongly recommend reading it if you haven’t already.

http://www.youtube.com/watch?v=UlREhZ-orlk

To enjoy VIM emulation inside PyCharm, download and install PyCharm, go to File | Settings | Plugins and search for IdeaVim. Install it, restart the IDE and that’s it!
Give it a try, and while you’re at it feel free to vote for new features and report any issues in YouTrack.

Develop with pleasure!
PyCharm Team

image description