The purpose of the article is to tell about my search for the “ideal” editor for python code, about why I chose emacs and briefly how I (emacs) set it up to work with python.
A small prehistory: I have been working on python for more than two years and all this time I tried to find the optimal editor. What I just did not use during this time is mcedit, nano, gedit, netbeans, eclipse, and also some other paid options (demo version). But there is always something missing, somewhere autocomplete, somewhere backlight, somewhere banal inconvenient. What a period (about 10 months) used Eclipse, but its gluttony in resources, hangs brought it to a white heat. When I finally got bored with eclipse errors, I began searching for such an editor that would be an excellent assistant in my work.
Armed with google, I started searching for the “perfect” editor.
Note! Further in the text is the personal opinion of the author.
An “ideal” editor should be:
- Easy - do not require more than 500Mb of RAM for your work;
- Custom - give the opportunity to customize (appearance, key binding);
- Reliable - to give the opportunity to restore previous data in the event of a crash;
I also wanted to note the desired functionality and features of use:
- Autocomplete - facilitates the work, do less clicks;
- Introspection by code - reduce the time to search for the required class and / or method in it;
- Syntax highlighting - we improve the readability of the code, we reduce the load on the vision;
- Minimal use of the mouse - do not take your hands off the keyboard;
- Adding snippets - reduce the routine actions to create new structures;
- Cvs / vcs support - svn, git, mercurial;
- Project management support;
Python-specific functionality:
- Python-shell support;
- Check pep8, pylint;
- Ending, line breaks, indents;
- Debugging;
Candidate # 1 -
Gedit :
Regular editor of the graphical shell Gnome.What is good:
- Light;
- Customizable;
- There is python support;
- Easily extended with additional plugins;
What is bad:
- Low reliability (sometimes it still hangs, after which it is problematic to restore the previous state);
- No project management support;
- There is no integration with git (there are several plugins, but I didn’t figure out how to work with them correctly);
Bottom line: It is quite suitable for editing small scripts, it is practically unsuitable for larger projects.
')
Candidate # 2 -
Eric :
The Eric Python IDEWhat is good:
- Full IDE;
- Flexible settings;
- Python support;
- It is possible to extend the functionality of plug-ins;
What is bad:
- To install, you need QT;
- Bulky;
- Like any IDE requires a period of habituation (not mastered);
Bottom line: At first glance, a full-fledged IDE. With a thoughtful interface. If you get used probably will be convenient.
Candidate # 3 -
EmacsAustere editor with a lot of customizable featuresWhat is good:
- Light;
- Customizable;
- There is support for python and many other languages;
- Easy to expand;
What is bad:
- You can customize to infinity and never set it up completely;
- Many key-binding;
- High level of entry into use;
Bottom line: This editor is used at this time. It is difficult to set up, it is not easy to get used to use, it is very difficult then to use another editor (even briefly)
Why choose emacs? I watched for a long time, but like many developers tried to use a ready-made solution without complex gestures. Yes, and probably did not want to mess around for a long time with the setting. But only when I was tired of all sorts of ruches and buttons I wanted to just work and not be distracted by anything. In general, installing emacs and spending several sleepless days on the setup, and after working in it for a while, I realized that this editor would linger with me for a long time.
How to set up. Many novice emacs users inflate their "~ / .emacs" with unstructured plugins and hooks. In the beginning I did the same, but looking at the organization of the settings for
gabrielelanaro , I made the following structure.
Used configuration:
.
.. dist - distributions of extensions
... autocomplete - autocompletion in emacs, used version from
gabrielelanaro repository,
original version... python-mode - python support in emacs from the python community version <a ref= pas
launchpad.net/python-mode »> 6.0.2
... yasnippet - support for snippets in emacs, used version from
gabrielelanaro repository,
original version... pymacs - python binding to emacs,
project site.. doc - extension documentation
.. exten - extensions to be initialized
... autocomplete
... color-theme.el - connection of additional themes
... highlight-indentation.el - highlight indents
... open-next-line.el
... python-mode.el - actually python-mode
... python-pylint.el - pylint support (pylint must be installed on the system)
... snippet-helpers.el - addition to yasnippet
... yasnippet
... autopair.el - closing pair symbols
... fill-column-indicator.el - line indicator
... lambda-mode.el - replacing lambda with a mapping symbol
... pymacs.el
... python-pep8.el - support for pep8 (pep8 must be installed on the system)
... smart-operator.el
... themes - additional themes
.. init - component initialization files
.. init.el - directly initialize the configuration
.. python-dist - distributions of python packages necessary for work
... Pymacs
... rope
... ropemacs
... ropemode
The complete configuration can be taken from my repository on
GitHub , the configuration is not final. Future plans to integrate ECB. In the wiki repository add a description of what key-binding is used.
Interesting additions integrated into this configuration:
Switching between buffers:
\ C +. - next buffer
\ C +, - prev buffer
Switch between windows:
\ M + up
\ M + down
\ M + left
\ M + right
Autocompletion by pressing \ TAB
In order for the addition of python classes and methods to work correctly, you need to activate the rope project:
By default, if the project is not created, rope offers to create it.
Some screenshots:
Syntax synopsis, vertical blue bar, 80th character indicator
Autocompletion in work
iBuffer - shows a list of all open buffers
Integrated ido with fuzzy search supportI would like to hear from experienced emacs users about this method of organizing emacs configuration and about this configuration in particular. Examples and suggestions for improving this configuration are welcome.
The platform on which this configuration works:
Linux ppc 3.1.5-gentooppc # 1 SMP Wed Jan 4 00:01:44 EET 2012 i686 Intel Pentium CPU P6200 @ 2.13GHz GenuineIntel GNU / Linux