Efficient Dynamic language development environment (Python:linux + emacs + Evil + *.el)
Efficient Dynamic language development environment (Python:linux + emacs + evil + *.el) Table of Contents
- 1 Preface
- 1.1 Dynamic languages
- 1.2 Efficient
- 1.3 Linux
- 1.4 Emacs+evil
- 2 Building the Environment
- 2.1 Python-mode
- 2.2 Jedi
- 2.3 Pep8,pylint,flycheck
- 2.4 Pylookup
- 2.5 ein
- 3 Commissioning
- 4 illustration
- 5 PostScript
1Objective1.1Dynamic language
- This refers to dynamic languages. As one person says, if you use Java, the best option is eclipse or IntelliJ, and if you use NET, the best option is Visual Studio. One obvious development advantage of dynamic language is the analytic operation. You can add classes or functions to the running environment continuously during the development process. You can also share the same running environment in different places (this article takes Python as an example).
1.2Efficient
- This refers to efficient editing and quick testing.
1.3Linux
- Shell, at any time, when you are tired of repeating input instructions (especially within a project), write a script in place and then automate.
- Inter-process cooperation. This "UNIX programming art" is often mentioned here, emphasizing the benefits of the back-end server and front-end collaboration in development (see the example below).
1.4Emacs+evil
- What's evil? It is the Vim simulator on Emacs, install this plug-in, you can use all the Vim shortcuts on Emacs to achieve quite efficient editing, specifically can see this: efficient text editing 7 habits. As for the concept and operation of VIM, there are more than 2000 pages in a Chinese manual, which shows how powerful the function is!
- Why is Emacs? Powerful, rich plug-ins, fully customizable, the cattle people like to use it! Remember the talent said, you use Emacs, like in the discipline of their own children (as if to say so).
- Emacs's Server+client: Connecting to the server through the client can have a development environment that the server has built at any time, which is quite handy for rapid test development.
2Build the Environment
A detailed configuration can refer to my other blog, ' My Linux discovery path ' for Python configuration.
2.1Python-mode
- This is the Python development model of Emacs. There are two fairly handy commands: ' eval buffer, ' eval region. After running M-x Run-python, basically you do not need to leave the current edit buffer, all the statements can be directly send to the background to run the Python parser (back end with the front end of a perfect example of cooperation). If you open two windows, you can edit them while you see the results. Of course, there are still some of these two instructions are not enough, I am more time to write a statement, and then want to know immediately what the result is, so, I add the following code in Init-python-mode.el (OK, now just press "\c-c \c-l", The statement under the cursor will send itself to the Python runtime, and the result can be seen immediately, and before that, I have to select the statement first, then Eval region, and then deselect. Emacs is customizable)
(Eval-after-load 'python `(Progn (Defun Python-shell-eval-current-line () "Eval." (Interactive) (Python-shell-send-region(Line-beginning-position) (Line-end-position))) (Define-key Python-mode-map(Kbd"C-c c-l")Nil) (Define-key Python-mode-map(Kbd"C-c c-l") 'Python-shell-eval-current-line)))
If you work with Vim's quick text, you'll find that the process of editing the code is so smooth.
2.2Jedi
- This is the Python backend completion toolkit, which is the exact words in the document:
Jedi.el is a Python auto-completion package for emacs.it aims at helping your Python coding in a non-destructive the. It also helps you to find information on Python objects, such as docstring,function arguments and code location.
With this powerful backend (another perfect example of the front and back end), you have auto-completion, view parameters, jump to the definition of variables, and be free to roam in a python programming environment. For example, I recently used scrapy, when I do not know the use of a function, press "\s-c.", I can easily go to Scrapy source code, directly read the specific implementation of the source code (if you re-browse the file on Emacs on the plugin, where you want to go, where you can go).
2.3Pep8,pylint,flycheck
- These plug-ins together, the basic can be perfectly fixed in Python code syntax errors and format normalization. Once you have an error in your code, you can immediately see what went wrong in mini buffer.
2.4Pylookup
- This plugin is used to query the official Python manual, for the built-in class library or function, execute command ' pylookup-lookup, you can view the corresponding module in the browser description.
2.5Ein
- Emacs as a front end of the Ipython notebook, can be directly to the Ipython notebook server, and then you can implement the call. and has a full set of instructions for Ipython (another example of a backend front end cooperation).
3Debugging
- You can run the PDB directly in Emacs for debugging.
4Icon
- The development environment for Emacs + Pymongo (MongoDB python driver) is shown. Edit. py file, open a Python run environment via run Python, connect to MongoDB via eval current buffer, via emacsclient (need to start Emacs server) Open another. py file and go directly to the server's Python run environment via eval current line.
5Postscript
(Thank you for reading, welcome to correct, welcome to communicate)
date:2015-07-12t15:52+0800
Author: Walker knows
ORG version 7.9.3f with Emacs version 24
Validate XHTML 1.0
Efficient Dynamic language development environment (Python:linux + emacs + Evil + *.el)